Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) AbuseIPDB Check EndpointThe 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. For more information, see https://docs.abuseipdb.com/?shell#check-endpoint
LOCAL loHttp LOCAL lnSuccess LOCAL loReq LOCAL loResp LOCAL loJResp LOCAL lnRespStatusCode LOCAL lcReportedAt LOCAL lcComment LOCAL lnReporterId LOCAL lcReporterCountryCode LOCAL lcReporterCountryName LOCAL j LOCAL lnCount_j LOCAL lnIntVal LOCAL lcDataIpAddress LOCAL lnDataIsPublic LOCAL lnDataIpVersion LOCAL lnDataIsWhitelisted LOCAL lnDataAbuseConfidenceScore LOCAL lcDataCountryCode LOCAL lcDataUsageType LOCAL lcDataIsp LOCAL lcDataDomain LOCAL lcDataCountryName LOCAL lnDataTotalReports LOCAL lnDataNumDistinctUsers LOCAL lcDataLastReportedAt LOCAL i LOCAL lnCount_i * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('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 * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest') loReq = CreateObject('Chilkat.HttpRequest') loReq.HttpVerb = "GET" loReq.Path = "/api/v2/check" loReq.ContentType = "application/x-www-form-urlencoded" loReq.AddParam("maxAgeInDays","90") loReq.AddParam("verbose","") loReq.AddParam("ipAddress","118.25.6.39") loReq.AddHeader("Key","$YOUR_API_KEY") loReq.AddHeader("Accept","application/json") loResp = loHttp.SynchronousRequest("api.abuseipdb.com",443,1,loReq) IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loReq CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJResp = CreateObject('Chilkat.JsonObject') loJResp.Load(loResp.BodyStr) loJResp.EmitCompact = 0 ? "Response Body:" ? loJResp.Emit() lnRespStatusCode = loResp.StatusCode ? "Response Status Code = " + STR(lnRespStatusCode) IF (lnRespStatusCode >= 400) THEN ? "Response Header:" ? loResp.Header ? "Failed." RELEASE loResp RELEASE loHttp RELEASE loReq RELEASE loJResp CANCEL ENDIF RELEASE loResp * 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 lcDataIpAddress = loJResp.StringOf("data.ipAddress") lnDataIsPublic = loJResp.BoolOf("data.isPublic") lnDataIpVersion = loJResp.IntOf("data.ipVersion") lnDataIsWhitelisted = loJResp.BoolOf("data.isWhitelisted") lnDataAbuseConfidenceScore = loJResp.IntOf("data.abuseConfidenceScore") lcDataCountryCode = loJResp.StringOf("data.countryCode") lcDataUsageType = loJResp.StringOf("data.usageType") lcDataIsp = loJResp.StringOf("data.isp") lcDataDomain = loJResp.StringOf("data.domain") lcDataCountryName = loJResp.StringOf("data.countryName") lnDataTotalReports = loJResp.IntOf("data.totalReports") lnDataNumDistinctUsers = loJResp.IntOf("data.numDistinctUsers") lcDataLastReportedAt = loJResp.StringOf("data.lastReportedAt") i = 0 lnCount_i = loJResp.SizeOfArray("data.hostnames") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("data.reports") DO WHILE i < lnCount_i loJResp.I = i lcReportedAt = loJResp.StringOf("data.reports[i].reportedAt") lcComment = loJResp.StringOf("data.reports[i].comment") lnReporterId = loJResp.IntOf("data.reports[i].reporterId") lcReporterCountryCode = loJResp.StringOf("data.reports[i].reporterCountryCode") lcReporterCountryName = loJResp.StringOf("data.reports[i].reporterCountryName") j = 0 lnCount_j = loJResp.SizeOfArray("data.reports[i].categories") DO WHILE j < lnCount_j loJResp.J = j lnIntVal = loJResp.IntOf("data.reports[i].categories[j]") j = j + 1 ENDDO i = i + 1 ENDDO RELEASE loHttp RELEASE loReq RELEASE loJResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.