前言:

根据天文地理与风水学,我掐指一算的看到了一篇不错的文章,文章里面写到整理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. 农历03__ZC

    代码,改自 农历01(http://www.cnblogs.com/cppskill/p/5930558.html) 1.main.cpp #include "Lunar_ZC.h" ...

  2. 无线基站侧的信令风暴根因——频繁的释放和连接RRC产生大量信令、设备移动导致小区重选信令增加、寻呼信令多

    全局思维(核心网和无线基站侧都会有信令风暴): LTE网络系统可能出现信令风暴的原因,大致可以总结出以下几点: 1.网络架构的变化,导致4G核心网信令流量较2G/3G大幅增加 a)架构扁平化:LTE网 ...

  3. web——自己实现一个淘宝购物车页面

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

  4. T4 模板代码生成

    <# //********************************************************* // // Copyright (c) Microsoft. All ...

  5. Linux安装配置Nginx

    之所以搭建Nginx,是因为要做一个图片服务器,之前已经搭建好了Ftp,要想实现通过网页的src标签显示图片需要,搭建web服务器(虽然也可以通过在img标签中的src属性里面写“ ftp://用户名 ...

  6. 《转》深入理解Activity启动流程(四)–Activity Task的调度算法

    本文原创作者:Cloud Chou. 出处:本文链接 本系列博客将详细阐述Activity的启动流程,这些博客基于Cm 10.1源码研究. 深入理解Activity启动流程(一)--Activity启 ...

  7. iOS-----MFMessageCompose 和 MFMailComposeViewController的使用方法

    MFMessageCompose 和 MFMailComposeViewController的使用方法 使用MFMessageComposeViewCOntroller发短信 应用想自己提供界面让用户 ...

  8. Windows 下的高 DPI 应用开发(UWP / WPF / Windows Forms / Win32)

    本文将介绍 Windows 系统中高 DPI 开发的基础知识.由于涉及到坐标转换,这种转换经常发生在计算的不知不觉中:所以无论你使用哪种 Windows 下的 UI 框架进行开发,你都需要了解这些内容 ...

  9. 《DSP using MATLAB》Problem 2.15

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  10. mac终端下修改MySQL的编码格式--找不到my-default.cnf及my.cnf

    首先请确认正确安装好MySQL. 1- 先配置环境变量path 1.1 打开终端,输入: cd ~ 会进入~文件夹, 1.2 然后输入:touch .bash_profile 回车执行后, 1.3 再 ...