Fun with httpd logs and code red

Stephen Boulet spboulet at speakeasy.net
Sun Aug 19 16:40:24 EDT 2001


Just for fun, I wrote the following script to check my apache log for 
recent code red queries:

        import string

        f=open('/var/log/httpd/access_log', 'r')
        lines = f.readlines()
        ip_list = []

        for line in lines:
                if string.find(line, "GET /default.ida"):
                        a = string.split(line)
                        if a[0] not in ip_list:
                                ip_list.append(a[0])

        print "The number of IPs in my list is %d" % len(ip_list)

        f.close()

Hmmm. I have a list with 873 entries. Now what do I do with it?  ;)

-- Stephen



More information about the Python-list mailing list