| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 09845c8 commit cc951d4
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,25 +36,31 @@ YMMV | |||
| 36 | 36 | ||
| 37 | 37 | The options are as follows: | |
| 38 | 38 | ||
| 39 | - -h, --help show this help message and exit | ||
| 40 | - -l LIST, --list LIST List of input URLs | ||
| 41 | - -i INPUT, --input INPUT | ||
| 42 | - nmap gnmap output file | ||
| 43 | - -p, --headless Run in headless mode (using phantomjs) | ||
| 44 | - -w WORKERS, --workers WORKERS | ||
| 45 | - number of threads | ||
| 46 | - -t TIMEOUT, --timeout TIMEOUT | ||
| 39 | + -h, --help show this help message and exit | ||
| 40 | + -l LIST, --list LIST List of input URLs | ||
| 41 | + -i INPUT, --input INPUT | ||
| 42 | + nmap gnmap output file | ||
| 43 | + -p, --headless Run in headless mode (using phantomjs) | ||
| 44 | + -w WORKERS, --workers WORKERS | ||
| 45 | + number of threads | ||
| 46 | + -t TIMEOUT, --timeout TIMEOUT | ||
| 47 | 47 | time to wait for pageload before killing the browser | |
| 48 | - -v, --verbose turn on verbose debugging | ||
| 48 | + -v, --verbose turn on verbose debugging | ||
| 49 | 49 | -a, --autodetect Automatically detect if listening services are HTTP or | |
| 50 | - HTTPS. Ignores NMAP service detction and URL schemes. | ||
| 51 | - -vH, --vhosts Attempt to scrape hostnames from SSL certificates and | ||
| 52 | - add these to the URL queue | ||
| 53 | - -dB DNS_BRUTE, --dns_brute DNS_BRUTE | ||
| 54 | - Specify a DNS subdomain wordlist for bruteforcing on | ||
| 55 | - wildcard SSL certs | ||
| 56 | - -r RETRIES, --retries RETRIES | ||
| 57 | - Number of retries if a URL fails or timesout | ||
| 50 | + HTTPS. Ignores NMAP service detction and URL schemes. | ||
| 51 | + -vH, --vhosts Attempt to scrape hostnames from SSL certificates and | ||
| 52 | + add these to the URL queue | ||
| 53 | + -dB DNS_BRUTE, --dns_brute DNS_BRUTE | ||
| 54 | + Specify a DNS subdomain wordlist for bruteforcing on | ||
| 55 | + wildcard SSL certs | ||
| 56 | + -r RETRIES, --retries RETRIES | ||
| 57 | + Number of retries if a URL fails or timesout | ||
| 58 | + -tG, --trygui Try to fetch the page with FireFox when headless fails | ||
| 59 | + -sF, --smartfetch Enables smart fetching to reduce network traffic, also | ||
| 60 | + increases speed if certain conditions are met. | ||
| 61 | + -pX PROXY, --proxy PROXY | ||
| 62 | + SOCKS5 Proxy in host:port format | ||
| 63 | + | ||
| 58 | 64 | ||
| 59 | 65 | Some of the above options have non-obvious use-cases, so the following provides some more detail: | |
| 60 | 66 | ||
@@ -90,5 +96,7 @@ Some of the above options have non-obvious use-cases, so the following provides | |||
| 90 | 96 | ||
| 91 | 97 | -r, --retries -> Sometimes Firefox or ghostscript timeout when fetching a page. This could be due to a number of factors, sometimes you just have too many threads going, a network hiccup, etc. This specifies the number of times to "retry" a given host when it fails. | |
| 92 | 98 | ||
| 99 | + -tG, --trygui -> Upon failure to fetch with the headless browser phantomJS, will pop open FireFox and try again. | ||
| 100 | + | ||
| 93 | 101 | -sF, --smartfetch -> Enables smart fetching to reduce network traffic, also increases speed if certain conditions are met. | |
| 94 | 102 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ | |||
| 19 | 19 | import sys | |
| 20 | 20 | import traceback | |
| 21 | 21 | import os.path | |
| 22 | - import requests | ||
| 23 | 22 | import ssl | |
| 24 | 23 | import M2Crypto | |
| 25 | 24 | import re | |
@@ -33,6 +32,12 @@ | |||
| 33 | 32 | except: | |
| 34 | 33 | from urllib import quote | |
| 35 | 34 | ||
| 35 | + try: | ||
| 36 | + import requesocks as requests | ||
| 37 | + except: | ||
| 38 | + print "requesocks library not found - proxy support will not be available" | ||
| 39 | + import requests | ||
| 40 | + | ||
| 36 | 41 | reload(sys) | |
| 37 | 42 | sys.setdefaultencoding("utf8") | |
| 38 | 43 | ||
@@ -131,18 +136,28 @@ def parseGnmap(inFile, autodetect): | |||
| 131 | 136 | return targets | |
| 132 | 137 | ||
| 133 | 138 | ||
| 134 | - def setupBrowserProfile(headless): | ||
| 139 | + def setupBrowserProfile(headless,proxy): | ||
| 135 | 140 | browser = None | |
| 141 | + if(proxy is not None): | ||
| 142 | + service_args=['--ignore-ssl-errors=true','--ssl-protocol=tlsv1','--proxy='+proxy,'--proxy-type=socks5'] | ||
| 143 | + else: | ||
| 144 | + service_args=['--ignore-ssl-errors=true','--ssl-protocol=tlsv1'] | ||
| 145 | + | ||
| 136 | 146 | while(browser is None): | |
| 137 | 147 | try: | |
| 138 | 148 | if(not headless): | |
| 139 | 149 | fp = webdriver.FirefoxProfile() | |
| 140 | 150 | fp.set_preference("webdriver.accept.untrusted.certs",True) | |
| 141 | 151 | fp.set_preference("security.enable_java", False) | |
| 142 | 152 | fp.set_preference("webdriver.load.strategy", "fast"); | |
| 153 | + if(proxy is not None): | ||
| 154 | + proxyItems = proxy.split(":") | ||
| 155 | + fp.set_preference("network.proxy.socks",proxyItems[0]) | ||
| 156 | + fp.set_preference("network.proxy.socks_port",int(proxyItems[1])) | ||
| 157 | + fp.set_preference("network.proxy.type",1) | ||
| 143 | 158 | browser = webdriver.Firefox(fp) | |
| 144 | 159 | else: | |
| 145 | - browser = webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true','--ssl-protocol=tlsv1'], executable_path="phantomjs") | ||
| 160 | + browser = webdriver.PhantomJS(service_args=service_args, executable_path="phantomjs") | ||
| 146 | 161 | except Exception as e: | |
| 147 | 162 | print e | |
| 148 | 163 | time.sleep(1) | |
@@ -162,13 +177,13 @@ def writeImage(text, filename, fontsize=40, width=1024, height=200): | |||
| 162 | 177 | image.save(filename) | |
| 163 | 178 | ||
| 164 | 179 | ||
| 165 | - def worker(urlQueue, tout, debug, headless, doProfile, vhosts, subs, extraHosts, tryGUIOnFail, smartFetch): | ||
| 180 | + def worker(urlQueue, tout, debug, headless, doProfile, vhosts, subs, extraHosts, tryGUIOnFail, smartFetch,proxy): | ||
| 166 | 181 | if(debug): | |
| 167 | 182 | print '[*] Starting worker' | |
| 168 | 183 | ||
| 169 | 184 | browser = None | |
| 170 | 185 | try: | |
| 171 | - browser = setupBrowserProfile(headless) | ||
| 186 | + browser = setupBrowserProfile(headless,proxy) | ||
| 172 | 187 | ||
| 173 | 188 | except: | |
| 174 | 189 | print "[-] Oh no! Couldn't create the browser, Selenium blew up" | |
@@ -201,9 +216,9 @@ def worker(urlQueue, tout, debug, headless, doProfile, vhosts, subs, extraHosts, | |||
| 201 | 216 | ||
| 202 | 217 | try: | |
| 203 | 218 | if(doProfile): | |
| 204 | - [resp,curUrl] = autodetectRequest(curUrl, timeout=tout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts) | ||
| 219 | + [resp,curUrl] = autodetectRequest(curUrl, timeout=tout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts,proxy=proxy) | ||
| 205 | 220 | else: | |
| 206 | - resp = doGet(curUrl, verify=False, timeout=tout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts) | ||
| 221 | + resp = doGet(curUrl, verify=False, timeout=tout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts,proxy=proxy) | ||
| 207 | 222 | if(resp is not None and resp.status_code == 401): | |
| 208 | 223 | print curUrl[0]+" Requires HTTP Basic Auth" | |
| 209 | 224 | f = open(screenshotName+".html",'w') | |
@@ -299,10 +314,14 @@ def doGet(*args, **kwargs): | |||
| 299 | 314 | urlQueue = kwargs.pop('urlQueue' ,None) | |
| 300 | 315 | subs = kwargs.pop('subs' ,None) | |
| 301 | 316 | extraHosts = kwargs.pop('extraHosts',None) | |
| 317 | + proxy = kwargs.pop('proxy',None) | ||
| 302 | 318 | ||
| 303 | 319 | kwargs['allow_redirects'] = False | |
| 304 | 320 | ||
| 305 | - resp = requests.get(url[0],**kwargs) | ||
| 321 | + session = requests.session() | ||
| 322 | + if(proxy is not None): | ||
| 323 | + session.proxies={'http':'socks5://'+proxy,'https':'socks5://'+proxy} | ||
| 324 | + resp = session.get(url[0],**kwargs) | ||
| 306 | 325 | ||
| 307 | 326 | ||
| 308 | 327 | #If we have an https URL and we are configured to scrape hosts from the cert... | |
@@ -352,7 +371,7 @@ def doGet(*args, **kwargs): | |||
| 352 | 371 | return resp | |
| 353 | 372 | ||
| 354 | 373 | ||
| 355 | - def autodetectRequest(url, timeout, vhosts=False, urlQueue=None, subs=None, extraHosts=None): | ||
| 374 | + def autodetectRequest(url, timeout, vhosts=False, urlQueue=None, subs=None, extraHosts=None,proxy=None): | ||
| 356 | 375 | '''Takes a URL, ignores the scheme. Detect if the host/port is actually an HTTP or HTTPS | |
| 357 | 376 | server''' | |
| 358 | 377 | resp = None | |
@@ -384,7 +403,7 @@ def autodetectRequest(url, timeout, vhosts=False, urlQueue=None, subs=None, extr | |||
| 384 | 403 | url[0] = url[0].replace('https','http') | |
| 385 | 404 | #print 'Changing to HTTP '+url[0] | |
| 386 | 405 | try: | |
| 387 | - resp = doGet(url,verify=False, timeout=timeout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts) | ||
| 406 | + resp = doGet(url,verify=False, timeout=timeout, vhosts=vhosts, urlQueue=urlQueue, subs=subs, extraHosts=extraHosts, proxy=proxy) | ||
| 388 | 407 | except Exception as e: | |
| 389 | 408 | print 'HTTP GET Error: '+str(e) | |
| 390 | 409 | print url[0] | |
@@ -418,6 +437,8 @@ def signal_handler(signal, frame): | |||
| 418 | 437 | parser.add_argument("-r","--retries",type=int,default=0,help='Number of retries if a URL fails or timesout') | |
| 419 | 438 | parser.add_argument("-tG","--trygui",action='store_true',default=False,help='Try to fetch the page with FireFox when headless fails') | |
| 420 | 439 | parser.add_argument("-sF","--smartfetch",action='store_true',default=False,help='Enables smart fetching to reduce network traffic, also increases speed if certain conditions are met.') | |
| 440 | + parser.add_argument("-pX","--proxy",default=None,help='SOCKS5 Proxy in host:port format') | ||
| 441 | + | ||
| 421 | 442 | ||
| 422 | 443 | args = parser.parse_args() | |
| 423 | 444 | ||
@@ -468,7 +489,7 @@ def signal_handler(signal, frame): | |||
| 468 | 489 | hash_basket = {} | |
| 469 | 490 | ||
| 470 | 491 | for i in range(args.workers): | |
| 471 | - p = multiprocessing.Process(target=worker, args=(urlQueue, args.timeout, args.verbose, args.headless, args.autodetect, args.vhosts, subs, hostsDict, args.trygui, args.smartfetch)) | ||
| 492 | + p = multiprocessing.Process(target=worker, args=(urlQueue, args.timeout, args.verbose, args.headless, args.autodetect, args.vhosts, subs, hostsDict, args.trygui, args.smartfetch,args.proxy)) | ||
| 472 | 493 | workers.append(p) | |
| 473 | 494 | p.start() | |
| 474 | 495 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,3 +3,4 @@ requests | |||
| 3 | 3 | selenium | |
| 4 | 4 | beautifulsoup4 | |
| 5 | 5 | pillow | |
| 6 | + requesocks | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments