We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28e9230 commit a73ad2eCopy full SHA for a73ad2e
1 file changed
paddingoracle.py
@@ -3,7 +3,6 @@
3
Padding Oracle Exploit API
4
~~~~~~~~~~~~~~~~~~~~~~~~~~
5
'''
6
-
7
from itertools import izip, cycle
8
import logging
9
@@ -223,13 +222,11 @@ def test():
223
222
224
class PadBuster(PaddingOracle):
225
def oracle(self, ctext):
226
- import struct
227
228
cipher = AES.new(key, AES.MODE_CBC, str(bytearray(AES.block_size)))
229
ptext = cipher.decrypt(str(ctext))
230
- plen = struct.unpack("B", ptext[-1])[0]
+ plen = ord(ptext[-1])
231
232
- padding_is_good = (ptext[-plen:] == struct.pack("B", plen) * plen)
+ padding_is_good = (ptext[-plen:] == chr(plen) * plen)
233
234
if padding_is_good:
235
return
0 commit comments