Skip to content

Instantly share code, notes, and snippets.

@kecs
Created November 10, 2019 12:21
Show Gist options
  • Save kecs/06ab57ac6421a3026fb72767fecca247 to your computer and use it in GitHub Desktop.
Save kecs/06ab57ac6421a3026fb72767fecca247 to your computer and use it in GitHub Desktop.
Download list of scripts loaded by site, greppable.
# pip install jsbeautifier requests
import os
import requests
from jsbeautifier import beautify
try:
os.mkdir('js')
except OSError:
pass
print('[*] Saving files in /js/\n[*]Paste list of urls:')
inp = '.'
urls = []
while inp.strip():
inp = input()
urls.append(inp)
for url in urls[:-1]:
resp = requests.get(url)
path = url.split('/')[-1]
with open(f'js/{path}.js', 'w') as f:
f.write(f'// {url}\n')
f.write(beautify(resp.text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment