Giter Site home page Giter Site logo

mrrraph / pyransom Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 21 KB

Encrypt/Decrypt Symmetrically/Asymmetrically files with Integrity verification using signature

Python 100.00%
pycryptodome hmac-sha256 pss signature rsa-signature rsa aes-256 cbc-aes-encryption oaep initialization-vector

pyransom's Introduction

pyRansom

Author: Raphael Dray

pyRansom is not a ransomware but a tool designed to encrypt/decrypt using either symmetrically either asymmetrically a given file and checking its integrity using either HMAC-SHA-256 either RSA-PSS signature.

It can be used, for now, to encrypt/decrypt symmetrically using AES -256-CBC with a given password that will be used to generate round keys.

Also, it can be used to encrypt/decrypt asymmetrically using RSA-OAEP 2048 to encrypt only the CipherKey (used by the AES to encrypt data) in case of single user sending and to encrypt the CipherKey plus the Initialization Vector (used by the AES to encrypt data) in case of multi-protect sending.


Installation:

You'll need Python 3.8+ to run this script.

  • Clone this repository:
    git clone [email protected]:MrrRaph/pyRansom.git
  • Install the requirements:
    pip install -r requirements.txt

Usage:

General Options:

usage: pyRansom.py [-h] --input <Input Filename> --output <Output Filename> (--encrypt | --decrypt) {sym,asym} ...

Encrypt/Decrypt given file

positional arguments:
  {sym,asym}            Encryption Mode
    sym                 Symmetric Mode
    asym                Asymmetric Mode

optional arguments:
  -h, --help            show this help message and exit

I/O:
  --input <Input Filename>, -i <Input Filename>
                        Input file to Encrypt/Decrypt
  --output <Output Filename>, -o <Output Filename>
                        Output file to save the encrypted/decrypted

Cipher Mode:
  --encrypt, -e         Encrypt mode
  --decrypt, -d         Decrypt mode

Symmetric Encryption:

usage: pyRansom.py sym [-h] --password <Password>

optional arguments:
  -h, --help            show this help message and exit

Symmetric Encryption:
  --password <Password>, -p <Password>
                        Password to be used to encrypt/decrypt the file

Example: Start by encrypting your Input File using your password (e.g. myP@$$W0rd)

python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc sym -p myP@$$W0rd

Then you can decrypt your Output File as follows:

python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec sym -p myP@$$W0rd

Asymmetric Encryption:

usage: pyRansom.py asym [-h] --private-key <Private Key Filename> --public-key <Public Key Filename> [<User Public Key> [<User Public Key> ...]]

optional arguments:
  -h, --help            show this help message and exit

Asymmetric Encryption:
  --private-key <Private Key Filename>, -priv <Private Key Filename>
                        Receiver/Sender Private Key
  --public-key <Public Key Filename>, -pub <Public Key Filename>
                        Receiver/Sender Public Key
  <User Public Key>     User Public Key (Multi-Protected File)
Single Sending:

For encryption, you have to use the sender private key and the receiver public key.

python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc asym -priv senderPriv.pem -pub receiverPub.pem

For decryption, you have to use the receiver private key and the sender public key.

python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec asym -priv receiverPriv.pem -pub senderPub.pem

Multi-Protect Sending:

For encryption, you have to use the sender private key and the sender public key. Then you can specify all the receivers public keys, only those could decrypt the file.

python pyRansom.py -e --input venv\Scripts\activate.fish --output output\activate.fish.enc asym -priv senderPriv.pem -pub senderPub.pem users\Thierry\thierry-pub.pem users\Lorens\lorens-pub.pem

Or by using the wrapper:

python multi_protect.py -e venv\Scripts\activate.fish output\activate.fish.enc senderPriv.pem senderPub.pem  users\Thierry\thierry-pub.pem users\Lorens\lorens-pub.pem

For decryption, for example, Thierry as the receiver, will use its own private key, the sender public key and specify its public key.

python pyRansom.py -d --input output\activate.fish.enc --output output\activate.fish.dec asym -priv users\Thierry\thierry-priv.pem -pub senderPub.pem users\Thierry\thierry-pub.pem

Or by using the wrapper:

python multi_protect.py -d output\activate.fish.enc output\activate.fish.dec users\Thierry\thierry-priv.pem senderPub.pem users\Thierry\thierry-pub.pem

pyransom's People

Contributors

mrrraph avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.