Skip to content

A-lone-Contributer/D-CRYPTOR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forthebadge forthebadge forthebadge

Product Name Screen Shot


A Command line tool for Cipher Decryption using Genetic Algorithms and Natural Language Processing (NLP).

Report Bug


Table of Contents


About The Project

Ever thought how Natural language processing can be used for decryption of a cipher text? Well, here is the answer!

D-CRYPTOR is capable of encrypting and decrypting cipher text using Genetic Algorithm and Natural language processing (NLP).

Key Idea : After learning the probability likelihoods of normal english text, we can mutate the cipher (swapping) to minimize the difference of probability likelihood to plain english text. This mutation would be closed to the original mapping thus deciphered text.

High level Overview :

  1. A encoded text is generated using a random character-character mapping (source : encoder.py)
  2. Now, for the decoding purpose following steps are performed:
    • A Markov Matrix of bi-grams probabilities is generated from the training data train.txt.
    • We extend this to generate probabilities for the whole sequence and normalise to range (0,1).
    • Now, generate random pool of DNA (a list of lowercase ascii characters) and shuffle them.
    • To mutate, we take few candidates from the pool and generate probability score till number of iterations or out best score doesn't improve.
  3. Now, we use this best likelihood score character mapping and apply to cipher text and obtain deciphered sentence.
  4. To make decryption process interesting, script uses truecasing.py which tries to reterive the original casing of decyphered text without knowing of it in the first place.

LIMITATIONS

  1. D-CRYPTOR cannot decrypt sentences with very few words as a 26 character mapping is harder to learn from it.
  2. Being a randomized algorithm, it might be possible that you get different result on successive runs.
  3. Does not decode punctuations.

Built Using


Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  1. Python

To check, if python is installed, type python in command line. If this opens python3 interpreter then you are good to go.

else, python3 follow this link to download the latest version.

  1. Git

You can download the latest version of git here.

Installation

  1. Clone the repo
git clone https://github.com/A-lone-Contributer/D-CRYPTOR.git
  1. Install the dependencies
pip install -r requirements.txt
  1. Download distributions.obj file which is a dependency of truecasing.py using this link. Extract the downloaded file and place it in the script directory.

Usage

  1. To run D-CRYPTOR, run the master.py file.
python master.py

NOTE: If python master.py does not work, try using python3 master.py instead.

  1. A intro splash screen would be displayed that looks something like this:

NOTE: You can press Enter to skip the animation screen.

Product Splash

  1. Now, you will be directed to a menu. Choose the first option (if not done before)

Product Menu

  1. After selecting the first option, you will be given a text box where you can write your original message which you want to encode and decode. You can either type of paste the copied text.

NOTE: Follow prompts written on the top of text field.

Encyption Input

  1. Press CTRL+G to execute and obtain the encrypted message. This message is also saved in a text file named encoded_text.txt. After encryption, the cipher will look something like this

Encrypted Output

  1. As, we have generated the encrpted text, we can directly decypher the text. So, navigate to the decryption option on the menu and press Enter. A splash screen like this will be displayed.

Decryption Splash

  1. Final decoded text will be displayed after sometime.

NOTE: Running time of the algorithm depends on PC Specs and the length of the plain text being deciphered.

Decryption Output


Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache-2.0 License. See LICENSE for more information.

Contact

Nishkarsh Tripathi : nishkarsh78@gmail.com

Project Link : D-CRYPTOR

About

De-cyphering text using genetic algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages