前言:

今天师傅叫我,写个python版的御剑。然后我之前也写过

不过不怎么样,这次有新想法。

思路:

御剑:读取御剑配置文件里的所有路径,加上用户要扫描的url。进行批量检测,如果状态码为200并且无Error.ini里面的错误就存在该路径。报存在save.txt (详细看代码)

路径:

御剑代码:

import requests
import random
import os
file=[]
url=[]
error=[]
bc=[]
ip=[]
headers={}
user=input('Import TXT:')
banner='''
____ _
| _ \ ___ ___| |_ _ __ ___ _ _ ___ _ __
| | | |/ _ \/ __| __| '__/ _ \| | | |/ _ \ '__|
| |_| | __/\__ \ |_| | | (_) | |_| | __/ |
|____/ \___||___/\__|_| \___/ \__, |\___|_|
|___/ Producer:Nine world
'''
useragent=[]
twoo=[]
print(banner) def urls():
dk=open('{}'.format(user),'r')
for k in dk.readlines():
qcs="".join(k.split('\n'))
url.append(qcs)
print('[+]url.txt Load completion')
print(' ')
print(' ')
urls() def judge():
pd=os.listdir('御剑配置文件')
for name in pd:
file.append(name) for f in file:
print('[+]existence {}'.format(f)) print(' ')
print(' ') dk=open('user-agent.txt','r')
for d in dk.readlines():
qc="".join(d.split('\n'))
useragent.append(qc)
print('[+]user-agent Load completion')
print(' ')
print(' ')
judge() def errors():
lv=open('Error/error.txt','r')
for e in lv.readlines():
qcsw="".join(e.split('\n'))
error.append(qcsw)
print('[+]The filter file is loaded')
print(' ')
print(' ')
errors() def forge():
sj=[]
dkw=open('ip.txt','r')
for i in dkw.readlines():
k="".join(i.split('\n'))
ip.append(k) for g in range(0,len(useragent)):
u='User-Agent='
x='X-Forwarded-For='
c='Client-IP='
sj.append(u+useragent[g]+'&'+x+ip[g]+'&'+c+ip[g])
kc=list(set(sj))
su=random.choice(kc)
qc=str(su)
for v in qc.split('&'):
key,value=v.split('=',1)
headers[key]=value
forge() def exploit():
wi=os.listdir('御剑配置文件')
for w in wi:
dp=open('{}'.format('御剑配置文件/'+w),'r',encoding='gbk')
for s in dp.readlines():
we="".join(s.split('\n'))
for u in url:
up='{}'.format(u).rstrip('/')+we
try:
requet=requests.get(url=up,headers=headers,timeout=3,allow_redirects=False)
for e in error:
if requet.status_code==200 and not e in requet.text:
ok='[+]code:{} url:{}'.format(requet.status_code,requet.url)
if ok in twoo:continue
twoo.append(ok)
print(ok)
else:
no='[x]Not url :{}'.format(requet.url)
if no in bc:continue
bc.append(no)
print(no)
except Exception as u:
print('[-]Error {}'.format(u)) if len(twoo)>0:
od=open('save.txt','w')
od.close() xr=open('save.txt','r')
for c in twoo:
print(c,file=open('save.txt','a')) exploit()

测试效果:

Github下载地址:https://github.com/422926799/python/tree/master/%E5%BE%A1%E5%89%91

python写个御剑的更多相关文章

  1. Python写各大聊天系统的屏蔽脏话功能原理

    Python写各大聊天系统的屏蔽脏话功能原理 突然想到一个视频里面弹幕被和谐的一满屏的*号觉得很有趣,然后就想用python来试试写写看,结果还真玩出了点效果,思路是首先你得有一个脏话存放的仓库好到时 ...

  2. python写红包的原理流程包含random,lambda其中的使用和见简单介绍

    Python写红包的原理流程 首先来说说要用到的知识点,第一个要说的是扩展包random,random模块一般用来生成一个随机数 今天要用到ramdom中unifrom的方法用于生成一个指定范围的随机 ...

  3. Python写地铁的到站的原理简易版

    Python地铁的到站流程及原理(个人理解) 今天坐地铁看着站牌就莫名的想如果用Python写其工作原理 是不是很简单就小试牛刀了下大佬们勿喷纯属小弟个人理解 首先来看看地铁上显示的站牌如下: 就想这 ...

  4. 用Python写一个简单的Web框架

    一.概述 二.从demo_app开始 三.WSGI中的application 四.区分URL 五.重构 1.正则匹配URL 2.DRY 3.抽象出框架 六.参考 一.概述 在Python中,WSGI( ...

  5. 读书笔记汇总 --- 用Python写网络爬虫

    本系列记录并分享:学习利用Python写网络爬虫的过程. 书目信息 Link 书名: 用Python写网络爬虫 作者: [澳]理查德 劳森(Richard Lawson) 原版名称: web scra ...

  6. Python写UTF8文件,UE、记事本打开依然乱码的问题

    Python写UTF8文件,UE.记事本打开依然乱码的问题 Leave a reply 现象:使用codecs打开文件,写入UTF-8文本,正常无错误.用vim打开正常,但记事本.UE等打开乱码. 原 ...

  7. python 写的http后台弱口令爆破工具

    今天来弄一个后台破解的Python小程序,哈哈,直接上代码吧,都有注释~~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ...

  8. 『安全工具』目录扫描 DirBuster AND 御剑

    要想熟悉目标网站的体系架构,知道网站有哪些目录是必不可少的 向AWVS,Burp类大型扫描工具也可以进行目录扫描,不过个人感觉远没有专业扫描工具来的简单,实在 0x 01 DirBuster 简介:D ...

  9. python写xml文件

    为了便于后续的读取处理,这里就将信息保存在xml文件中,想到得到的文件如下: 1 <?xml version="1.0" encoding="utf-8" ...

随机推荐

  1. 清除的通用样式 css

    /*公共样式--开始*/ html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dl, dt, dd, ol, form, input, textar ...

  2. BZOJ3473: 字符串【后缀数组+思维】

    Description 给定n个字符串,询问每个字符串有多少子串(不包括空串)是所有n个字符串中至少k个字符串的子串? Input 第一行两个整数n,k. 接下来n行每行一个字符串. Output 一 ...

  3. HDU2037:今年暑假不AC

    Problem Description "今年暑假不AC?" "是的." "那你干什么呢?" "看世界杯呀,笨蛋!" & ...

  4. 《DSP using MATLAB》Problem 4.24

    Y(z)部分分式展开, 零状态响应部分分式展开, 零输入状态部分分式展开,

  5. 基于点线特征的Kinect2实时环境重建(Tracking and Mapping)

    前言 个人理解错误的地方还请不吝赐教,转载请标明出处,内容如有改动更新,请看原博:http://www.cnblogs.com/hitcm/ 如有任何问题,feel free to contact m ...

  6. saltops 安装及相关环境安装

    本次布署测试环境 阿里云 Centos 7.3 1.安装nginx,这里采用yum 安装方式 A.yum install nginx B.创建开机启动 systemctl enable nginx.s ...

  7. JUC集合之 ArrayBlockingQueue

    ArrayBlockingQueue介绍 ArrayBlockingQueue是数组实现的线程安全的有界的阻塞队列. 线程安全是指,ArrayBlockingQueue内部通过"互斥锁&qu ...

  8. 如何使用button在tab中新建打开一个链接页

    在APPBOX某页中如何使用button按钮打开一个新的链接页.比如说百度.谷歌等 在后台的单击事件中使用以下语句即            string url = "DownloadIma ...

  9. 零基础学习hadoop开发所必须具体的三个基础知识

    大数据hadoop无疑是当前互联网领域受关注热度最高的词之一,大数据技术的应用正在潜移默化中对我们的生活和工作产生巨大的改变.这种改变给我们的感觉是“水到渠成”,更为让人惊叹的是大数据已经仅仅是互联网 ...

  10. debian下配置keepalived ha

    抄袭自http://blog.51yip.com/server/1417.html,做了一些修改 可以参考http://blog.linuxphp.org/archives/1615/ 备注:NAT模 ...