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
(PowerBuilder) 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
integer li_rc oleobject loo_Http integer li_Success oleobject loo_Req oleobject loo_Resp oleobject loo_JResp integer li_RespStatusCode string ls_ReportedAt string ls_Comment integer li_ReporterId string ls_ReporterCountryCode string ls_ReporterCountryName integer j integer li_Count_j integer li_IntVal string ls_DataIpAddress integer li_DataIsPublic integer li_DataIpVersion integer li_DataIsWhitelisted integer li_DataAbuseConfidenceScore string ls_DataCountryCode string ls_DataUsageType string ls_DataIsp string ls_DataDomain string ls_DataCountryName integer li_DataTotalReports integer li_DataNumDistinctUsers string ls_DataLastReportedAt integer i integer li_Count_i // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // 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 loo_Req = create oleobject // Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0 li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest") loo_Req.HttpVerb = "GET" loo_Req.Path = "/api/v2/check" loo_Req.ContentType = "application/x-www-form-urlencoded" loo_Req.AddParam("maxAgeInDays","90") loo_Req.AddParam("verbose","") loo_Req.AddParam("ipAddress","118.25.6.39") loo_Req.AddHeader("Key","$YOUR_API_KEY") loo_Req.AddHeader("Accept","application/json") loo_Resp = loo_Http.SynchronousRequest("api.abuseipdb.com",443,1,loo_Req) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Req return end if loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.Load(loo_Resp.BodyStr) loo_JResp.EmitCompact = 0 Write-Debug "Response Body:" Write-Debug loo_JResp.Emit() li_RespStatusCode = loo_Resp.StatusCode Write-Debug "Response Status Code = " + string(li_RespStatusCode) if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Resp.Header Write-Debug "Failed." destroy loo_Resp destroy loo_Http destroy loo_Req destroy loo_JResp return end if destroy loo_Resp // 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 ls_DataIpAddress = loo_JResp.StringOf("data.ipAddress") li_DataIsPublic = loo_JResp.BoolOf("data.isPublic") li_DataIpVersion = loo_JResp.IntOf("data.ipVersion") li_DataIsWhitelisted = loo_JResp.BoolOf("data.isWhitelisted") li_DataAbuseConfidenceScore = loo_JResp.IntOf("data.abuseConfidenceScore") ls_DataCountryCode = loo_JResp.StringOf("data.countryCode") ls_DataUsageType = loo_JResp.StringOf("data.usageType") ls_DataIsp = loo_JResp.StringOf("data.isp") ls_DataDomain = loo_JResp.StringOf("data.domain") ls_DataCountryName = loo_JResp.StringOf("data.countryName") li_DataTotalReports = loo_JResp.IntOf("data.totalReports") li_DataNumDistinctUsers = loo_JResp.IntOf("data.numDistinctUsers") ls_DataLastReportedAt = loo_JResp.StringOf("data.lastReportedAt") i = 0 li_Count_i = loo_JResp.SizeOfArray("data.hostnames") do while i < li_Count_i loo_JResp.I = i i = i + 1 loop i = 0 li_Count_i = loo_JResp.SizeOfArray("data.reports") do while i < li_Count_i loo_JResp.I = i ls_ReportedAt = loo_JResp.StringOf("data.reports[i].reportedAt") ls_Comment = loo_JResp.StringOf("data.reports[i].comment") li_ReporterId = loo_JResp.IntOf("data.reports[i].reporterId") ls_ReporterCountryCode = loo_JResp.StringOf("data.reports[i].reporterCountryCode") ls_ReporterCountryName = loo_JResp.StringOf("data.reports[i].reporterCountryName") j = 0 li_Count_j = loo_JResp.SizeOfArray("data.reports[i].categories") do while j < li_Count_j loo_JResp.J = j li_IntVal = loo_JResp.IntOf("data.reports[i].categories[j]") j = j + 1 loop i = i + 1 loop destroy loo_Http destroy loo_Req destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.