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)
else:
storage.add(main_url + '/' + link)
for x in range(level):
urls = storage - processed # urls to crawl = all urls - urls that have been crawled
# for url in urls:
# rec(url)
threadpool = concurrent.futures.ThreadPoolExecutor(
max_workers=threadCount)
futures = (threadpool.submit(rec, url) for url in urls)
for i in concurrent.futures.as_completed(futures):
pass
try:
for x in range(level):
urls = storage - processed # urls to crawl = all urls - urls that have been crawled
# for url in urls:
# rec(url)
threadpool = concurrent.futures.ThreadPoolExecutor(
max_workers=threadCount)
futures = (threadpool.submit(rec, url) for url in urls)
for i in concurrent.futures.as_completed(futures):
pass
except KeyboardInterrupt:
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('Scanning will continue after 2 minutes')
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)
occurences = htmlParser(response, encoding)
positions = occurences.keys()
efficiencies = filterChecker(
occurences = filterChecker(
url, paramsCopy, headers, GET, delay, occurences, timeout, encoding)
vectors = generator(occurences, response.text)
if vectors: