handle keyboard interrupt + connection errors

This commit is contained in:
s0md3v
2022-03-20 15:38:34 +05:30
parent c8fc470073
commit 36b2ae4466
3 changed files with 14 additions and 10 deletions

View File

@@ -67,13 +67,16 @@ def photon(seedUrl, headers, level, threadCount, delay, timeout, skipDOM):
storage.add(main_url + link) storage.add(main_url + link)
else: else:
storage.add(main_url + '/' + link) storage.add(main_url + '/' + link)
for x in range(level): try:
urls = storage - processed # urls to crawl = all urls - urls that have been crawled for x in range(level):
# for url in urls: urls = storage - processed # urls to crawl = all urls - urls that have been crawled
# rec(url) # for url in urls:
threadpool = concurrent.futures.ThreadPoolExecutor( # rec(url)
max_workers=threadCount) threadpool = concurrent.futures.ThreadPoolExecutor(
futures = (threadpool.submit(rec, url) for url in urls) max_workers=threadCount)
for i in concurrent.futures.as_completed(futures): futures = (threadpool.submit(rec, url) for url in urls)
pass for i in concurrent.futures.as_completed(futures):
pass
except KeyboardInterrupt:
return [forms, processed]
return [forms, processed] return [forms, processed]

View File

@@ -51,3 +51,4 @@ def requester(url, data, headers, GET, delay, timeout):
logger.error('Error Connecting to Host') logger.error('Error Connecting to Host')
logger.error('Scanning will continue after 2 minutes') logger.error('Scanning will continue after 2 minutes')
time.sleep(120) time.sleep(120)
return requests.Response()

View File

@@ -43,7 +43,7 @@ def crawl(scheme, host, main_url, form, blindXSS, blindPayload, headers, delay,
url, paramsCopy, headers, GET, delay, timeout) url, paramsCopy, headers, GET, delay, timeout)
occurences = htmlParser(response, encoding) occurences = htmlParser(response, encoding)
positions = occurences.keys() positions = occurences.keys()
efficiencies = filterChecker( occurences = filterChecker(
url, paramsCopy, headers, GET, delay, occurences, timeout, encoding) url, paramsCopy, headers, GET, delay, occurences, timeout, encoding)
vectors = generator(occurences, response.text) vectors = generator(occurences, response.text)
if vectors: if vectors: