Created
September 16, 2021 14:48
-
-
Save JoyGhoshs/1131a230d7ea1a33d1d744174d49180a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
import requests | |
from bs4 import BeautifulSoup as bs | |
from urllib.parse import urljoin | |
def js(domain): | |
session = requests.Session() | |
session.headers["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" | |
html = session.get(domain).content | |
soup = bs(html, "html.parser") | |
script_files = [] | |
for script in soup.find_all("script"): | |
if script.attrs.get("src"): | |
script_url = urljoin(domain, script.attrs.get("src")) | |
script_files.append(script_url) | |
for js_file in script_files: | |
print(js_file) | |
js('https://target.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment