前言:

根据天文地理与风水学,我掐指一算的看到了一篇不错的文章,文章里面写到整理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采集器的更多相关文章

  1. python写zip破解器

    浏览桌面依然平静,!!!!等等..怎么有个压缩包 打开一看!!!156.txt???waht the fuck? 卧槽还有密码!!!!!! 但是我不知道╮(╯▽╰)╭该怎么办呢! 很简单,python ...

  2. 自己写的一个简单PHP采集器

    自己写的一个简单PHP采集器 <?php //**************************************************************** $url = &q ...

  3. 写python中的装饰器

    python中的装饰器主要用于在已有函数实现功能前附加需要输出的信息,下面将用实例展示我如何写装饰器. 首先分别尝试写装饰器装饰一个无参函数和一个有参函数(被装饰函数仅输出,无返回值情况下) def ...

  4. 面向切面编程AOP——加锁、cache、logging、trace、同步等这些较通用的操作,如果都写一个类,则每个用到这些功能的类使用多继承非常难看,AOP就是解决这个问题的,python AOP就是装饰器

    面向切面编程(AOP)是一种编程思想,与OOP并不矛盾,只是它们的关注点相同.面向对象的目的在于抽象和管理,而面向切面的目的在于解耦和复用. 举两个大家都接触过的AOP的例子: 1)java中myba ...

  5. WEB页面采集器编写经验之一:静态页面采集器

    严格意义来说,采集器和爬虫不是一回事:采集器是对特定结构的数据来源进行解析.结构化,将所需的数据从中提取出来:而爬虫的主要目标更多的是页面里的链接和页面的TITLE. 采集器也写过不少了,随便写一点经 ...

  6. python写的一个集合

    起因:原本打算用python写一个抢火车票的脚本.在那 期间遇见各种浏览器驱动失败的节奏....打算先缓一下 然后就去写集合了. 0x01 源码: # -*- coding:'utf-8' -*- # ...

  7. prometheus学习系列十一: Prometheus 采集器的编写

    在前面的文章已经写了官方的几个exporter的使用了. 在实际使用环境中,我们可能需要收集一些自定义的数据, 这个时候我们一般是需要自己编写采集器的. 快速入门编写一个入门的demo 编写代码 fr ...

  8. 【PyHacker编写指南】打造URL批量采集器

    这节课是巡安似海PyHacker编写指南的<打造URL批量采集器> 喜欢用Python写脚本的小伙伴可以跟着一起写一写呀. 编写环境:Python2.x 00x1: 需要用到的模块如下: ...

  9. python高级之装饰器

    python高级之装饰器 本节内容 高阶函数 嵌套函数及闭包 装饰器 装饰器带参数 装饰器的嵌套 functools.wraps模块 递归函数被装饰 1.高阶函数 高阶函数的定义: 满足下面两个条件之 ...

随机推荐

  1. Java回顾之序列化

    在这篇文章里,我们关注对象序列化. 首先,我们来讨论一下什么是序列化以及序列化的原理:然后给出一个简单的示例来演示序列化和反序列化:有时有些信息是不应该被序列化的,我们应该如何控制:我们如何去自定义序 ...

  2. 浅谈Android Studio3.0更新之路(遇坑必入)

    >可以参考官网设置-> 1 2 >> Fantasy_Lin_网友评论原文地址是:简书24K纯帅豆写的我也更新一下出处[删除]Fa 转自脚本之家 浅谈Android Studi ...

  3. Android 之WebView实现下拉刷新和其他相关刷新功能

    最近项目中需要用到WebView下拉刷新的功能,经过查找资料终于完成了此功能,现在拿出来和大家分享一下.希望对大家有所帮助. 效果如下图:   代码: activity.xml <?xml ve ...

  4. UVALive-2966 King's Quest(强连通+二分图匹配)

    题目大意:有n个男孩和和n个女孩,已只每个男孩喜欢的女孩.一个男孩只能娶一个女孩.一个女孩只能嫁一个男孩并且男孩只娶自己喜欢的女孩,现在已知一种他们的结婚方案,现在要求找出每个男孩可以娶的女孩(娶完之 ...

  5. hadoop安装及注意事项

    一.hadoop安装及注意事项1.安装hadoop的环境,必须在你的系统中有java的环境.2.必须安装ssh,有的系统默认就安装,如果没有安装需要手动安装.    可以用yum install -y ...

  6. LINUX读写文件

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  7. Mysql04

    mysql: dbs 数据库系统 bdms 数据库管理系统 bda 数据库管理员 db 数据库 dba通过dbms来操作db! 关系型数据库和非关系型数据库 登录mysql mysql -h主机地址 ...

  8. 201621123005《Java程序设计》第十次实验总结

    201621123005<Java程序设计>第十周学习总结 1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常相关内容. 2. 书面作业 1. 常用异常 1.1 自己 ...

  9. L205 EE

    As an Electrical Engineer at P, you will: Design, build, and verify PCBAsCreate, modify, and update ...

  10. ubuntu:在ubuntu上安装vmware12

    在ubuntu上安装vmware12 下载vmware12 https://pan.baidu.com/s/1i5BQEmL  官方的 密匙    5A02H-AU243-TZJ49-GTC7K-3C ...