Created
May 16, 2022 21:12
-
-
Save notnci/1bef9cac57a4cbbbca199a959cb5f5e3 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
def scan_endpoints(client, url, endpoints, jsond, df=True): | |
filename = url[url.find("://") + 3:-11] | |
data = [] | |
with open(f"{filename}.txt", "w+") as wf: | |
for item in endpoints: | |
try: | |
r = client.get(f"{url}" + str(item), headers=h) | |
if r.status_code == 200: | |
print(f"[+] Valid page found: {url}{str(item)} [+]") | |
if df: | |
wf.write(f"====={url}{str(item)}======\n") | |
wf.write(f"{r.text}") | |
if jsond: | |
t = r.text.replace(" ", " ") | |
idata = dict(url=f"{url}{str(item)}", data=f"{t}") | |
data.append(idata) | |
else: | |
print(f"{str(item)} not accessible: {r.status_code}") | |
except Exception as e: | |
print(f"Error: {e}") | |
continue | |
return json.dumps(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iykyk