[Python] Admin Panel Finder 06-26-2013, 09:45 AM
#1
My admin panel finder I coded in python. Everything should work fine, if not please let me know. The only thing that I could never get to work no matter what I did, was get the program to stop with ctrl + c, even throwing a KeyboardInterrupt exception didn't work no matter where I placed it. Anyway, if you want to exit the program just close out of the shell.
download all of the files here, which you will need the text files included for this to work: http://mls577.bugs3.com/apf.rar
If you want to see the source code to learn from it without downloading it, I have posted it below:
download all of the files here, which you will need the text files included for this to work: http://mls577.bugs3.com/apf.rar
If you want to see the source code to learn from it without downloading it, I have posted it below:
Code:
#!/usr/bin/env python3.1
#mls577
#shoutz to suidrewt and #haxme
#http authentication check added by redN00ws of Cleveridge ( cleveridge.org )
#admin panel finder takes a website and a specified script type i.e. php and tries different admin panel paths from a text file and see if it exists
#note: make sure you keep all these text files and the program in the same folder
#imports
import urllib.request
import urllib.error
import sys
#list of possible admin panels found
possibilities = []
def main():
print("Admin Panel Finder by mls577")
print(" shoutz to #suidrewt and #haxme")
#argument check
if(len(sys.argv) > 2):
build_url()
#check to see if posibilities list is empty
if(len(possibilities) == 0):
print("\nno admin panel found!")
else:
print("\npossible admin panels:\n")
for pos in possibilities:
print(pos)
else:
usage()
def usage():
print("usage:")
print("./apf <site> <script type>")
print("./apf site.com php")
print("./apf site.com asp")
print("./apf site.com cfm")
print("./apf site.com js")
print("./apf site.com cgi")
print("./apf site.com brf")
def build_url():
try:
script_type = str(sys.argv[2])
site = sys.argv[1]
script = {"asp": "asp.txt", "brf": "brf.txt", "cfm": "cfm.txt", "cgi": "cgi.txt", "js": "js.txt", "php": "php.txt"}
#list of admin panel locations
wordlist = open(script[script_type], "r")
for page in wordlist:
url = "http://" + site + "/" + page
code = connect(url)
results(code, url)
except IOError:
print("wrong script type or file not found")
except EOFError:
pass
def connect(url):
try:
print("\ntrying... " + url)
opener = urllib.request.build_opener() #create url opener
opener.addheaders = [("User-agent", "mozilla/5.0")] # create user agent
req = opener.open(url)
return req.getcode() #return http response code
except IOError:
auth = urllib.request.HTTPBasicAuthHandler() # Create handler for possible authentication with remote host
auth.add_password(
realm='test',
uri=url,
user='tester',
passwd='testpw'
)
opener= urllib.request.build_opener(auth) # Create opener
urllib.request.install_opener(opener)
try: # try to read the possible athentication page with a wrong username and password
fl= urllib.request.urlopen(url)
return fl.read()
except urllib.error.HTTPError as e: # if the a authentication page exists it will return a 401 Http response
if e.code == 401:
return e.code
except:
return 404
except:
return 404
def results(code, url):
if(code == 200 or code == 302):
print("possible admin panel found! Http Resp. 200/302")
possibilities.append(url) #add possible admin locations to list
elif(code == 401):
print("possible admin panel found! HTTP Auth Prompt")
possibilities.append(url) #add possible admin locations to list
else:
print("doesn't exist: ")
main()
A Serious Newbies Guide to the Underground v3
http://www.hackcommunity.com/Thread-A-Se...-v3-Part-1
http://www.hackcommunity.com/Thread-A-Se...-v3-Part-1


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: Screenshot_wp.png]](http://s18.postimg.org/9f6jzk86h/Screenshot_wp.png)
![[Image: Screenshot_http_Auth.png]](http://s20.postimg.org/v1qj2gvrh/Screenshot_http_Auth.png)