2 # lasthit, part of iExploder
4 # Shows statistics about recent agents that have tested with iExploder.
5 # It takes all or part of an apache logfile via stdin, and outputs a list
6 # of all the agents who tested within that section, what their last test
7 # was, and how many tests they have done.
9 # The usefulness is finding out where a browser crashed.
15 file = File.open(ARGV[0])
20 file.readlines.each { |line|
21 if (line =~ /^(.*?) .*iexploder.*?test=(\d+).* HTTP.* \"(.*?)\"$/)
26 hostHash[host] = Hash.new
28 if (! hostHash[host][agent])
29 hostHash[host][agent] = Hash.new
30 hostHash[host][agent]['total'] = 0
33 hostHash[host][agent]['last'] = testnum
34 if line =~ /subtest=(\d+)/
35 hostHash[host][agent]['subtest'] = $1
37 hostHash[host][agent]['subtest'] = ''
39 hostHash[host][agent]['total'] = hostHash[host][agent]['total'] + 1
43 printf("%14.14s | %8.8s | %3.3s | %8.8s | %s\n",
44 "IP", "Test", "SubTest", "Total", "Agent")
45 puts "---------------------------------------------------------------------------"
46 hostHash.each_key { |host|
48 hostHash[host].each_key { |agent|
49 printf("%14.14s | %8.8s | %3.3s | %8.8s | %s\n",
50 host, hostHash[host][agent]['last'], hostHash[host][agent]['subtest'], hostHash[host][agent]['total'], agent);