[PYTHON] ADMIN FINDER


#!/usr/bin/env python
######################################
#                                    #  
#   Admin Finder v1                  #
#       by cester matthew. 2012               #
#  Greetz to ljuska.org, s3ctor.org  #
#                                    #
######################################


import sys, httplib, subprocess


if sys.platform == 'linux' or sys.platform == 'linux2':
    subprocess.call("clear", shell=True)
else:
    subprocess.call("cls", shell=True)    


pathlist_path = "pathlist.txt"
dump = False
counter_fail = 0
counter_success = 0


if(len(sys.argv) >= 3):
    if sys.argv[2] != "-dump":
        pathlist_path = sys.argv[2]
    else:
        dump = True
if(len(sys.argv) >= 4):
    if sys.argv[3] == "-dump":
        dump = True
    else:
        sys.exit("Unknown argument: " + sys.argv[3])
        
if (len(sys.argv) < 2):
    sys.exit("Missing argument!")


pathlist_f = open(pathlist_path,"r")
path = pathlist_f.readlines()


target = sys.argv[1]
target = target.replace("http://","").rsplit("/",1)[0]


if dump:
    dump_f = open(target + ".txt", "w")


print 'Admin Finder started...'
print 'Using pathlist: ' + pathlist_path
if dump:
    print 'Dumping to file: ' + target + ".txt"
print 'Connecting to ' + target


for p in path:
    p = p.replace("\n","")
    p = "/" + p
    conn = httplib.HTTPConnection(target)
    conn.request("GET",p)
    response = conn.getresponse()
    if response.status == 200 or response.status == 403:
        print p, " FOUND", response.status
        counter_success += 1
        if dump:
            dump_f.write(p + " FOUND " + str(response.status) + "\n")
    else:
        counter_fail += 1
        if dump:
            dump_f.write(p + " NOT FOUND " + str(response.status) + "\n")
    
print '\n'
print counter_success, " found, ", counter_fail, " not found."

0 comments:

Post a Comment

SITE INFO