Skip to content

Instantly share code, notes, and snippets.

Last active March 7, 2023 12:41
What would you like to do?
import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = '*.%s/*&output=json&fl=original&collapse=urlkey' % host
url = '*&output=json&fl=original&collapse=urlkey' % host
r = requests.get(url)
results = r.json()
return results[1:]
if __name__ == '__main__':
argc = len(sys.argv)
if argc < 2:
print('Usage:\n\tpython3 <url> <include_subdomains:optional>')
host = sys.argv[1]
with_subs = False
if argc > 3:
with_subs = True
urls = waybackurls(host, with_subs)
json_urls = json.dumps(urls)
if urls:
filename = '%s-waybackurls.json' % host
with open(filename, 'w') as f:
print('[*] Saved results to %s' % filename)
print('[-] Found nothing')
Copy link

albvt commented Dec 25, 2018

bruh how are you

Copy link

sunilb77 commented Sep 6, 2020

how to fix this issue?

kali@kali:~/Desktop/tools/waybackurls$ python3
Traceback (most recent call last):
File "", line 1, in
import requests
ModuleNotFoundError: No module named 'requests'

Copy link

p0lr commented Sep 8, 2020

pip3 install requests

Copy link

rrampage commented Sep 30, 2020

A bash function which uses jq (not for sub-domain search but works for any URL prefix). It gives the full web archive url which is generally of format$TIMESTAMP/$ORIGINAL:

wb () 
    if [[ -z $1 ]]; then
        echo "Usage: $0 URL";
        curl "$1/*&output=json&fl=original,timestamp" 2> /dev/null | jq '.[1:][] |"" +.[1] + "/" + .[0]' 2> /dev/null;

This can be added to the ~/.bashrc or relevant shell profile.

Usage: wb

Copy link

akamhy commented Oct 2, 2020

Just wanted to tell you that I used your Idea in [commit]

Usage :

pip3 install waybackpy
waybackpy --url --user_agent "my-user-agent" --known_urls

6 URLs found and saved in ./


  1. '--alive' will only fetch URLs that are not dead. alive will be slower for websites with too many archived URLs e.g. google
  2. '--subdomain' will include URLs from subdomains.

See live use @

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