爬取joomla漏洞库中存在利用代码的链接
2016-03-20 15:55
357 查看
#! /usr/bin/env python # -*- coding:utf-8 -*- # __ author__ == "tyomcat" import re import urllib2 def getContent(url): headers={"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"} try: request=urllib2.Request(url,headers=headers) html=urllib2.urlopen(request) content=html.read().decode("utf-8") return content except urllib2.URLError,e: if hasattr(e,"code"): print e.code if hasattr(e,"reason"): print e.reason def joomla_exploit(content): pattern=re.compile(r'<tr><td>(\d{4}-\d{2}-\d{2})</td><td><a.*?href="(.*?)">(.*?)</a></td>',re.S) items = re.findall(pattern,content) for item in items: return item[1] if __name__ == '__main__': url='http://www.joomlaexploit.com/' data=getContent(url) pocUrl=joomla_exploit(data) poc_content = getContent(pocUrl) pattern=re.compile(r'<tr><td>(\d{4}-\d{2}-\d{2})</td><td><a.*?href="(.*?)">(.*?)</a></td>',re.S) files= re.findall(pattern,poc_content) if files == []: print '利用该漏洞的poc不存在!' else: for file in files: print file[0],file[1],file[2] print "\n"
相关文章推荐
- 猎豹MFC--书籍推荐:基于对话框的MFC应用程序《VisualC++实例精通》单文档多文档多顶级文档《MFCWindows程序设计》
- 以文件为单位的分句、分词python封装脚本
- [分拣思想]——对象计数
- 20145236 冯佳 《Java程序设计》第3周学习总结
- C#-WinForm中文本框的中文乱码问题
- Java自动装箱和拆箱定义
- 解决OS X下Pycharm无法识别Python第三方库的问题
- struts2中的constant配置
- 关于 Java 中 正则表达式的 MULTILINE 标志
- Spark读取Hbase中的数据
- JAVA多线程之(CountDownLatch)
- Qt Model/View Drag and Drop
- S2深入.NET编程总结
- MFC第1天--跟踪代码要抓重点--切记切记--侯杰复习C++ 2对象切割与虚函数P68
- Python Challenge 10
- JS基本类型与Java的区别复习
- MFC第1天--跟踪代码要抓重点--切记切记--侯杰复习C++
- C++中的重载函数、重载函数匹配与实参转换
- C++思维导视
- Leetcode: 125. Valid Palindrome(JAVA)