前言:

根据天文地理与风水学,我掐指一算的看到了一篇不错的文章,文章里面写到整理exploit

我顿时心理想写一个exploit采集器,那么说时迟那时快。就开始写了

代码:

思路:http://expku.com,观察URL的变化

import requests
from bs4 import *
import threading
import re
import optparseurlsd=[]
#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.searchsearchexploit(searchs)elif options.long:logins()elif options.local:local()else:parser.print_help()exit()
def poc():global headersprint('[+]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.urlprint(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()+pqkq=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()+gurlsh.append(uw)urlsqf='http://expku.com'.strip()+durlwhile '' 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()+burls.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()+npeq=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()+guk.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

转载于:https://www.cnblogs.com/haq5201314/p/9249881.html

python写exploit采集器相关推荐

  1. 【kimol君的无聊小发明】—用python写论文下载器

    [kimol君的无聊小发明]-用python写论文下载器 前言 一.代码分析 1. 搜索论文 2. 下载论文 二.完整代码 写在最后 前言 某个夜深人静的夜晚,夜微凉风微扬,月光照进我的书房~ 当我打 ...

  2. 【kimol君的无聊小发明】—用python写论文下载器(图形化界面)

    [kimol君的无聊小发明]-用python写论文下载器(图形化界面) 前言 一.使用说明 二.代码分析 1. 功能函数 2. 回调函数 3. 线程生成函数 4. 效果展示 写在最后 前言 某个夜深人 ...

  3. 【kimol君的无聊小发明】—用python写图片下载器

    [kimol君的无聊小发明]-用python写图片下载器 前言 一.单线程版 二.多线程版 写在最后 Tip:本文仅供学习与参考,且勿用作不法用途~ 前言 某个夜深人静的夜晚,我打开了自己的文件夹,发 ...

  4. 【kimol君的无聊小发明】—用python写视频下载器

    [kimol君的无聊小发明]-用python写视频下载器 前言 一.爬虫分析 1.视频搜索 2.视频下载 二.我的代码 写在最后 Tip:本文仅供学习与参考,且勿用作不法用途~ 前言 某个夜深人静的夜 ...

  5. python从零写一个采集器:获取网页信息

    博客链接 https://uublog.com/article/20170216/python-extarct-html-info/ 前言 获取内容,比较纠结是用BeautifulSoup还是直接用正 ...

  6. python写音乐播放器_AJ Kipper:用Python写一个简易的MP3播放器

    用Python写一个简易的MP3播放器 前言 最近在学习Web.py框架的时候,了解了基本的Python连接数据库(MySQL)的方法.学完后,总想用它来干点啥,于是,就想能不能写一个MP3播放器.一 ...

  7. python多线程url采集器 + github_利用Python3.5多线程抓取妹子图

    很久之前就写了这个爬妹子图的Python爬虫,并且开源到Github上,然而居然没有人给小心心,虽然现在失效了,妹子图网站开启了反爬虫机制,但还是可以作为大家学习的样例,注释也很清晰. 0x01 起因 ...

  8. python写一个文件下载器_python使用tcp实现一个简单的下载器

    上一篇中介绍了tcp的流程,本篇通过写一个简单的文件下载器程序来巩固之前学的知识. 文件下载器的流程如下: 客户端: 输入目标服务器的ip和port 输入要下载文件的名称 从服务器下载文件保存到本地 ...

  9. python写小说阅读器_用python实现自己的小说阅读器!

    前一段时间书荒的时候,在喜马拉雅APP发现一个主播播讲的小说-大王饶命.听起来感觉很好笑,挺有意思的,但是只有前200张是免费的,后面就要收费.一章两毛钱,本来是想要买一下,发现说的进度比较慢而且整本 ...

最新文章

  1. 腾讯林衍凯:图神经网络,考虑「拓扑信息」会怎样?
  2. mysql数据库使用
  3. Haskell / GHC中的“ forall”关键字有什么作用?
  4. 互联网协议 — IPSec 安全隧道协议
  5. Android开发常用开源框架3
  6. (转)JAVA AJAX教程第三章—AJAX详细讲解
  7. cometd_CometD:Java Web应用程序的Facebook类似聊天
  8. [js] 使用delete删除数组,其长度会改变吗
  9. 8个成语接龙首尾相连_成语接龙(至少8个)
  10. Mybatisの常见面试题
  11. Vijos1775 CodeVS1174 NOIP2009 靶形数独
  12. 或为红米8A 卢伟冰确认将推出5000mAh新机
  13. Embedding 技术在推荐系统中的应用实践
  14. 平衡二叉树的旋转_平衡二叉树的旋转
  15. python django 优势_为什么选择Django?
  16. AI 高等数学、概率论基础
  17. CreateFeatureClass 异常,尝试读取或写入受保护的内存 Access
  18. 相机的对焦是什么意思?为什么需要对焦?
  19. uboot引导kernel - 4 -gd bd详解
  20. deepin-wine的安装

热门文章

  1. 未来两年我们即将要读的Python书!
  2. 四个程序员恋爱必学的聊天知识点!
  3. Java对象的四种引用
  4. 走进PV,UV,IP,session
  5. adb过滤只查看某一个app的日志
  6. 使用flash在IPAD2上播放FLV效率不高
  7. 程序员打字练习_程序员必须来看的面试圣经!!
  8. linux下iptables的编译及简单使用
  9. 点击图片旋转180_一起来点亮斗门!请你旋转手机屏幕90横屏并点击图片!
  10. 【KMP】KMP 字符串匹配算法