Last active
January 27, 2020 08:19
-
-
Save richardevcom/efd6a6b3b292765855b91847f53cd14c to your computer and use it in GitHub Desktop.
Find Prestashop, WordPress or other CMS admin control panel URL with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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