17
17
from multiprocessing import Pool
18
18
19
19
from httplib import HTTPConnection
20
+ from httplib import BadStatusLine
20
21
21
22
PORT = "2060"
22
23
@@ -37,8 +38,9 @@ def main_single(target, prefix, i):
37
38
try :
38
39
resp = conn .getresponse ()
39
40
resp .read ()
40
- except :
41
- pass
41
+ conn .close ()
42
+ except BadStatusLine as e :
43
+ print "Got BadStatusLine for /: %s" % e
42
44
conn = HTTPConnection (target , PORT , timeout = 10 , source_address = (source , 0 ))
43
45
conn .connect ()
44
46
token = str (uuid .uuid4 ())
@@ -48,8 +50,9 @@ def main_single(target, prefix, i):
48
50
# this causes wifidog to ask our mock auth server if the token is
49
51
# correct
50
52
resp .read ()
51
- except :
52
- pass
53
+ conn .close ()
54
+ except BadStatusLine as e :
55
+ print "Got BadStatusLine for login: %s" % e
53
56
# log out sometimes
54
57
if random .choice ([True , False , False ]):
55
58
conn = HTTPConnection (target , PORT , timeout = 10 , source_address = (source , 0 ))
@@ -58,8 +61,9 @@ def main_single(target, prefix, i):
58
61
try :
59
62
resp = conn .getresponse ()
60
63
resp .read ()
61
- except :
62
- pass
64
+ conn .close ()
65
+ except BadStatusLine as e :
66
+ print "Got BadStatusLine for logout: %s" % e
63
67
64
68
65
69
# http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/
0 commit comments