From 37044e57743344b1ea6cd8af2cbd15a043067b93 Mon Sep 17 00:00:00 2001 From: TrustedSec Date: Sun, 26 Jun 2016 20:23:58 -0400 Subject: [PATCH] add a munch better handler for wget_deep --- src/core/config.baseline | 2 +- src/core/update_config.py | 7 +++++-- src/webattack/web_clone/cloner.py | 13 ++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/config.baseline b/src/core/config.baseline index 5e9857126..489e077e7 100644 --- a/src/core/config.baseline +++ b/src/core/config.baseline @@ -260,6 +260,6 @@ DNS_SERVER=OFF BLEEDING_EDGE=OFF # ### This will download 1 deep the website with WGET instead of the standard. This may give better results but takes longer -WGET_DEEP=ON +WGET_DEEP=OFF ####################################################################################################################################### diff --git a/src/core/update_config.py b/src/core/update_config.py index de15a375b..7b3496b9d 100644 --- a/src/core/update_config.py +++ b/src/core/update_config.py @@ -84,7 +84,8 @@ def value_type(value): 'METASPLOIT_MODE': False, 'HARVESTER_LOG': True, 'STAGE_ENCODING': False, - 'TRACK_EMAIL_ADDRESSES': False + 'TRACK_EMAIL_ADDRESSES': False, + 'WGET_DEEP': True }.get(value, "ERROR") @@ -111,7 +112,8 @@ def update_config(): ####################################################################### CONFIG_DATE='""" + timestamp + """'\n""") for line in init_file: - if not line.startswith("#"): + try: + if not line.startswith("#"): line = line.rstrip() line = line.split("=") setting = line[0] @@ -129,6 +131,7 @@ CONFIG_DATE='""" + timestamp + """'\n""") new_config.write(setting + '="' + value + '"\n') else: new_config.write(setting + '=' + value + '\n') + except: pass init_file.close() new_config.close() diff --git a/src/webattack/web_clone/cloner.py b/src/webattack/web_clone/cloner.py index fac14f0cf..b06122600 100644 --- a/src/webattack/web_clone/cloner.py +++ b/src/webattack/web_clone/cloner.py @@ -135,12 +135,14 @@ try: # wget is called, but output is sent to devnull to hide "wget: # missing URL" error DNULL = open(os.devnull, 'w') - wget = subprocess.call( - 'wget', shell=True, stdout=DNULL, stderr=subprocess.STDOUT) + wget = subprocess.call('wget', shell=True, stdout=DNULL, stderr=subprocess.STDOUT) if wget == 1: - subprocess.Popen('%s;cd %s/web_clone/;wget --no-check-certificate -O index.html -c -k -U "%s" "%s";' % ( - proxy_config, setdir, user_agent, url), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait() + print "WE BE CLONIN" + if check_config("WGET_DEEP").lower() == "on": + subprocess.Popen('%s;wget -H -N -k -p -l 2 -nd -P %s/web_clone/ --no-check-certificate -U "%s" "%s";' % (proxy_config, setdir, user_agent, url), shell=True).wait() + else: + subprocess.Popen('%s;cd %s/web_clone/;wget --no-check-certificate -O index.html -c -k -U "%s" "%s";' % (proxy_config, setdir, user_agent, url), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait() else: # if we don't have wget installed we will use python to rip, @@ -162,7 +164,8 @@ try: filewrite.close() # if it failed ;( - except: + except Exception as e: + print e pass # If the website did not clone properly, exit out.