python写exploit采集器
前言:
根据天文地理与风水学,我掐指一算的看到了一篇不错的文章,文章里面写到整理exploit
我顿时心理想写一个exploit采集器,那么说时迟那时快。就开始写了
代码:
思路:http://expku.com,观察URL的变化
import requests
from bs4 import *
import threading
import re
import optparse urlsd=[]
#neirons=[] def main():
parser=optparse.OptionParser()
parser.add_option('-m',action='store_true',dest='home',help='Save the home directory in the local area')
parser.add_option('-w',action='store_true',dest='web',help='Save all the attack loads of Web')
parser.add_option('-s',dest='search',help='search exploit')
parser.add_option('-y',action='store_true',dest='long',help='Save the Long-range all exploit')
parser.add_option('-b',action='store_true',dest='local',help='Save the local all exploit')
(options,args)=parser.parse_args()
if options.home:
poc()
elif options.web:
web()
elif options.search:
searchs=options.search
searchexploit(searchs)
elif options.long:
logins()
elif options.local:
local()
else:
parser.print_help()
exit()
def poc():
global headers
print('[+]Emptying exploit1.txt')
kw=open('exploitcs1.txt','w')
kw.close()
print('[+]Complete the emptying')
print('[+] Generating a new list of exploit')
url='http://expku.com/'
headers={'user-agetn':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'}
rest=requests.get(url=url,headers=headers)
qinx=rest.content.decode('gbk')
kop=BeautifulSoup(qinx,'html.parser')
for x in kop.find_all('a'):
a=re.findall('<a href=".*?" target="_blank">.*?</a>',str(x))
neiron="".join(a)
nei=BeautifulSoup(neiron,'html.parser') uw=nei.find_all('a')
for u in uw:
u1=u.get('href')
urlsd.append('http://expku.com/'.strip()+u1) urlsd.remove(urlsd[0])
lk=list(set(urlsd))
for m in lk:
rest2=requests.get(url=m,headers=headers)
pl=BeautifulSoup(rest2.content.decode('gbk'),'html.parser')
for l in pl.find_all('h1'):
ks='title:',l.get_text(),'','url:',rest2.url
print(ks)
li='{}'.format(ks)
xr=li.replace('(','').replace(')','').replace(',','').replace("''",'')
pw=open('exploitcs1.txt','a')
pw.write(xr)
pw.write('\n')
pw.close()
def web():
print('[+]empty exploit web.txt')
odw=open('exploitweb.txt','w')
odw.close()
print('[+]empty complete')
print('[+]Start writing to the collected web exploit')
urlsd=[]
headers = {
'user-agetn': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'}
for h in range(88):
url='http://expku.com/web/list_6_{}.html'.format(h)
reques=requests.get(url=url,headers=headers)
kw=BeautifulSoup(reques.content.decode('gbk'),'html.parser')
vb=kw.find_all('a')
for q in vb:
pq=q.get('href')
urls='http://expku.com'.strip()+pq
kq=re.findall('http://expku.com/web/.*.html',urls)
for k in kq:
urlsd.append(k)
kc=list(set(urlsd))
for b in kc:
tfs=requests.get(url=b,headers=headers)
bds=BeautifulSoup(tfs.content.decode('gbk'),'html.parser')
for t in bds.find_all('h1'):
print(t.get_text(), '', tfs.url)
print(t.get_text(),'',tfs.url,file=open('exploitweb.txt','a')) def searchexploit(searchs):
print('[+]search give the result as follows:')
jg=[]
rs=[]
urlsh=[]
headers = {'user-agetn': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'}
urls='http://expku.com/search.php?keyword={}'.format(searchs)
resq=requests.get(url=urls,headers=headers)
weq=BeautifulSoup(resq.content.decode('gbk'),'html.parser')
oeq=weq.find_all('a')
for r in oeq:
ds=r.get('title')
durl=r.get('href')
burw=re.findall('/.*/.*.html',durl)
op="".join(burw)
rs.append(op)
kdw = '{}'.format(ds)
jg.append(kdw.replace('None', ''))
while '' in rs:
rs.remove('')
for g in rs:
uw='http://expku.com'.strip()+g
urlsh.append(uw)
urlsqf='http://expku.com'.strip()+durl while '' in jg:
jg.remove('') for g in range(0,len(urlsh)):
print(jg[g],urlsh[g]) def logins():
print('[+]empty exploitlong.txt')
lwe=open('exploitlong.txt','w')
lwe.close()
print('[+]Get all remote exploit')
urls=[]
zj=[]
headers = {
'user-agetn': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'}
for i in range(75):
url='http://expku.com/remote/list_4_{}.html'.format(i)
regw=requests.get(url=url,headers=headers)
lvq=BeautifulSoup(regw.content.decode('gbk'),'html.parser')
fwq=lvq.find_all('a')
for d in fwq:
eq=d.get('href')
oeq=re.findall('/remote/.*.html',eq)
for b in oeq:
ks='http://expku.com'.strip()+b
urls.append(ks)
qwe=list(set(urls))
for asd in lvq.find_all('a'):
kl=re.findall('<a href=".*" target="_blank">.*</a>',str(asd))
for n in kl:
vk=''.strip()+n
peq=BeautifulSoup(vk,'html.parser')
for t in qwe:
zj.append(peq.get_text()+' '+t)
jb=list(set(zj))
for j in jb:
print(j)
print(j,file=open('exploitlong.txt','a')) def local():
print('[+]empty exploitlocal.txt')
wd=open('exploitlocal.txt','w')
wd.close()
print('[+]get local exploit')
for j in range(56):
uk=[]
url='http://expku.com/local/list_5_{}.html'.format(j)
headers = {
'user-agetn': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'}
rwqe=requests.get(url=url,headers=headers)
vdq=BeautifulSoup(rwqe.content.decode('gbk'),'html.parser')
hk=vdq.find_all('a')
for f in hk:
ddo=f.get('href')
kio=re.findall('/local/.*.html',str(ddo))
for g in kio:
url='http://expku.com'.strip()+g
uk.append(url)
yf=list(set(uk))
for c in yf:
rtq=requests.get(url=c,headers=headers)
vdq=BeautifulSoup(rtq.content.decode('gbk'),'html.parser')
for a in vdq.find_all('h1'):
print(a.get_text(),'',rtq.url)
print(a.get_text(), '', rtq.url,file=open('exploitlocal.txt','a')) #while '' in neirons:
# neirons.remove('') #while ' ' in neirons:
# neirons.remove(' ') #urlsd.remove(urlsd[0])
#rd=list(set(urlsd)) #for q in range(0,len(rd)):
# print(neirons[q],rd[q]) if __name__ == '__main__':
main()
效果:
爬下来的exploit保存:
用于搜索:
Github下载地址:https://github.com/422926799/python/blob/master/exploitsearch.py
python写exploit采集器的更多相关文章
- python写zip破解器
浏览桌面依然平静,!!!!等等..怎么有个压缩包 打开一看!!!156.txt???waht the fuck? 卧槽还有密码!!!!!! 但是我不知道╮(╯▽╰)╭该怎么办呢! 很简单,python ...
- 自己写的一个简单PHP采集器
自己写的一个简单PHP采集器 <?php //**************************************************************** $url = &q ...
- 写python中的装饰器
python中的装饰器主要用于在已有函数实现功能前附加需要输出的信息,下面将用实例展示我如何写装饰器. 首先分别尝试写装饰器装饰一个无参函数和一个有参函数(被装饰函数仅输出,无返回值情况下) def ...
- 面向切面编程AOP——加锁、cache、logging、trace、同步等这些较通用的操作,如果都写一个类,则每个用到这些功能的类使用多继承非常难看,AOP就是解决这个问题的,python AOP就是装饰器
面向切面编程(AOP)是一种编程思想,与OOP并不矛盾,只是它们的关注点相同.面向对象的目的在于抽象和管理,而面向切面的目的在于解耦和复用. 举两个大家都接触过的AOP的例子: 1)java中myba ...
- WEB页面采集器编写经验之一:静态页面采集器
严格意义来说,采集器和爬虫不是一回事:采集器是对特定结构的数据来源进行解析.结构化,将所需的数据从中提取出来:而爬虫的主要目标更多的是页面里的链接和页面的TITLE. 采集器也写过不少了,随便写一点经 ...
- python写的一个集合
起因:原本打算用python写一个抢火车票的脚本.在那 期间遇见各种浏览器驱动失败的节奏....打算先缓一下 然后就去写集合了. 0x01 源码: # -*- coding:'utf-8' -*- # ...
- prometheus学习系列十一: Prometheus 采集器的编写
在前面的文章已经写了官方的几个exporter的使用了. 在实际使用环境中,我们可能需要收集一些自定义的数据, 这个时候我们一般是需要自己编写采集器的. 快速入门编写一个入门的demo 编写代码 fr ...
- 【PyHacker编写指南】打造URL批量采集器
这节课是巡安似海PyHacker编写指南的<打造URL批量采集器> 喜欢用Python写脚本的小伙伴可以跟着一起写一写呀. 编写环境:Python2.x 00x1: 需要用到的模块如下: ...
- python高级之装饰器
python高级之装饰器 本节内容 高阶函数 嵌套函数及闭包 装饰器 装饰器带参数 装饰器的嵌套 functools.wraps模块 递归函数被装饰 1.高阶函数 高阶函数的定义: 满足下面两个条件之 ...
随机推荐
- Java网络编程学习A轮_06_NIO入门
参考资料: 老外写的教程,很适合入门:http://tutorials.jenkov.com/java-nio/index.html 上面教程的译文:http://ifeve.com/overview ...
- Vue.js系列之项目搭建(1)
项目搭建具体步骤如下: 1.安装node 到官网下载安装,我这里是win7系统. (中)https://nodejs.org/zh-cn/ (英)https://nodejs.org/en/ 2.安装 ...
- Tensorflow学习笔记二
现在来开始安装Tensorflow吧 Tensorflow有两种模式, 一种GPU支持, 另外一种仅CPU支持 虚拟机仅有CPU支持, 那就第一种模式吧 有4种途径去安装 virtualenv &qu ...
- 获取div的高度
1.获取div的文档总高度(必须DOM操作): var scrollHeight=document.getElementById("inner").scrollHeight; // ...
- EPANET头文件解读系列4——EPANET2.H
该头文件的功能与系列3中的TOOLKIT.H类似,而且内容也几乎一致,所以也就不再详细介绍.
- docker的搭建和简单应用
dockerserver端安装 先下载docker的yum源 wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ...
- 如何处理HTML5新标签的兼容性问题
支持HTML5新标签: * IE8/IE7/IE6支持通过document.createElement方法产生的标签, 可以利用这一特性让这些浏览器支持HTML5新标签, 浏览器支持新标签后,还需要添 ...
- 深度学习(七十一)darknet 源码阅读
深度学习(七十一)darknet 源码阅读
- Mac安装并破解OmniGraffle7
这个实际上不算破解,只是找到了可用的序列号 1.下载地址 https://www.omnigroup.com/omnigraffle 2.激活方法 Omnigraffle Pro 7注册码/许可证 名 ...
- lmdb数据格式
http://deepdish.io/2015/04/28/creating-lmdb-in-python/ https://lmdb.readthedocs.org/en/release/ http ...