Created
April 19, 2012 13:34
-
-
Save FiXato/2421007 to your computer and use it in GitHub Desktop.
Script to generate some stats from the bopm.log of the Blitzed Open Proxy Monitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'yaml' | |
LOG_PATH = File.expand_path("~/bopm/var/bopm.log") | |
#TODO: Grab these directly from the bopm.conf | |
BLACKLISTS = %w[ | |
dnsbl.dronebl.org | |
tor.dnsbl.sectoor.de | |
rbl.efnetrbl.org | |
dnsbl.swiftbl.org | |
amsuyu.dnsbl.sectoor.de | |
] | |
stats = {} | |
BLACKLISTS.each do |blacklist| | |
results = `grep "#{blacklist}" "#{LOG_PATH}"`.split("\n") | |
stats[blacklist] = {'Total:' => results.size} | |
stats[blacklist]['Lookup errors:'] = results.select{|result| result.include?('Lookup error on')}.size | |
stats[blacklist]['Timeouts:'] = results.select{|result| result.include?(': Timeout')}.size | |
stats[blacklist]['Server Failures:'] = results.select{|result| result.include?(': Server failure')}.size | |
stats[blacklist]['Hits:'] = results.select{|result| result.include?(' appears in BL zone ')}.size | |
end | |
puts stats.to_yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bopm-stats | |
--- | |
dnsbl.swiftbl.org: | |
"Total:": 20877 | |
"Hits:": 359 | |
"Lookup errors:": 20518 | |
"Server Failures:": 469 | |
"Timeouts:": 20049 | |
rbl.efnetrbl.org: | |
"Total:": 3167 | |
"Hits:": 1947 | |
"Lookup errors:": 1220 | |
"Server Failures:": 8 | |
"Timeouts:": 1212 | |
tor.dnsbl.sectoor.de: | |
"Total:": 1297 | |
"Hits:": 994 | |
"Lookup errors:": 303 | |
"Server Failures:": 0 | |
"Timeouts:": 303 | |
dnsbl.dronebl.org: | |
"Total:": 1065 | |
"Hits:": 533 | |
"Lookup errors:": 532 | |
"Server Failures:": 0 | |
"Timeouts:": 532 | |
amsuyu.dnsbl.sectoor.de: | |
"Total:": 304 | |
"Hits:": 0 | |
"Lookup errors:": 304 | |
"Server Failures:": 0 | |
"Timeouts:": 304 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment