Skip to content

Instantly share code, notes, and snippets.

@notnci
Created May 16, 2022 21:12
Show Gist options
  • Save notnci/1bef9cac57a4cbbbca199a959cb5f5e3 to your computer and use it in GitHub Desktop.
Save notnci/1bef9cac57a4cbbbca199a959cb5f5e3 to your computer and use it in GitHub Desktop.
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)
@notnci
Copy link
Author

notnci commented May 16, 2022

iykyk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment