Incredibly fast crawler designed for OSINT.
Add files via upload
Somdev Sangwanbbc53dd9a2b7
diff --git a/core/flash.py b/core/flash.pyindex 872bbbd..cbaa22c 100644--- a/core/flash.py+++ b/core/flash.py@@ -50,4 +50,4 @@ def flash(function, links, thread_count):if i + 1 == len(links) or (i + 1) % thread_count == 0:print('%s Progress: %i/%i' % (info, i + 1, len(links)),end='\r')- print('')+ print('')\ No newline at end of filediff --git a/core/mirror.py b/core/mirror.pynew file mode 100644index 0000000..f5770ac--- /dev/null+++ b/core/mirror.py@@ -0,0 +1,39 @@+import os+import re++def mirror(url, response):+ if response != 'dummy':+ cleanUrl = url.replace('http://', '').replace('https://', '').rstrip('/')+ parts = cleanUrl.split('?')[0].split('/')+ root = parts[0]+ webpage = parts[-1]+ parts.remove(root)+ try:+ parts.remove(webpage)+ except ValueError:+ pass+ prefix = root + '_mirror'+ try:+ os.mkdir(prefix)+ except OSError:+ pass+ suffix = ''+ if parts:+ for directory in parts:+ suffix += directory + '/'+ try:+ os.mkdir(prefix + '/' + suffix)+ except OSError:+ pass+ path = prefix + '/' + suffix+ trail = ''+ if '.' not in webpage:+ trail += '.html'+ if webpage == root:+ name = 'index.html'+ else:+ name = webpage+ if len(url.split('?')) > 1:+ trail += '?' + url.split('?')[1]+ with open(path + name + trail, 'w+') as out_file:+ out_file.write(response.encode('utf-8'))diff --git a/photon.py b/photon.pyindex 37a5929..935200c 100644--- a/photon.py+++ b/photon.py@@ -16,6 +16,7 @@ import requestsimport core.configfrom core.updater import updaterfrom core.flash import flash+from core.mirror import mirrorfrom core.prompt import promptfrom core.requester import requesterfrom core.config import badTypes, intels@@ -76,6 +77,8 @@ parser.add_argument('--timeout', help='http request timeout', dest='timeout',type=float)# Switches+parser.add_argument('--clone', help='clone the website locally', dest='clone',+ action='store_true')parser.add_argument('--headers', help='add headers', dest='headers',action='store_true')parser.add_argument('--dns', help='enumerate subdomains and DNS data',@@ -109,6 +112,7 @@ else:print('\n' + parser.format_help().lower())quit()+clone = args.cloneheaders = args.headers # prompt for headersverbose = args.verbose # verbose outputdelay = args.delay or 0 # Delay between requests@@ -197,13 +201,15 @@ def js_extractor(response):def extractor(url):"""Extract details from the response body."""- response = requester(url, main_url, delay, cook, headers, timeout, host, user_agents, ninja, failed, processed)+ response = requester(url, main_url, delay, cook, headers, timeout, host, ninja, user_agents, failed, processed)+ if clone:+ mirror(url, response)matches = re.findall(r'<[aA].*(href|HREF)=([^\s>]+)', response)for link in matches:# Remove everything after a "#" to deal with in-page anchorslink = link[1].replace('\'', '').replace('"', '').split('#')[0]# Checks if the URLs should be crawled- if is_link(link):+ if is_link(link, processed, files):if link[:4] == 'http':if link.startswith(main_url):verb('Internal page', link)