一、pythonPython是一种解释型、面向对象、动态数据类型的高级程序设计语言。python 是一门简单易学的语言,并且功能强大也很灵活,在中的应用广泛,让我们一起打造属于自己的二、web服务器的目录探测脚本打造1、在渗透时如果能发现web服务器中的webshell,渗透是不是就可以变的简单一点尼通常情况下御剑深受大家的喜爱,但是今天在测试的时候webshell不知道为什么御剑扫描不到仔细查看是webshell有防爬功能,是检测User-Agent头,如果没有就回返回一个自己定义的404页面 1、先来看看工具效果 2、利用python读取扫描的目录字典 | with open (path, "r" , encoding = 'ISO-8859-1' ) as f: for url in f.readlines(): url_list.append(url.strip()) | 3、利用 python 的 requests 库对web目标服务器进行目录探测 | url_path = queue.get(timeout = 1 ) res = requests.get(new_url, headers = headers, timeout = 5 ) status_code = "[" + str (res.status_code) + "]" if str (res.status_code) ! = "404" : print (get_time(), status_code, new_url) | 4、利用 python 的 threading 库对探测进行线程的设置 | t = threading.Thread(target = Go_scan, args = (url,)) | 5、利用 python 的 argparse 库进行对自己的工具进行封装 | if len (sys.argv) = = 1 : parser = argparse.ArgumentParser( formatter_class = argparse.RawTextHelpFormatter, parser.add_argument( "-u" , "--url" , help = "scan target address" , dest = 'url' ) parser.add_argument( "-t" , "--thread" , help = "Number of threads" , default = "20" , type = int , dest = 'thread' ) parser.add_argument( "-d" , "--Dictionaries" , help = "Dictionary of Blasting Loading" , | 总结各位大哥有意见或者建议尽管提,文章哪里不对的话会改的,小弟定会虚心学习最后附上全部源码供大佬指教 | 'Connection' : 'keep-alive' , 'Accept-Language' : 'zh-CN' , 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.2; rv:16.0) Gecko/20100101 Firefox/16.0' return '[' + time.strftime( "%H:%M:%S" , time.localtime()) + '] ' with open (path, "r" , encoding = 'ISO-8859-1' ) as f: for url in f.readlines(): url_list.append(url.strip()) url_path = queue.get(timeout = 1 ) res = requests.get(new_url, headers = headers, timeout = 5 ) status_code = "[" + str (res.status_code) + "]" if str (res.status_code) ! = "404" : print (get_time(), status_code, new_url) t = threading.Thread(target = Go_scan, args = (url,)) if len (sys.argv) = = 1 : parser = argparse.ArgumentParser( formatter_class = argparse.RawTextHelpFormatter, parser.add_argument( "-u" , "--url" , help = "scan target address" , dest = 'url' ) parser.add_argument( "-t" , "--thread" , help = "Number of threads" , default = "20" , type = int , dest = 'thread' ) parser.add_argument( "-d" , "--Dictionaries" , help = "Dictionary of Blasting Loading" , args = parser.parse_args() url_path = args.Dictionaries print (get_time(), "[INFO] Start scanning----\n" ) if __name__ = = '__main__' : | |