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
This repository contains scripts to control a RGB text fan attached to a Raspberry Pi.

RGB Text Fan Controller This repository contains scripts to control a RGB text fan attached to a Raspberry Pi. Setup The Raspberry Pi and RGB text fan

Luke Prior 1 Oct 01, 2021
A pipeline for making highlighted text stand-alone.

title emoji colorFrom colorTo sdk app_file pinned decontextualizer 📤 green gray streamlit main.py false Decontextualizer As a second step in improvin

Paul Bricman 26 Dec 17, 2022
Goblin-sim - Procedural fantasy world generator

goblin-sim This project is an attempt to create a procedural goblin fantasy worl

3 May 18, 2022
a python package that lets you add custom colors and text formatting to your scripts in a very easy way!

colormate Python script text formatting package What is colormate? colormate is a python library that lets you add text formatting to your scripts, it

Rodrigo 2 Dec 14, 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
PyNews 📰 Simple newsletter made with python 🐍🗞️

PyNews 📰 Simple newsletter made with python Install dependencies This project has some dependencies (see requirements.txt) that are not included in t

Luciano Felix 4 Aug 21, 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
WorldCloud Orçamento de Estado 2022

World Cloud Orçamento de Estado 2022 What it does This script creates a worldcloud, masked on a image, from a txt file How to run it? Install all libr

Jorge Gomes 2 Oct 12, 2021
An experimental Fang Song style Chinese font generated with skeleton-tracing and pix2pix

An experimental Fang Song style Chinese font generated with skeleton-tracing and pix2pix, with glyphs based on cwTeXFangSong. The font is optimised fo

Lingdong Huang 98 Jan 07, 2023
Adventura is an open source Python Text Adventure Engine

Adventura Adventura is an open source Python Text Adventure Engine, Not yet uplo

5 Oct 02, 2022
This project aims to test check if your RegExp are being matched by grep.

Bash RegExp This project aims to test check if your RegExp are being matched by grep. It's a local server that starts on the port 8080. It runs the se

Quatrecentquatre 1 Feb 28, 2022
Aml - anti-money laundering

Anti-money laundering Dedect relationship between A and E by tracing through payments with similar amounts and identifying payment chains. For example

3 Nov 21, 2022
A query extract python package

A query extract python package

Fayas Noushad 4 Nov 28, 2021
基于Pytex的数学建模工具,实现将md文件转换成pdf/tex文档的前后端

Pytex-for-MCM 基于Pytex的数学建模工具,实现将md文件转换成pdf/tex文档的前后端。

3 May 17, 2021
Implementation of hashids (http://hashids.org) in Python. Compatible with Python 2 and Python 3

hashids for Python 2.7 & 3 A python port of the JavaScript hashids implementation. It generates YouTube-like hashes from one or many numbers. Use hash

David Aurelio 1.4k Jan 02, 2023
Find a Doc is a free online resource aimed at helping connect the foreign community in Japan with health services in their native language.

Find a Doc - Localization Find a Doc is a free online resource aimed at helping connect the foreign community in Japan with health services in their n

Our Japan Life 18 Dec 19, 2022
Making simplex testing clean and simple

Making Simplex Project Testing - Clean and Simple What does this repo do? It organizes the python stack for the coding project What do I need to do in

Mohit Mahajan 1 Jan 30, 2022
An anthology of a variety of tools for the Persian language in Python

An anthology of a variety of tools for the Persian language in Python

Persian Tools 106 Nov 08, 2022
Map Reduce Wordcount in Python using gRPC

This project is implemented in Python using gRPC. The input files are given in .txt format and the word count operation is performed.

Divija 4 Dec 05, 2022