File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,18 +35,22 @@ See below for an example (from `the example`_): ::
3535 class PadBuster(PaddingOracle):
3636 def __init__(self, **kwargs):
3737 super(PadBuster, self).__init__(**kwargs)
38- self.session = requests.session(prefetch=True, timeout=5, verify=False)
38+ self.session = requests.Session()
39+ self.wait = kwargs.get('wait', 2.0)
3940
40- def oracle(self, data):
41+ def oracle(self, data, **kwargs ):
4142 somecookie = quote(b64encode(data))
4243 self.session.cookies['somecookie'] = somecookie
4344
4445 while 1:
4546 try:
46- response = self.session.get('http://www.example.com/')
47+ response = self.session.get('http://www.example.com/',
48+ stream=False, timeout=5, verify=False)
4749 break
48- except (socket.error, requests.exceptions.SSLError):
49- time.sleep(2)
50+ except (socket.error, requests.exceptions.RequestException):
51+ logging.exception('Retrying request in %.2f seconds...',
52+ self.wait)
53+ time.sleep(self.wait)
5054 continue
5155
5256 self.history.append(response)
You can’t perform that action at this time.
0 commit comments