Incredibly fast crawler designed for OSINT.
Fix a couple of typos (and some PEP8)
Fabian Affolterd9ed9df08cd7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ae8130..e6063d9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,6 +1,6 @@#### v1.1.4- Added `-v` option-- Fixed progress animation for python2+- Fixed progress animation for Python 2- Added `developer.facebook.com` API for Ninja mode#### v1.1.3@@ -11,19 +11,19 @@#### v1.1.2- Added `--wayback`-- Fixed progress bar for python > 3.2+- Fixed progress bar for Python > 3.2- Added `/core/config.py` for easy customization- `--dns` now saves subdomains in `subdomains.txt`#### v1.1.1-- Use of `ThreadPoolExecutor` for x2 speed (for python > 3.2)+- Use of `ThreadPoolExecutor` for x2 speed (for Python > 3.2)- Fixed mishandling of urls starting with `//`- Removed a redundant try-except statement- Evaluate entropy of found keys to avoid false positives#### v1.1.0- Added `--keys` option-- Fixed a bug related to SSL certifcate verfication+- Fixed a bug related to SSL certificate verification#### v1.0.9- Code refactor@@ -36,7 +36,7 @@- Better regex and code logic to favor performance- Fixed a bug that caused dnsdumpster to fail if target was a subdomain- Fixed a bug that caused a crash if run outside "Photon" directory-- Fixed a bug in file saving (specific to python3)+- Fixed a bug in file saving (specific to Python 3)#### v1.0.7- Added `--timeout` option@@ -44,7 +44,7 @@- Added `--user-agent` option- Replaced lxml with regex- Better logic for favoring performance-- Added bigger and seperate file for user-agents+- Added bigger and separate file for user-agents#### v1.0.6- Fixed lot of bugs@@ -80,8 +80,8 @@- Display total time taken and average time per request#### v1.0.1-- Disabled colors on windows and mac+- Disabled colors on Windows and macOS- Cross platform file handling#### v1.0.0-- First stable release.+- First stable releasediff --git a/README.md b/README.mdindex c7a26b0..75b95c9 100644--- a/README.md+++ b/README.md@@ -50,7 +50,8 @@ Photon can extract the following data while crawling:- Strings matching custom regex pattern- Subdomains & DNS related data-The extracted information is saved in an organized manner or can be [exported as json](https://github.com/s0md3v/Photon/wiki/Usage#export-formatted-result).\+The extracted information is saved in an organized manner or can be [exported as json](https://github.com/s0md3v/Photon/wiki/Usage#export-formatted-result).+#### Flexible@@ -58,9 +59,12 @@ Control timeout, delay, add seeds, exclude URLs matching a regex pattern and othThe extensive range of [options](https://github.com/s0md3v/Photon/wiki/Usage) provided by Photon lets you crawl the web exactly the way you want.#### Genius-Photon's smart thread management & refined logic gives you top notch performance.\-Still, crawling can be resource intensive but Photon has some tricks up it's sleeves. You can fetch URLs archived by [archive.org](https://archive.org/) to be used as seeds by using `--wayback` option.\-In Ninja Mode which can be accessed by `--ninja`, 4 online services are used to make requests to the target on your behalf.\+Photon's smart thread management & refined logic gives you top notch performance.++Still, crawling can be resource intensive but Photon has some tricks up it's sleeves. You can fetch URLs archived by [archive.org](https://archive.org/) to be used as seeds by using `--wayback` option.++In Ninja Mode which can be accessed by `--ninja`, 4 online services are used to make requests to the target on your behalf.+So basically, now you have 4 clients making requests to the same server simultaneously which gives you a speed boost if you have a slow connection, minimizes the risk of connection reset as well as delays requests from a single client.#### Plugins@@ -70,13 +74,15 @@ So basically, now you have 4 clients making requests to the same server simultan#### Docker-Photon can be launched using a lightweight Python-Alpine (103MB) Docker image.+Photon can be launched using a lightweight Python-Alpine (103 MB) Docker image.+```bash$ git clone https://github.com/s0md3v/Photon.git$ cd Photon$ docker build -t photon .$ docker run -it --name photon photon:latest -u google.com```+To view results, you can either head over to the local docker volume, which you can find by running `docker inspect photon` or by mounting the target loot folder:```bashdiff --git a/photon.py b/photon.pyindex 0f218a2..47d85f6 100644--- a/photon.py+++ b/photon.py@@ -3,7 +3,6 @@from __future__ import print_function-# Let's import what we needimport osimport sysimport tld@@ -19,10 +18,10 @@ from requests import get, posttry:import concurrent.futures- from urllib.parse import urlparse # for python3+ from urllib.parse import urlparse # for Python 3python2, python3 = False, Trueexcept ImportError:- from urlparse import urlparse # for python2+ from urlparse import urlparse # for Python 2python2, python3 = True, Falsefrom core.config import intels, badTypes@@ -32,10 +31,10 @@ try:except NameError:pass-colors = True # Output should be colored-machine = sys.platform # Detecting the os of current system+colors = True # Output should be colored+machine = sys.platform # Detecting the OS of current systemif machine.lower().startswith(('os', 'win', 'darwin', 'ios')):- colors = False # Colors shouldn't be displayed in mac & windows+ colors = False # Colors shouldn't be displayed on macOS & Windowsif not colors:end = red = white = green = yellow = run = bad = good = info = que = ''else:@@ -58,7 +57,7 @@ print('''%s ____ __ __/_/ /_/ /_/\____/\__/\____/_/ /_/ %sv1.1.5%s\n''' %(red, white, red, white, red, white, red, white, red, white, red, white, red, white, end))-warnings.filterwarnings('ignore') # Disable SSL related warnings+warnings.filterwarnings('ignore') # Disable SSL related warnings# Processing command line argumentsparser = argparse.ArgumentParser()@@ -88,16 +87,17 @@ parser.add_argument('--only-urls', help='only extract urls', dest='only_urls', aparser.add_argument('--wayback', help='fetch urls from archive.org as seeds', dest='archive', action='store_true')args = parser.parse_args()-####-# This function git clones the latest version and merges it with the current directory-####def update():+ """Update the current installation.++ git clones the latest version and merges it with the current directory.+ """print('%s Checking for updates' % run)- changes = '''--headers option for interactive HTTP header input''' # Changes must be seperated by ;+ changes = '''--headers option for interactive HTTP header input''' # Changes must be seperated by ;latest_commit = get('https://raw.githubusercontent.com/s0md3v/Photon/master/photon.py').text- if changes not in latest_commit: # just a hack to see if a new version is available+ if changes not in latest_commit: # Just a hack to see if a new version is availablechangelog = search(r"changes = '''(.*?)'''", latest_commit)changelog = changelog.group(1).split(';') # splitting the changes to form a listprint('%s A new version of Photon is available.' % good)@@ -118,15 +118,15 @@ def update():else:print('%s Photon is up to date!' % good)-if args.update: # if the user has supplied --update argument+if args.update: # If the user has supplied --update argumentupdate()- quit() # quitting because files have been changed+ quit() # Quitting because files have been changed-if args.root: # if the user has supplied a url+if args.root: # If the user has supplied a urlmain_inp = args.root- if main_inp.endswith('/'): # if the url ends with '/'- main_inp = main_inp[:-1] # we will remove it as it can cause problems later in the code-else: # if the user hasn't supplied a url+ if main_inp.endswith('/'): # If the url ends with '/'+ main_inp = main_inp[:-1] # We will remove it as it can cause problems later in the code+else: # If the user hasn't supplied a urlprint('\n' + parser.format_help().lower())quit()@@ -147,24 +147,21 @@ files = set() # pdf, css, png etc.intel = set() # emails, website accounts, aws buckets etc.robots = set() # entries of robots.txtcustom = set() # string extracted by custom regex pattern-failed = set() # urls that photon failed to crawl+failed = set() # URLs that photon failed to crawlscripts = set() # javascript files-external = set() # urls that don't belong to the target i.e. out-of-scope-fuzzable = set() # urls that have get params in them e.g. example.com/page.php?id=2-endpoints = set() # urls found from javascript files-processed = set() # urls that have been crawled-internal = set([s for s in args.seeds]) # urls that belong to the target i.e. in-scope+external = set() # URLs that don't belong to the target i.e. out-of-scope+fuzzable = set() # URLs that have get params in them e.g. example.com/page.php?id=2+endpoints = set() # URLs found from javascript files+processed = set() # URLs that have been crawled+internal = set([s for s in args.seeds]) # URLs that belong to the target i.e. in-scopeeverything = []-bad_intel = set() # unclean intel urls-bad_scripts = set() # unclean javascript file urls+bad_intel = set() # unclean intel urls+bad_scripts = set() # unclean javascript file urls-####-# This function extracts valid headers from interactive inpu-####-def extractHeaders(headers):+ """This function extracts valid headers from interactive inpu"""sorted_headers = {}matches = findall(r'(.*):\s(.*)', headers)for match in matches: