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
(DataFlex) 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
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Boolean iSuccess Variant vReq Handle hoReq Variant vResp Handle hoResp Handle hoJResp Integer iRespStatusCode String sReportedAt String sComment Integer iReporterId String sReporterCountryCode String sReporterCountryName Integer j Integer iCount_j Integer iIntVal String sDataIpAddress Boolean iDataIsPublic Integer iDataIpVersion Boolean iDataIsWhitelisted Integer iDataAbuseConfidenceScore String sDataCountryCode String sDataUsageType String sDataIsp String sDataDomain String sDataCountryName Integer iDataTotalReports Integer iDataNumDistinctUsers String sDataLastReportedAt Integer i Integer iCount_i String sTemp1 Boolean bTemp1 // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // 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 Get Create (RefClass(cComChilkatHttpRequest)) To hoReq If (Not(IsComObjectCreated(hoReq))) Begin Send CreateComObject of hoReq End Set ComHttpVerb Of hoReq To "GET" Set ComPath Of hoReq To "/api/v2/check" Set ComContentType Of hoReq To "application/x-www-form-urlencoded" Send ComAddParam To hoReq "maxAgeInDays" "90" Send ComAddParam To hoReq "verbose" "" Send ComAddParam To hoReq "ipAddress" "118.25.6.39" Send ComAddHeader To hoReq "Key" "$YOUR_API_KEY" Send ComAddHeader To hoReq "Accept" "application/json" Get pvComObject of hoReq to vReq Get ComSynchronousRequest Of hoHttp "api.abuseipdb.com" 443 True vReq To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatJsonObject)) To hoJResp If (Not(IsComObjectCreated(hoJResp))) Begin Send CreateComObject of hoJResp End Get ComBodyStr Of hoResp To sTemp1 Get ComLoad Of hoJResp sTemp1 To iSuccess Set ComEmitCompact Of hoJResp To False Showln "Response Body:" Get ComEmit Of hoJResp To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iRespStatusCode Showln "Response Status Code = " iRespStatusCode If (iRespStatusCode >= 400) Begin Showln "Response Header:" Get ComHeader Of hoResp To sTemp1 Showln sTemp1 Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp // 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 Get ComStringOf Of hoJResp "data.ipAddress" To sDataIpAddress Get ComBoolOf Of hoJResp "data.isPublic" To iDataIsPublic Get ComIntOf Of hoJResp "data.ipVersion" To iDataIpVersion Get ComBoolOf Of hoJResp "data.isWhitelisted" To iDataIsWhitelisted Get ComIntOf Of hoJResp "data.abuseConfidenceScore" To iDataAbuseConfidenceScore Get ComStringOf Of hoJResp "data.countryCode" To sDataCountryCode Get ComStringOf Of hoJResp "data.usageType" To sDataUsageType Get ComStringOf Of hoJResp "data.isp" To sDataIsp Get ComStringOf Of hoJResp "data.domain" To sDataDomain Get ComStringOf Of hoJResp "data.countryName" To sDataCountryName Get ComIntOf Of hoJResp "data.totalReports" To iDataTotalReports Get ComIntOf Of hoJResp "data.numDistinctUsers" To iDataNumDistinctUsers Get ComStringOf Of hoJResp "data.lastReportedAt" To sDataLastReportedAt Move 0 To i Get ComSizeOfArray Of hoJResp "data.hostnames" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Move (i + 1) To i Loop Move 0 To i Get ComSizeOfArray Of hoJResp "data.reports" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Get ComStringOf Of hoJResp "data.reports[i].reportedAt" To sReportedAt Get ComStringOf Of hoJResp "data.reports[i].comment" To sComment Get ComIntOf Of hoJResp "data.reports[i].reporterId" To iReporterId Get ComStringOf Of hoJResp "data.reports[i].reporterCountryCode" To sReporterCountryCode Get ComStringOf Of hoJResp "data.reports[i].reporterCountryName" To sReporterCountryName Move 0 To j Get ComSizeOfArray Of hoJResp "data.reports[i].categories" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComIntOf Of hoJResp "data.reports[i].categories[j]" To iIntVal Move (j + 1) To j Loop Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.