Skip to content

Instantly share code, notes, and snippets.

@Ge0rg3
Last active June 12, 2020 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ge0rg3/1bd8c5dfa4d7f8defca5050f317d9c02 to your computer and use it in GitHub Desktop.
Save Ge0rg3/1bd8c5dfa4d7f8defca5050f317d9c02 to your computer and use it in GitHub Desktop.
Same algorithm as Sandcastle (https://github.com/0xSearches/sandcastle), but less clunky (and with annoying status messages). Also keeps flushing messages.
#!/usr/bin/env python3
import requests as rq
import sys
if len(sys.argv) < 3:
print("Usage: python sandcastle.py companyname wordlist.txt", flush=True)
exit()
company = sys.argv[1]
wordlist_dir = sys.argv[2]
with open(wordlist_dir, 'r') as f:
wordlist = f.read().split("\n")
print(f"Attempting {len(wordlist)} combinations.", flush=True)
for index, attempt in enumerate(wordlist):
r = rq.head(f"http://{company}{attempt}.s3.amazonaws.com")
if r.status_code != 404:
print(f"success: {company}{attempt} ({r.status_code})", flush=True)
elif index % 25 == 0:
print(f"status: {index}", flush=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment