AutoIt
AutoIt
AbuseIPDB Check Endpoint
See more _Miscellaneous_ Examples
The check endpoint accepts a single IP address (v4 or v6). Optionally you may set the maxAgeInDays parameter to only return reports within the last x amount of days.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
; Implements the following CURL command:
; curl -G https://api.abuseipdb.com/api/v2/check \
; --data-urlencode "ipAddress=118.25.6.39" \
; -d maxAgeInDays=90 \
; -d verbose \
; -H "Key: $YOUR_API_KEY" \
; -H "Accept: application/json"
; Use the following online tool to generate HTTP code from a CURL command
; Convert a cURL Command to HTTP Source Code
$oReq = ObjCreate("Chilkat.HttpRequest")
$oReq.HttpVerb = "GET"
$oReq.Path = "/api/v2/check"
$oReq.ContentType = "application/x-www-form-urlencoded"
$oReq.AddParam "maxAgeInDays","90"
$oReq.AddParam "verbose",""
$oReq.AddParam "ipAddress","118.25.6.39"
$oReq.AddHeader "Key","$YOUR_API_KEY"
$oReq.AddHeader "Accept","application/json"
$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpSReq("api.abuseipdb.com",443,True,$oReq,$oResp)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.Load($oResp.BodyStr)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oResp.Header & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "data": {
; "ipAddress": "118.25.6.39",
; "isPublic": true,
; "ipVersion": 4,
; "isWhitelisted": false,
; "abuseConfidenceScore": 1,
; "countryCode": "CN",
; "usageType": "Data Center\/Web Hosting\/Transit",
; "isp": "Tencent Cloud Computing (Beijing) Co. Ltd",
; "domain": "tencent.com",
; "hostnames": [
; ],
; "countryName": "China",
; "totalReports": 2,
; "numDistinctUsers": 1,
; "lastReportedAt": "2021-04-03T18:55:00+00:00",
; "reports": [
; {
; "reportedAt": "2021-03-10T10:07:53+00:00",
; "comment": "SSH login attempts with user root.",
; "categories": [
; 18,
; 22
; ],
; "reporterId": 54484,
; "reporterCountryCode": "CN",
; "reporterCountryName": "China"
; },
; {
; "reportedAt": "2021-03-09T09:47:57+00:00",
; "comment": "SSH login attempts with user root.",
; "categories": [
; 18,
; 22
; ],
; "reporterId": 54484,
; "reporterCountryCode": "CN",
; "reporterCountryName": "China"
; }
; ]
; }
; }
; Sample code for parsing the JSON response...
; Use the following online tool to generate parsing code from sample JSON:
; Generate Parsing Code from JSON
Local $sReportedAt
Local $sComment
Local $iReporterId
Local $sReporterCountryCode
Local $sReporterCountryName
Local $iJ
Local $iCount_j
Local $intVal
Local $sDataIpAddress = $oJResp.StringOf("data.ipAddress")
Local $bDataIsPublic = $oJResp.BoolOf("data.isPublic")
Local $iDataIpVersion = $oJResp.IntOf("data.ipVersion")
Local $bDataIsWhitelisted = $oJResp.BoolOf("data.isWhitelisted")
Local $iDataAbuseConfidenceScore = $oJResp.IntOf("data.abuseConfidenceScore")
Local $sDataCountryCode = $oJResp.StringOf("data.countryCode")
Local $sDataUsageType = $oJResp.StringOf("data.usageType")
Local $sDataIsp = $oJResp.StringOf("data.isp")
Local $sDataDomain = $oJResp.StringOf("data.domain")
Local $sDataCountryName = $oJResp.StringOf("data.countryName")
Local $iDataTotalReports = $oJResp.IntOf("data.totalReports")
Local $iDataNumDistinctUsers = $oJResp.IntOf("data.numDistinctUsers")
Local $sDataLastReportedAt = $oJResp.StringOf("data.lastReportedAt")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("data.hostnames")
While $i < $iCount_i
$oJResp.I = $i
$i = $i + 1
Wend
$i = 0
$iCount_i = $oJResp.SizeOfArray("data.reports")
While $i < $iCount_i
$oJResp.I = $i
$sReportedAt = $oJResp.StringOf("data.reports[i].reportedAt")
$sComment = $oJResp.StringOf("data.reports[i].comment")
$iReporterId = $oJResp.IntOf("data.reports[i].reporterId")
$sReporterCountryCode = $oJResp.StringOf("data.reports[i].reporterCountryCode")
$sReporterCountryName = $oJResp.StringOf("data.reports[i].reporterCountryName")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("data.reports[i].categories")
While $iJ < $iCount_j
$oJResp.J = $iJ
$intVal = $oJResp.IntOf("data.reports[i].categories[j]")
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend