SkillAgentSearch skills...

CryptTools

Tools for encryption, decryption and cracking from several cryptographic systems.

Install / Use

/learn @Carleslc/CryptTools

README

CryptTools

Tools for encryption, decryption and cracking from several cryptographic systems.

🇪🇸 Obtén información sobre la criptografía clásica y este proyecto en este artículo.

ko-fi

How to Install

  1. Install Python 3.6 if you do not have it yet.
  2. Ensure that you have installed python3.6 in /usr/bin otherwise you will need to make a symbolic link to its real location:
sudo ln -s $(which python3.6) /usr/bin/python3.6
  1. Install the following Python dependencies:
pip3 install numpy
pip3 install pyenchant
  1. Clone this repository: git clone https://github.com/Carleslc/CryptTools.git
  2. Give execution permissions to all tools:
cd CryptTools/tools
chmod +x *

Tools available

These tools are designed to be useful in the field of computer security and their use is restricted to personal use or under consent. I am not responsible for any illicit use that may occur.

Caesar

--> What is the Caesar Cipher? <--

Usage

./caesar.py --help

usage: caesar.py [-h] [-t TEXT] [-k KEY] [-l LANG] [-V] [-A] [-D]
                 [-T THRESHOLD] [--beep]

optional arguments:
  -h, --help            show this help message and exit
  -t TEXT, --text TEXT  text to read from. If not specified the program will
                        read from standard input
  -k KEY, --key KEY     key used to encrypt. If no key is provided the program
                        will try to crack and decrypt using the specified
                        language
  -l LANG, --lang LANG  available languages: ['de_DE', 'en_AU', 'en_GB',
                        'en_US', 'fr_FR'] (default: en_US). Only useful if no
                        key is provided
  -V, --verbose         show extra information
  -A, --all             show decrypted text for each tested key
  -D, --debug           show information about text validation
  -T THRESHOLD, --threshold THRESHOLD
                        valid word count percentage to mark the whole text as
                        valid language (default: 50)
  --beep                plays a beep sound when program finishes. May require
                        SOX to be installed
Examples
Encrypt a text and save to a file

./caesar.py -t "This is the Caesar tool from CryptTools!" -k 5 > test

Ymnx nx ymj Hfjxfw yttq kwtr HwduyYttqx!

-t argument is not mandatory, so if you need to encrypt a long text you can skip it, execute ./caesar.py -k 5 > test and then paste your text. When completed press Return and then finish the input with Ctrl+D so the program will read it.

Encrypt with extra information

./caesar.py -t "This is the Caesar tool from CryptTools!" -k 5 -VA

Original text most frequent character: t

Ymnx nx ymj Hfjxfw yttq kwtr HwduyYttqx!

Encrypted text most frequent character: y
Decrypt with a known key

To decrypt you will need to know the shift needed to reallocate each character to its correct character in the alphabet. In the example above the encrypted shift is 5 so the shift needed to decrypt is 26 - 5 = 21, where 26 is the size of the alphabet.

./caesar.py -k 21 < test

This is the Caesar tool from CryptTools!
Decrypt without knowing the key

This method cracks the message with bruteforce and then checks every result validating the language to guess which result is the original text. By default language is English, for other languages read below.

./caesar.py < test

This is the Caesar tool from CryptTools!
Advanced features

Read from a file and print cracked keys:

./caesar.py -V < test

Most frequent character: y
Testing 't' (ROT-21)       SUCCESS
Decrypted with ROT-21. Original encryption key: 5
This is the Caesar tool from CryptTools!

ROT-X means that each character in the text is shifted X positions in the alphabet.

To decrypt a message without knowing the key you need to know the original text language. It is provided with --lang option. By default it is en_US (American English).

For example, in Deutsch language:

./caesar.py -t "Dies ist das Scytale-Tool von CryptTools!" -k 6

Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!

If language is not provided it will try English and it will fail:

./caesar.py -V -t "Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!"

Most frequent character: y
Testing 'z' (ROT-1)        
Sorry. None of decrypted results seems to be written in language en_US...

Then, providing the correct language:

./caesar.py -V -t "Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!" --lang "de_DE"

Most frequent character: y
Testing 's' (ROT-20)       SUCCESS
Decrypted with ROT-20. Original encryption key: 6
Dies ist das Scytale-Tool von CryptTools!

You can check all available codes with ./caesar.py --help. You can even install more languages, for that take a look here.

If original text language is unknown you still can generate all possible transformations, then you will need to check them manually in order to know which is the correct:

./caesar.py -V -A -t "Joky oyz jgy Yiezgrk-Zuur but IxevzZuury!"

Most frequent character: y
Testing 'e' (ROT-6)       Testing decrypted text:
"Puqe uef pme Eokfmxq-Faax haz OdkbfFaaxe!"
Testing 't' (ROT-21)       Testing decrypted text:
"Ejft jtu ebt Tdzubmf-Uppm wpo DszquUppmt!"
...
Testing 's' (ROT-20)       Testing decrypted text:
"Dies ist das Scytale-Tool von CryptTools!"
Testing 'h' (ROT-9)       Testing decrypted text:
"Sxth xhi sph Hrnipat-Idda kdc RgneiIddah!"
...
Testing 'q' (ROT-18)       Testing decrypted text:
"Bgcq gqr byq Qawryjc-Rmmj tml ApwnrRmmjq!"
Testing 'z' (ROT-1)       Testing decrypted text:
"Kplz pza khz Zjfahsl-Avvs cvu JyfwaAvvsz!"

Sorry. None of decrypted results seems to be written in language en_US...

Testing order is frequency order (most common letter is tested first).

In addition, with the extra option -D you can check the language validation process:

./caesar.py -VAD < test

Most frequent character: y
Testing 'e' (ROT-6)       Testing decrypted text:
"Estd td esp Nlpdlc ezzw qczx NcjaeEzzwd!"

estd: False              |  Progress 0%     | Max 88%
td: False                |  Progress 0%     | Max 75%
esp: True                |  Progress 12%    | Max 75%
nlpdlc: False            |  Progress 12%    | Max 62%
ezzw: False              |  Progress 12%    | Max 50%
qczx: False              |  Progress 12%    | Max 38%

Testing 't' (ROT-21)       Testing decrypted text:
"This is the Caesar tool from CryptTools!"

this: True               |  Progress 12%    | Max 100%
is: True                 |  Progress 25%    | Max 100%
the: True                |  Progress 38%    | Max 100%
caesar: False            |  Progress 38%    | Max 88%
tool: True               |  Progress 50%    | SUCCESS

Decrypted with ROT-21. Original encryption key: 5
This is the Caesar tool from CryptTools!

-A and -D options may be too verbose, avoid using them for long texts.

You can also set the permissiveness of the language validation process with the --threshold -T option. By default it is set to 50 (half of the text words must be written in the specified language in order to accept it as the original text). Values must be between 1 and 100. Values below 20% are not recommended (an encrypted text may be accepted as decrypted). Higher values indicate toughness, but 100% it is neither recommended (in the text may be non-english nouns and other original but non-english words).

NOTE

As you can see, it is too easy to crack this classical cryptographic system so it is not recommended to use it in production software.

Scytale

--> What is a Scytale? <--

Usage

./scytale.py --help

usage: scytale.py [-h] [-t TEXT] [-k KEY] [-l LANG] [-V] [-A] [-D]
                  [-T THRESHOLD] [--beep]

optional arguments:
  -h, 

Related Skills

View on GitHub
GitHub Stars40
CategoryDevelopment
Updated1mo ago
Forks17

Languages

Python

Security Score

95/100

Audited on Feb 13, 2026

No findings