5 years ago
Automated RBL Check
I know this is out there :)/emoticons/smile@2x.png 2x" title=":)" width="20">
I would love Logicmonitor to have the ability to check IPs for inclusion in the most popular RBL list.
Sometimes...
1 hour ago, Gary Dewrell said:Ok, I wrote a powershell script that will check a list of IPs against rbl-check.org and return any RBLs that have the given IP listed.
$IPList = "x.x.x.x","y.y.y.y" # The list will need to be supplied by Lomo.
foreach($IP in $IPList){
$result = Invoke-WebRequest http://rbl-check.org/rbl_api.php?ipaddress=$ip -UseBasicParsing
$rbl = $result.content.split("`r`n") | Select-String -Pattern '\;listed'
if($rbl){$output = $rbl}
}
if($output){return $output}else{return 0}
Now I have to go re-learn how to write custom datasources and covert the above to work with Lomo. Then I think I have what I waned. Automated alerts if a supplied IP is included on any RBL list. (At least any RBL list that rbl-check.org searches.)
That works, just means you know "yes I am included, or no I am not included" and then you send folks to the URL in the alert. Not the end of the world, but would be nice to know what is wrong directly. May be possible to use this API (sparingly, I assume they would be less happy if you hit it too often so for any given IP) to discover the RBLs as instances, but then you would have to define the IP to check as a device with the DS applied. I suppose the count of hits might have to be enough, then the instances are the target IPs, arbitrarily tied to a device, probably a collector (like Ping Multi). I whipped one up in Groovy (stealing a bit from another DS to get the "get a URL" code -- another great use case for code libraries...).
I posted my current code as 37XXA4, but it often takes a long time to get those released.