AbuseIPDB API query with Powershell
#Powershell version
$myparams = @{
ipAddress="xxx.xxx.xxx.xxx"
maxAgeInDays="90"
verbose="verbose"
}
$myheaders = @{
Key = "your API Key of AbuseIPDB"
Accept="application/json"
}
$result = (Invoke-WebRequest -uri https://api.abuseipdb.com/api/v2/check -Method get -ContentType application/x-www-form-urlencode -Body $myparams -Headers $myheaders)
$obj=(ConvertForm-Json $result)
write-host "---------------------------------------------------------------"
write-host "IP: " $obj.data.ipaddress
write-host "Domain: "$obj.data.domain
write-host "Country: "$obj.data.countryName
write-host "ISP: "$obj.data.isp
write-host "AbuseConfidenceScore: "$obj.data.abuseConfidenceScore"%"
write-host "------------------------------------------------------------"
#Curl version:
Ex1. from AbuseIPDB document
curl -G https://api.abuseipdb.com/api/v2/check \
--data-urlencode "ipAddress=xxx.xxx.xxx.xxx" \
-d maxAgeInDays=90 \
-d verbose \
-H "Key: YOUR_OWN_API_KEY" \
-H "Accept: application/json"
Ex2. from AbuseIPDB document
curl -G https://api.abuseipdb.com/api/v2/blacklist \
-d confidenceMinimum=90 \
-H "Key: $YOUR_API_KEY" \
-H "Accept: text/plain"
references
https://docs.abuseipdb.com/#configuring-fail2ban