bug fixes for paddingoracle attack
This commit is contained in:
parent
6365e737df
commit
b9c5a5bf3e
3 changed files with 32 additions and 14 deletions
12
crack.py
12
crack.py
|
|
@ -1,7 +1,11 @@
|
|||
import requests
|
||||
|
||||
from imp.constants import PRINTABLE
|
||||
from imp.attacks.paddingoracle import paddingoracle
|
||||
from imp.attacks import paddingoracle
|
||||
|
||||
from Crypto.Util.Padding import pad
|
||||
|
||||
import string
|
||||
|
||||
NIBBLESET = [n.to_bytes() for n in range(256)]
|
||||
|
||||
|
|
@ -9,8 +13,8 @@ HOST = 'https://aes.cryptohack.org'
|
|||
ENDPOINT = '/ecb_oracle/encrypt/{0}/'
|
||||
URI = HOST + ENDPOINT
|
||||
|
||||
# CHARSET = [c.encode() for c in string.printable]
|
||||
CHARSET = NIBBLESET # OVERRIDE
|
||||
CHARSET = [c.encode() for c in string.printable]
|
||||
# CHARSET = NIBBLESET # OVERRIDE
|
||||
|
||||
FLAG_LEN = 26 # flag length, calculated by hand
|
||||
SPACER = b'\x0f' # arbitrary spacing character
|
||||
|
|
@ -30,7 +34,7 @@ def encrypt(b: bytes) -> bytes:
|
|||
return bytes.fromhex(resp['ciphertext'])
|
||||
|
||||
def main() -> None:
|
||||
paddingoracle(encrypt, NIBBLESET, 64, batch_size=16, debug=True)
|
||||
paddingoracle.crack(encrypt, pad, CHARSET, 64, batch_size=2, debug=True)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue