Skip to content

Commit

Permalink
added config.py for easy customization
Browse files Browse the repository at this point in the history
  • Loading branch information
s0md3v authored Sep 4, 2018
1 parent b025bc9 commit 4f681d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
intels = ['github.com', 'facebook.com', 'instagram.com', 'youtube.com']
badTypes = ['png', 'jpg', 'jpeg', 'pdf', 'js', 'css', 'ico', 'bmp', 'svg', 'json', 'xml', 'xls', 'csv', 'docx']
8 changes: 5 additions & 3 deletions photon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from urlparse import urlparse # for python2
python2, python3 = True, False

from core.config import intels, badTypes

try:
input = raw_input
except NameError:
Expand Down Expand Up @@ -85,7 +87,7 @@

def update():
print('%s Checking for updates' % run)
changes = '''added --wayback option;--dns now saves subdomains into subdomains.txt''' # Changes must be seperated by ;
changes = '''added --wayback option;--dns now saves subdomains into subdomains.txt;use /core/config.py for customization''' # 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
Expand Down Expand Up @@ -310,7 +312,7 @@ def is_link(url):
conclusion = False # whether the the url should be crawled or not

if url not in processed: # if the url hasn't been crawled already
if '.png' in url or '.jpg' in url or '.jpeg' in url or '.js' in url or '.css' in url or '.pdf' in url or '.ico' in url or '.bmp' in url or '.svg' in url or '.json' in url or '.xml' in url:
if url.split('.')[-1].lower() in badTypes:
files.add(url)
else:
return True # url can be crawled
Expand Down Expand Up @@ -496,7 +498,7 @@ def flash(function, links): # This shit is NOT complicated, please enjoy
intel.add(x)

for url in external:
if 'github.com' in url or 'facebook.com' in url or 'instagram.com' in url or 'youtube.com' in url:
if get_fld(url, fix_protocol=True) in intels:
intel.add(url)

now = time.time() # records the time at which crawling stopped
Expand Down

0 comments on commit 4f681d1

Please sign in to comment.