Skip to content

Instantly share code, notes, and snippets.

@richardevcom
Last active January 27, 2020 08:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardevcom/efd6a6b3b292765855b91847f53cd14c to your computer and use it in GitHub Desktop.
Save richardevcom/efd6a6b3b292765855b91847f53cd14c to your computer and use it in GitHub Desktop.
Find Prestashop, WordPress or other CMS admin control panel URL with Python
import itertools
import string
import urllib2
def guess_admin_url(url, prefix):
adminurl = url + prefix
chars = string.ascii_lowercase + string.digits
attempts = 0
for password_length in range(1, 9):
for guess in itertools.product(chars, repeat=password_length):
attempts += 1
guess = ''.join(guess)
try:
print('Trying: %s%s/' % (adminurl,guess))
ret = urllib2.urlopen('%s%s/' % (adminurl,guess))
if ret.code == 200:
print("Admin url: %s%s/" % (adminurl,guess))
text_file = open("adminurl.txt", "w")
text_file.write("Admin url: %s%s/" % (adminurl,guess))
text_file.close()
# return True - use return if searching with no prefix (other urls will triger True result)
except:
pass
guess_admin_url("https://example.com/", "admin")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment