BaseCrack is a tool written in Python that can decode all alphanumeric base encoding schemes.

Overview

BaseCrack

Decoder For Base Encoding Schemes

version GitHub license

BaseCrack is a tool written in Python that can decode all alphanumeric base encoding schemes. This tool can accept single user input, multiple inputs from a file, input from argument, multi-encoded bases, bases in image EXIF data, bases on images with OCR and decode them incredibly fast.

For a basic demo, try the Web Interface that uses BaseCrack's API.

Fun Fact!
I initially made this after being fed up with lame CTF challenges with multi-encoded bases. Now some of them started doing that in Steganography challenges so I automated that too smh!

Table of Contents

Features

  • Decode multi-encoded bases of any pattern.
  • Decode bases in image EXIF data.
  • Decode bases on images with OCR detection.
  • Can decode multiple base encodings from a file.
  • Generate a wordlist/output with the decoded bases.
  • Predicts the type of encoding scheme.

Supported Encoding Schemes

  • Base16
  • Base32
  • Base36
  • Base58
  • Base62
  • Base64
  • Base64Url
  • Base85
  • Ascii85
  • Base91
  • Base92
  • Base100 (#14)

Installation

$ git clone https://github.com/mufeedvh/basecrack.git
$ cd basecrack
$ pip3 install -r requirements.txt
$ python3 basecrack.py -h

NOTE: Python3 is recommended to use!

Linux:

$ sudo apt-get update
$ sudo apt-get install tesseract-ocr libtesseract-dev

MacOS:

$ brew install tesseract

Windows:

OCR Detection is implemented with Tesseract and Windows requires installation of the Tesseract executable. Installing the dependencies from requirements.txt which includes pytesseract should install it. If in case it doesn't, here's how you can set it up:

  1. First check whether you have it installed or not in the Program Files/Program Files (x86) under the Tesseract-OCR directory.
  2. If there is, give that path in the config.json and you're all set! If you don't have it, install it from here and set the path in config.json.

Tesseract Docs: https://tesseract-ocr.github.io/

NOTE: I haven't completely tested this tool on Windows so if you stumble upon any issues, please open an issue.

Usage

Get a list of all the arguments:

python3 basecrack.py -h

To decode a single base encoding from user input:

python3 basecrack.py

To decode a single base encoding from argument (-b/--base):

python3 basecrack.py -b SGVsbG8gV29ybGQh

To decode multiple base encodings from a file (-f/--file):

python3 basecrack.py -f file.txt

Magic Mode: To decode multi-encoded base of any pattern (-m/--magic):

python3 basecrack.py --magic

To input an image for EXIF/OCR detection mode (-i/--image):

python3 basecrack.py -i image.jpg (--exif/--ocr)

EXIF Data: To decode bases in image EXIF data (-e/--exif):

python basecrack.py -i image.jpg --exif

OCR Base Detection: To decode bases on image with OCR detection (-c/--ocr):

python basecrack.py -i image.jpg --ocr

To generate a wordlist/output with the decoded bases (-o/--output):

python basecrack.py -f file.txt -o output-wordlist.txt

Magic Mode

Now you can decode multi-encoded bases of any pattern in a single shot.

Have you ever stumbled upon that one lame CTF challenge that gives you an encoded string which is just encoded over and over with Base64, Base91, Base85 and so on? Just give that to BaseCrack and you're done with it! ;)

Want to test it out? Just give it this input:

IX([email protected]<,*TFE]IT^zdINAb9EVbp,e
   
    <*[Nv+T8

   

and see for yourself! :)

BaseCrack API

BaseCrack can now be used as a library! Just import the BaseCrack() class and call the decode() function.

See API.

API

Want to use BaseCrack as a library? We got you covered!

Just put basecrack in your project's directory and you're ready to go!

Example:

# import the BaseCrack class from basecrack.py
from basecrack import BaseCrack

# calling the api function decode() with the encoded base
result = BaseCrack().decode('c3BhZ2hldHRp')

# printing the output
"""
result is tuple where:
result[0] = DECODED STRING
result[1] = ENCODING SCHEME
"""
print('Decoded String: {}'.format(result[0]))
print('Encoding Scheme: {}'.format(result[1]))

Output:

Decoded String: spaghetti
Encoding Scheme: Base64

Contribution

Ways to contribute

  • Suggest a feature
  • Report a bug
  • Fix something and open a pull request
  • Help me document the code
  • Spread the word

Before you open a PR, make sure everything's good by running the tests:

Unit Tests: (Thanks @FavasM)

python3 -m unittest discover -v -s tests

License

Licensed under the MIT License, see LICENSE for more information.

Liked the project?

Support the author by buying him a coffee!

Buy Me A Coffee


Comments
  • base62 decoding not working

    base62 decoding not working

    Hi,

    I think there is a bug in the base62 decoding attempt.

    Should not the line

    base62_decode = base62.encode(int(encoded_base)).decode('utf-8', 'replace')

    read something like

    base62_decode = str(base62.decode(encoded_base))

    ?

    For instance, with base-62 from pypi I get

    In [3]: base62.encode(999)
    Out[3]: 'g7'
    

    With the original basecrack.py:

    $ python3 basecrack.py -b 'g7
    [-] Encoded Base: g7
    
    [>] Decoding as Base91: 
    
    [>] Decoding as Base92: Â
    
    

    With my suggested modification:

    $ python3 basecrack.py -b 'g7
    [-] Encoded Base: g7
    
    [>] Decoding as Base62: 999
    
    [>] Decoding as Base91: 
    
    [>] Decoding as Base92: Â
    
    [-] The Encoding Scheme Is Base62
    

    Moreover, I find disagreeing results when I encode a integer with base-62 and with pybase62 (both taken from pypi).

    opened by beuguissime 4
  • Not a valid encoding

    Not a valid encoding

    hi i cannot seem to get it to work ... it keeps saying not valid encoding .

    [>] Enter Encoded Base: b6e6e5056e045a83e2828de658ccd5c1 [!] Not a valid encoding.

    opened by jepunband 4
  • 对一些有特殊字符的base编码无法解码

    对一些有特殊字符的base编码无法解码

    使用中发现,如果编码中存在特殊字符(#!@"":)时,即使是base85编码也无法解码。 比如: 1cI9M2)-sF1h8IP1bppJ1cR<H1G^jE2)-q!1h/?t1cI7%2.8@!1hJRU1bppI1h8F'1GUdG1h&:Q1G^jC1cI9L1GgsG1hJU1gr7!1h8I$1GUdD1hJRU1gr6s1cI7%2!KM1h&=&1gr7"1cI9H1GUgE2)@("2.8@#1cI9L1GgsG1h8IP1bppG1cI9L1G^mI1c$t"1gr7M1cI9L1GUdD1c[ER1gr7#1h8F#1GUdG1h&:Q2)I-F1cI9H1GgsG1hJU1gr7"1h8F#1G^jH1c[C(1bpps1cI7%2!NN1h&:R1gr7"1cI3I1GUgE2)@(#1G^jC1cI9I2)@H1c[C(2.8@"1h8I$1G^jH1c$t"1gr7M1cI:#2)@'G1h&:Q1gr7$1cR<H1GUdG1c[C(1bppK1cI7%2!KM1cI:#1bgds

    opened by tysmlq 3
  • Not detecting base32 encoded string

    Not detecting base32 encoded string

    I pulled the following string from a CTF:

    wvcpRLNKBz2zqpFs9UcrvLAgXjgwyquv4GbW2FXC9Y7ZW4dzkcZk9t7t3vSnjdUDUwBCVDZdj6XZ5xoTr6UXxbag1PrytSVoU5ZzCinrYsMJ7Aac8A8S7cJTmnbSs9PZHgEmRCkMir2WWYygs7SwESfbTV

    decoding from base32 and then running the magic flag on it works, but doesn't with the first base32 later. base32 -d doesn't work with it either, but cyberchef does. I assume its because of some issue with the specifics of identifying a base32 string, but not sure.

    question 
    opened by Adamkadaban 3
  • hi,I encountered

    hi,I encountered "!" when decoding base85

    If there is a "!" in the "shell" you will get this error image And to avoid this mistake is to give "!" with "", but then it will not be decoded properly image

    opened by Joackk 2
  • No module named 'colorama'

    No module named 'colorama'

    Traceback:
      File "/data/data/_(Hidden)_/files/home/basecrack/basecrack.py", line 16, in <module>
        from colorama import init
    ModuleNotFoundError: No module named 'colorama'
    
    opened by RedFurrFox 1
  • HC1:6BFOXN%TS3DHPVO13J /G-/2YRVA.Q/R85MJ2FC1J9M$DI9C6H9Y9R/-C:QU7JM:U…

    HC1:6BFOXN%TS3DHPVO13J /G-/2YRVA.Q/R85MJ2FC1J9M$DI9C6H9Y9R/-C:QU7JM:U…

    …CGPXS4MZKI CHFEC+GYHILIIX2MO.KPGGCCHAJK260O936J37A0$KLZOQL8RSCA KPLIO4KRK4WPE-L95B2%K:XF%83/Y4RT2./D0E8I2I02K-C175MA-7YF1VIOU2MLLO8G152IL48L-3N13P9IHBW1U0-3K5GGEQ1:8YBRR-S3D1PI0/7Q$M8UNAXOE4M9UL8BN9NI2FI2V:8KI1XI02PCZ.2PI0K07U/6-%CN$K QS7DS2N.SSTQHXFU I.ZJ T8UIS6$JDPIA KZU0I1-I0OC6H0/VM8OI6S99K6QJ2BMA:J0B-S-O/Y41FD$W4990O.F9KKSC96FFZ-A6LFCD9VVLA8LU8LG7K9JA639+JF0JEYI1DLNCKUCI5OI9YI:8DN:D+NDPN1.PHL01K.9I1RAGB/PD7XPH.D8EE%8WX9Q CE6VD1FD8$93NF54T5HC%/9V6H%O9H*NDVD32WS/C-DRCL21TL7Y51B7NDL7CF.N8%NE %GS20OO9Z0

    opened by jhonnydip 1
  • python basecrack.py

    python basecrack.py

    C:\python3.8\basecrack\basecrack>python basecrack.py Traceback (most recent call last): File "basecrack.py", line 18, in import base36 ModuleNotFoundError: No module named 'base36 ------------------------------------------------------------------翻译 最近一次调用(回溯):

    “文件”basecrack.py“,第18行,输入

    导入base36

    ModuleNotFoundError:没有名为“base36”的模块

    这里什么意思........没有base36的模块

    opened by N0o01 1
  • Add Dockerfile

    Add Dockerfile

    ❯ docker run --rm -it -v $(pwd):/data basecrack
    
    ██████╗  █████╗ ███████╗███████╗ ██████╗██████╗  █████╗  ██████╗██╗  ██╗
    ██╔══██╗██╔══██╗██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
    ██████╔╝███████║███████╗█████╗  ██║     ██████╔╝███████║██║     █████╔╝
    ██╔══██╗██╔══██║╚════██║██╔══╝  ██║     ██╔══██╗██╔══██║██║     ██╔═██╗
    ██████╔╝██║  ██║███████║███████╗╚██████╗██║  ██║██║  ██║╚██████╗██║  ██╗
    ╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝ v3.0
    
    		python basecrack.py -h [FOR HELP]
    
    [>] Enter Encoded Base: Cn8eVZg
    
    [>] Decoding as Base58: hello
    
    [>] Decoding as Base92: `2%i
    
    [-] The Encoding Scheme Is Base58
    
    [-] The Encoding Scheme Is Base92
    
    opened by mgp25 0
  • Fix base62 error and add Ascii85

    Fix base62 error and add Ascii85

    This fixes https://github.com/mufeedvh/basecrack/issues/4#issue-700623958 by replacing base-62 with pybase62. Uninstalling the old dependency before installing the new dependency is required.

    It also adds support for Ascii85 encoding.

    opened by klassiker 0
  • not a valid encoding

    not a valid encoding

    that message i got when try decode that

    rTjf5liz8DDISJm4b0w1dQC1gi/MGnC15wG7EfsfoCdOllQQN5+hxg40T96qGK7EkL3lYKdkrABFjscchJmDQYdvjkZhHrCDJVZIJz2H40Z0p6GXwIlMmzE5x3i0FYlvVlGbIWx2YLspMD+3grY/3IbgyAN9ZYHUMeB9rBNcTh+TDw==

    opened by a-gamer 0
  • the big base.......

    the big base.......

    hi

    I have a TXT document,It's about 13mb,There are various base encrypted contents

    when i use the basecrack decode the txt,It stops halfway through the operation

    How can I send the document to you.......

    opened by kisspanda 2
Releases(v4.0)
Owner
Mufeed VH
organized chaos.
Mufeed VH
Add your new words to a text file and get them randomly.

Memorize-New-Words In this very very very little project, I've wrote a code to memorize new english words. Therefore you can add the words and their m

Mostafa 2 Jul 04, 2022
A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

Derek Gulbranson 574 Dec 20, 2022
Hspell, the free Hebrew spellchecker and morphology engine.

Hspell, the free Hebrew spellchecker and morphology engine.

16 Sep 15, 2022
Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes.

Hotpotato Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes. It is a fullstack React App made with a Redux st

Nico G Pierson 13 Nov 05, 2021
A username generator made from French Canadian most common names.

This script is used to generate a username list using the most common first and last names in Quebec in different formats. It can generate some passwords using specific patterns such as Tremblay2020.

5 Nov 26, 2022
You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.

You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.

8 Dec 20, 2022
An extension to detect if the articles content match its title.

Clickbait Detector An extension to detect if the articles content match its title. This was developed in a period of 24-hours in a hackathon called 'H

Arvind Krishna 5 Jul 26, 2022
A collection of pre-commit hooks for handling text files.

texthooks A collection of pre-commit hooks for handling text files. In particular, hooks for handling unicode characters which may be undesirable in a

Stephen Rosen 5 Oct 28, 2022
Compute distance between sequences. 30+ algorithms, pure python implementation, common interface, optional external libs usage.

TextDistance TextDistance -- python library for comparing distance between two or more sequences by many algorithms. Features: 30+ algorithms Pure pyt

Life4 3k Jan 02, 2023
An implementation of figlet written in Python

All of the documentation and the majority of the work done was by Christopher Jones ([emai

Peter Waller 1.1k Jan 02, 2023
The project is investigating methods to extract human-marked data from document forms such as surveys and tests.

The project is investigating methods to extract human-marked data from document forms such as surveys and tests. They can read questions, multiple-choice exam papers, and grade.

Harry 5 Mar 27, 2022
一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。

一款高性能非法词(敏感词)检测组件,附带繁体简体互换,支持全角半角互换,获取拼音首字母,获取拼音字母,拼音模糊搜索等功能。

ToolGood 3.6k Jan 07, 2023
Skype export archive to text converter for python

Skype export archive to text converter This software utility extracts chat logs

Roland Pihlakas open source projects 2 Jun 30, 2022
A query extract python package

A query extract python package

Fayas Noushad 4 Nov 28, 2021
A python Tk GUI that creates, writes text and attaches images into a custom spreadsheet file

A python Tk GUI that creates, writes text and attaches images into a custom spreadsheet file

Mirko Simunovic 13 Dec 09, 2022
AnnIE - Annotation Platform, tool for open information extraction annotations using text files.

AnnIE - Annotation Platform, tool for open information extraction annotations using text files.

Niklas 29 Dec 20, 2022
Repository containing the code for An-Gocair text normaliser

Scottish Gaelic Text Normaliser The following project contains the code and resources for the Scottish Gaelic text normalisation project. The repo can

3 Jun 28, 2022
A production-ready pipeline for text mining and subject indexing

A production-ready pipeline for text mining and subject indexing

UF Open Source Club 12 Nov 06, 2022
box is a text-based visual programming language inspired by Unreal Engine Blueprint function graphs.

Box is a text-based visual programming language inspired by Unreal Engine blueprint function graphs. $ cat factorial.box ┌─ƒ(Factorial)───┐

Pranav 104 Dec 24, 2022
Bidirectionally transformed strings

bistring The bistring library provides non-destructive versions of common string processing operations like normalization, case folding, and find/repl

Microsoft 352 Dec 19, 2022