Giter Site home page Giter Site logo

mufeedvh / basecrack Goto Github PK

View Code? Open in Web Editor NEW
499.0 12.0 89.0 3.57 MB

Decode All Bases - Base Scheme Decoder

Home Page: https://basecrack.herokuapp.com

License: MIT License

Python 99.03% Dockerfile 0.97%
python tool decode decoder encoder-decoder base base16 base32 base58 base64

basecrack's Introduction

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(Fp@nNG6ef<,*TFE]IT^zdINAb9EVbp,e<u=O6nN)/u+MTnU;Fo#VvQ&cK;mLZI#Jbdook<O{W#+gY%ooe#6pTkTa.9YPU8Uc=pl9BhSM9%kISw2k:8..u/6F2BwNndPZ2o#7NHNP3g,HlZu><*[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.

basecrack's People

Contributors

clevrf0x avatar jamesconlan96 avatar klassiker avatar mgp25 avatar mufeedvh avatar tibinsunny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

basecrack's Issues

Just clone to kali and it cannot be used.

pip, pip3, and pipx cannot successfully install the corresponding python packages and modules
After downloading the tool, it cannot be used. It is recommended to add the corresponding python library installation information to the project.

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.......

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.

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'

对一些有特殊字符的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

python basecrack.py -h fail

Traceback (most recent call last):
File "basecrack.py", line 11, in
from termcolor import colored
ImportError: No module named termcolor

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.

When can you support base38?

Matter is using base38 to encode the setup payload. If this library can support base38, it would be wonderful.

a base32 bug

[-] Encoded Base: MZWGCZ33GQZTQMTEM5SGMMTEPU=====

[!] Not a valid encoding.

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的模块

A suggestion

In file base_chain.py line 88, I suggest to change the code
base64.b16decode(encoded_base, casefold=False).decode('utf-8', 'replace')
to
base64.b16decode(encoded_base.upper(), casefold=False).decode('utf-8', 'replace')

not a valid encoding

that message i got when try decode that

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

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).

Include new feature

Are you interested in including Base100 to your work? Or you regard it as a king of trick that differs from traditional base codes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.