Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # Admin page finder v0.1
- import requests
- import os
- # To be expanded upon
- builtinWordList = ['admin/', 'admin.php', 'admin/index.php', 'admin/admin.php', 'admin/login.php',
- 'administrator/', 'administrator.php', 'moderator/', 'moderator.php', 'webadmin/',
- 'webadmin.php', 'webadmin/login.php', 'webadmin/webadmin.php', 'webadmin/index.php']
- def topMenu():
- while True:
- print('Enter your selection:\n')
- print('(1) Use built in file/folder list')
- print('(2) Use custom wordlist \n')
- userChoice = input('$ ')
- if userChoice == '1':
- bruteScan(builtinWordList)
- break
- elif userChoice == '2':
- bruteScan(getTargetFile())
- break
- def getTargetFile():
- validExtension = ['.txt']
- while True:
- filePath = input('Enter the full path to the word list: ')
- if os.path.isfile(filePath) and os.path.splitext(filePath)[1] in validExtension:
- return open(filePath).read().split()
- HTTPstatuscodes = { 401: 'Authorisation required', 404: 'Not found', 200: 'OK', 201: 'Created',
- 202: 'Accepted', 203: 'Request fulfilled from cache' }
- def bruteScan(wordList):
- results = {}
- # Need to do some URL sanity checking here
- target = input('Enter the target: ')
- print('\nScanning...\n')
- # Dir scanning code starts here
- for i in wordList:
- # Construct the URL
- targetURL = target + '/' + i
- # Using requests module
- req = requests.head(targetURL)
- statusCode, statusText = req.status_code, HTTPstatuscodes.get(req.status_code, 'Unknown')
- # Status codes we want to print to screen go here
- if statusCode in (200, 401):
- print('Found:', statusCode, '-', statusText, '|', 'URL:', targetURL)
- # Appends all results to 'results' dictionary
- results[targetURL] = statusCode, statusText
- print(results)
- topMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement