利用Python编写网站管理入口穷举测试工具
import requests import optparse import sys import os import urllib.parse import time class AdminPanelFinder: def __init__(self) -> None: self.banner() self.target_url = self.get_params()[0] self.word_list = self.get_params()[1] def banner(self): banner = ****************************************************************** ****************************************************************** Admin Panel Finder by Jason Wong V1.0 ****************************************************************** ****************************************************************** print(banner) def get_params(self): parser = optparse.OptionParser('Usage: <Program> -u target_url -w word list') parser.add_option('-u', '--target_url', dest='target_url', type=string, help=Enter target url) parser.add_option('-w','--word_list', dest='word_list', type='string', help='Enter path of word list') options, args = parser.parse_args() if options.target_url is None or options.word_list is None: print(parser.usage) sys.exit() if not os.path.exists(options.word_list): print(The file does not exist) sys.exit() return options.target_url, options.word_list def request_handler(self, url): try: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0' } print(Trying: %s % url) response = requests.get(url=url, headers=headers) if response.status_code == '200': print(The admin panel found: %s % url) except: pass def run(self): try: with open(self.word_list, 'r') as f: for line in f.readlines(): url = urllib.parse.urljoin(self.target_url, line.strip()) self.request_handler(url) time.sleep(2) except KeyboardInterrupt: print(\n Exiting the program) sys.exit() if __name__ == __main__: admin_panel_finder = AdminPanelFinder() admin_panel_finder.run()