Skip to content

Commit f1d793b

Browse files
updated documentation to reflect reference implementation
1 parent 2762327 commit f1d793b

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

docs/index.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)