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
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
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
A working (ish) python script to convert text to a gradient.

verticle-horiontal-gradient-script A working (ish) python script to convert text to a gradient. This script is poorly made with the well known python

prmze 1 Feb 20, 2022
Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.

Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.

SeatGeek 1.2k Jan 01, 2023
Code Jam for creating a text-based adventure game engine and custom worlds

Text Based Adventure Jam Author: Devin McIntyre Our goal is two-fold: Create a text based adventure game engine that can parse a standard file format

HTTPChat 4 Dec 26, 2021
strbind - lapidary text converter for translate an text file to the C-style string

strbind strbind - lapidary text converter for translate an text file to the C-style string. My motivation is fast adding large text chunks to the C co

Mihail Zaytsev 1 Oct 22, 2021
Open-source linguistic ethnography tool for framing public opinion in mediatized groups.

Open-source linguistic ethnography tool for framing public opinion in mediatized groups. Table of Contents Installing Quickstart Links Installing Pyth

Qualichat 7 Jun 02, 2022
Python character encoding detector

Chardet: The Universal Character Encoding Detector Detects ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants) Big5, GB2312, EUC-TW, HZ-GB-2312, IS

Character Encoding Detector 1.8k Jan 08, 2023
Python port of Google's libphonenumber

phonenumbers Python Library This is a Python port of Google's libphonenumber library It supports Python 2.5-2.7 and Python 3.x (in the same codebase,

David Drysdale 3.1k Dec 29, 2022
A query extract python package

A query extract python package

Fayas Noushad 4 Nov 28, 2021
Amazing GitHub Template - Sane defaults for your next project!

🚀 Useful README.md, LICENSE, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, GitHub Issues and Pull Requests and Actions templates to jumpstart your projects.

276 Jan 01, 2023
Python tool to make adding to your armory spreadsheet armory less of a pain.

Python tool to make adding to your armory spreadsheet armory slightly less of a pain by creating a CSV to simply copy and paste.

1 Oct 20, 2021
A non-validating SQL parser module for Python

python-sqlparse - Parse SQL statements sqlparse is a non-validating SQL parser for Python. It provides support for parsing, splitting and formatting S

Andi Albrecht 3.1k Jan 04, 2023
CowExcept - Spice up those exceptions with cowexcept!

CowExcept - Spice up those exceptions with cowexcept!

James Ansley 41 Jun 30, 2022
This is an AI that is supposed to say you if your text is formal or not

This is an AI that is supposed to say you if your text is formal or not. It's written in Python 3 and has some german examples (because I'm german yk) in the text.json file. This file contains the te

1 Jan 12, 2022
py-trans is a Free Python library for translate text into different languages.

Free Python library to translate text into different languages.

I'm Not A Bot #Left_TG 13 Aug 27, 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
Search for terms(word / table / field name or any) under Snowflake schema names

snowflake-search-terms-in-ddl-views Search for terms(word / table / field name or any) under Snowflake schema names Version : 1.0v How to use ? Run th

Igal Emona 1 Dec 15, 2021
Make writing easier!

Handwriter Make writing easier! How to Download and install a handwriting font, or create a font from your handwriting. Use a word processor like Micr

64 Dec 25, 2022
Format Covid values to ASCII-Table (Only for Germany and Austria)

Covid-19-Formatter (Only for Germany and Austria) Dieses Script speichert die gemeldeten Daten des RKIs / BMSGPK und formatiert diese zu einer Asci Ta

56 Jan 22, 2022