Python 3 compatibility (Resolves #10)
This commit is contained in:
39
breacher.py
39
breacher.py
@@ -1,29 +1,35 @@
|
||||
import requests #module for making request to a webpage
|
||||
import threading #module for multi-threading
|
||||
import argparse #module for parsing command line arguments
|
||||
|
||||
parser = argparse.ArgumentParser() #defines the parser
|
||||
|
||||
#Arguements that can be supplied
|
||||
parser.add_argument("-u", help="target url", dest='target')
|
||||
parser.add_argument("--path", help="custom path prefix", dest='prefix')
|
||||
parser.add_argument("--type", help="set the type i.e. html, asp, php", dest='type')
|
||||
parser.add_argument("--fast", help="uses multithreading", dest='fast', action="store_true")
|
||||
args = parser.parse_args() #arguments to be parsed
|
||||
|
||||
target = args.target #Gets tarfet from argument
|
||||
|
||||
#Fancy banner :p
|
||||
print """\033[1;34m______ ______ _______ _______ _______ _ _ _______ ______
|
||||
print ('''\033[1;34m______ ______ _______ _______ _______ _ _ _______ ______
|
||||
|_____] |_____/ |______ |_____| | |_____| |______ |_____/
|
||||
|_____] | \_ |______ | | |_____ | | |______ | \_
|
||||
|
||||
\033[37mMade with \033[91m<3\033[37m By D3V\033[1;m"""
|
||||
\033[37mMade with \033[91m<3\033[37m By D3V\033[1;m''')
|
||||
|
||||
print ('''\n I am not responsible for your shit and if you get some error while
|
||||
running Breacher, there are good chances that target isn't responding.\n''')
|
||||
print ('\033[1;31m--------------------------------------------------------------------------\033[1;m\n')
|
||||
|
||||
print """\n I am not responsible for your shit and if you get some error while
|
||||
running Breacher, there are good chances that target isn't responding.\n"""
|
||||
print "\033[1;31m--------------------------------------------------------------------------\033[1;m\n"
|
||||
try:
|
||||
target = target.replace('https://', '') #Removes https://
|
||||
except:
|
||||
print '\033[1;31m[-]\033[1;m -u argument is not supplied. Enter python breacher -h for help'
|
||||
print ('\033[1;31m[-]\033[1;m -u argument is not supplied. Enter python breacher -h for help')
|
||||
quit()
|
||||
|
||||
target = target.replace('http://', '') #and http:// from the url
|
||||
target = target.replace('/', '') #removes / from url so we can have example.com and not example.com/
|
||||
target = 'http://' + target #adds http:// before url so we have a perfect URL now
|
||||
@@ -32,13 +38,13 @@ if args.prefix != None:
|
||||
try:
|
||||
r = requests.get(target + '/robots.txt') #Requests to example.com/robots.txt
|
||||
if '<html>' in r.text: #if there's an html error page then its not robots.txt
|
||||
print ' \033[1;31m[-]\033[1;m Robots.txt not found\n'
|
||||
print (' \033[1;31m[-]\033[1;m Robots.txt not found\n')
|
||||
else: #else we got robots.txt
|
||||
print ' \033[1;32m[+]\033[0m Robots.txt found. Check for any interesting entry\n'
|
||||
print r.text
|
||||
print (' \033[1;32m[+]\033[0m Robots.txt found. Check for any interesting entry\n')
|
||||
print (r.text)
|
||||
except: #if this request fails, we are getting robots.txt
|
||||
print ' \033[1;31m[-]\033[1;m Robots.txt not found\n'
|
||||
print "\033[1;31m--------------------------------------------------------------------------\033[1;m\n"
|
||||
print (' \033[1;31m[-]\033[1;m Robots.txt not found\n')
|
||||
print ('\033[1;31m--------------------------------------------------------------------------\033[1;m\n')
|
||||
|
||||
def scan(links):
|
||||
for link in links: #fetches one link from the links list
|
||||
@@ -46,13 +52,13 @@ def scan(links):
|
||||
r = requests.get(link) #Requests to the combined url
|
||||
http = r.status_code #Fetches the http response code
|
||||
if http == 200: #if its 200 the url points to valid resource i.e. admin panel
|
||||
print ' \033[1;32m[+]\033[0m Admin panel found: %s'% link
|
||||
print (' \033[1;32m[+]\033[0m Admin panel found: %s'% link)
|
||||
elif http == 404: #404 means not found
|
||||
print ' \033[1;31m[-]\033[1;m %s'% link
|
||||
print (' \033[1;31m[-]\033[1;m %s'% link)
|
||||
elif http == 302: #302 means redirection
|
||||
print ' \033[1;32m[+]\033[0m Potential EAR vulnerability found : ' + link
|
||||
print (' \033[1;32m[+]\033[0m Potential EAR vulnerability found : ' + link)
|
||||
else:
|
||||
print ' \033[1;31m[-]\033[1;m %s'% link
|
||||
print (' \033[1;31m[-]\033[1;m %s'% link)
|
||||
paths = [] #list of paths
|
||||
def get_paths(type):
|
||||
try:
|
||||
@@ -78,8 +84,9 @@ def get_paths(type):
|
||||
except:
|
||||
paths.append(path)
|
||||
except IOError:
|
||||
print"\033[1;31m[-]\033[1;m Wordlist not found!"
|
||||
print ('\033[1;31m[-]\033[1;m Wordlist not found!')
|
||||
quit()
|
||||
|
||||
if args.fast == True: #if the user has supplied --fast argument
|
||||
type = args.type #gets the input from --type argument
|
||||
get_paths(type) #tells the link grabber to grab links according to user input like php, html, asp
|
||||
|
||||
Reference in New Issue
Block a user