Skip to content

Commit

Permalink
Merge pull request #48 from gingeleski/fix_hitlist
Browse files Browse the repository at this point in the history
Patch the issue with hitlist #39
  • Loading branch information
gingeleski authored Mar 21, 2019
2 parents 4648b15 + a0ce873 commit e7a3736
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions conspiracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
inscope_urls = {} # (sub)domains in scope
hitlist = [] # optional individual urls to specially hit
requested_items = {} # keeps track of every unique request
output = '' # what we print out to the user at the end

logging.basicConfig(level=logging.INFO, format='%(asctime)s [%(levelname)s] %(message)s', \
handlers=[ logging.FileHandler('conspiracy_' + str(int(time.time())) + '.log'),\
Expand All @@ -70,6 +69,7 @@ def derive_root_url(text_line):
return o.netloc

def add_to_inscope_urls(target):
global inscope_urls
inscope_urls[target] = True

def get_validated_hitlist_line(line):
Expand All @@ -86,6 +86,7 @@ def get_validated_hitlist_line(line):
return validated_line

def check_if_proxy_up(proxy_addr):
global logger
try:
proxy_handler = urllib.request.ProxyHandler({ 'http' : proxy_addr, 'https' : proxy_addr })
opener = urllib.request.build_opener(proxy_handler)
Expand All @@ -97,9 +98,13 @@ def check_if_proxy_up(proxy_addr):
if e.getcode() >= 400 and e.getcode() <= 500:
return True
return False
except ConnectionRefusedError as e:
return False
except Exception as e:
logger.warning('Encountered unknown exception while checking if proxy ' + proxy_addr + ' is up')
logger.warning('Assuming proxy is *not* available as a result')
# If whatever this exception is does not stem from connection, call it "unknown"
if 'No connection could be made' not in str(e):
logger.warning('Encountered unknown exception while checking if proxy ' + proxy_addr + ' is up')
logger.warning('Assuming proxy is *not* available as a result')
return False
return True

Expand All @@ -112,6 +117,7 @@ def console_progress_bar(count, total):
sys.stdout.flush()

def multi_line_info_log(message):
global logger
split_lines = message.split('\n')
for line in split_lines:
logger.info(line)
Expand All @@ -135,6 +141,7 @@ async def run_processing_on_hitlist(use_burp_suite_proxy):
Params:
use_burp_suite_proxy (bool)
"""
global hitlist, logger
# We're going to request stuff with headless Chrome, proxied through Burp Suite
browser = await get_browser(use_burp_suite_proxy)
# Then for each item (URL) ...
Expand All @@ -159,6 +166,7 @@ async def run_processing_on_hitlist(use_burp_suite_proxy):
#######################################################################################################################

def main():
global hitlist, inscope_urls, logger, requested_items
# Instantiate the argument parser
parser = argparse.ArgumentParser(description=DESCRIPTION_STR)
# Declaring all our acceptable arguments below...
Expand Down Expand Up @@ -208,7 +216,8 @@ def main():
# If we have a hitlist then...
if len(hitlist) > 0:
logger.info('Checking if Burp Suite proxy ' + BURP_SUITE_PROXY + ' is running...')
burp_proxy_is_up = check_if_proxy_up(BURP_SUITE_PROXY)
#burp_proxy_is_up = check_if_proxy_up(BURP_SUITE_PROXY)
burp_proxy_is_up = False
if burp_proxy_is_up:
logger.info('Burp Suite proxy appears to be running, will use this for headless Chrome')
else: # Burp Suite proxy is down
Expand Down

0 comments on commit e7a3736

Please sign in to comment.