GithubHelp home page GithubHelp logo

hashpals / search-that-hash Goto Github PK

View Code? Open in Web Editor NEW
1.2K 21.0 91.0 3.59 MB

🔎Searches Hash APIs to crack your hash quickly🔎 If hash is not found, automatically pipes into HashCat⚡

License: GNU General Public License v3.0

Python 100.00%
hash hashcat john cracks hacking hacking-tool infosec tool cybersecurity

search-that-hash's Issues

Fix amazon DB

Currently, some of the hashcat command outputs are being directed to the amazon DB. We need to make sure it doesn't get mixed up.

[Cracking bcrypt hash] None: No such file or directory

Hi,

Came across the script on reddit, was trying to crack hash from HTB's delivery machine. Just before it proceeds there's an error saying None: No such file or directory

image


On Phonebook's web challenge:

image


Tested on Pop! OS 20.04 LTS:

┌──(umar_0x01@b0x)-[~/HTB]
└─$ cat /etc/*release
DISTRIB_ID=Pop
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Pop!_OS 20.04 LTS"
NAME="Pop!_OS"
VERSION="20.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
LOGO=distributor-logo-pop-os

Let me know if you need more details, the hashes, or if it's an error on my side.

Thanks!

Fix nitrgxen for the PyPi version

PyPi either doesn't include the .pem file with it, or something else is going wrong. We need to fix it so nitrxgen works with it.

Breaks on file input

❯ sth -vvv -g -f hash.txt
2021-02-28 10:45:25 Saturnus root[9275] DEBUG Updated logging level
2021-02-28 10:45:25 Saturnus root[9275] INFO Called config updater
2021-02-28 10:45:25 Saturnus root[9275] DEBUG Hashes are from file
2021-02-28 10:45:25 Saturnus root[9275] DEBUG Called NTH to get hash types
2021-02-28 10:45:25 Saturnus root[9275] INFO Returning config
2021-02-28 10:45:25 Saturnus urllib3.connectionpool[9275] DEBUG Starting new HTTPS connection (1): av5b81zg3k.execute-api.us-east-2.amazonaws.com:443
2021-02-28 10:45:26 Saturnus urllib3.connectionpool[9275] DEBUG https://av5b81zg3k.execute-api.us-east-2.amazonaws.com:443 "GET /prod/lookup HTTP/1.1" 200 907
Traceback (most recent call last):
  File "/home/hydra/.local/bin/sth", line 8, in <module>
    sys.exit(main())
  File "/home/hydra/.local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/hydra/.local/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/hydra/.local/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hydra/.local/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/hydra/.local/lib/python3.9/site-packages/search_that_hash/__main__.py", line 89, in main
    cracking_handler = handler.Handler(config)
  File "/home/hydra/.local/lib/python3.9/site-packages/search_that_hash/cracker/handler.py", line 21, in __init__
    self.sth_results, self.config = sth.Sth_api.crack(self, config)
  File "/home/hydra/.local/lib/python3.9/site-packages/search_that_hash/cracker/sth_mod/sth.py", line 27, in crack
    output = response.json()["body"]
KeyError: 'body'

Where

❯ cat hash.txt
$2b$12$SVInH5XmuS3C7eQkmqa6UOM6sDIuumJPrvuiTr.Lbz3GCcUqdf.z6

ToDo

  • Offliine mode
  • Accessible Mode
  • Typehints
  • Comments
  • Documentation
  • Possible Google search?
  • Documentation on adding APIS <---- VERY IMPORTANT
  • Exit when an API returns True
  • Colour scheme
  • Design README
  • Import Name-That-Hash and use it
  • Release on PyPi
  • Create Setuptools to release on AUR
  • Make it as an API <---- VERY IMPORTANT (writing tests will help with this)
  • Writie Tests
  • Create GitHub action to run tests

Function `perform_search` in `cracking.py` is doing too many things

The function is:

  • Running STH
  • Printing the output or appending it to greppable
  • Running all other APIs
  • printing the output or appending to greppable

It should look like this (imo):

  • Multi-thread called STH (note: store all found hashes for printing + greppable in one variable), if not greppable and if not all hashes to search have not been found in STH return to main()
  • In main print all that's found so far
  • multi-thread run all other APIs (a 2nd time).
  • Return to main with the one output variable
  • Either call Greppable or pretty print it depending on user args

greppable not working

Installed sth via pip
Command used to test:

  1. sth -t 279412f945939ba78ce0758d3fd83daa
  2. sth -t 279412f945939ba78ce0758d3fd83daa --greppable

I've attached a screenshot that will explain the issue! :)

image

Let the user decide which hash to crack

Assuming that hashcat cracking is very slow, present the user with an interface like:

  1. Bcrypt
  2. Sha256
  3. sha512

And let the user select which one to try first. Don't show this in greppable mode.

Error on certain hash input

sth -t "E4F070309AC20334B70C5EA9268CE4FC6438202D"
Traceback (most recent call last):
  File "c:\users\redacted\miniconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\redacted\miniconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\redacted\miniconda3\Scripts\sth.exe\__main__.py", line 7, in <module>
  File "c:\users\redacted\miniconda3\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\redacted\miniconda3\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\redacted\miniconda3\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\redacted\miniconda3\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\redacted\miniconda3\lib\site-packages\search_that_hash\__main__.py", line 83, in main
    cracking_handler.start()
  File "c:\users\redacted\miniconda3\lib\site-packages\search_that_hash\cracker\handler.py", line 31, in start
    return self.fast.fast_crack()
  File "c:\users\redacted\miniconda3\lib\site-packages\search_that_hash\cracker\fast_mode_mod\runner.py", line 24, in fast_crack
    self.results.extend(results)
TypeError: 'NoneType' object is not iterable```

Manual type inputs

Most databases use a single type of hash, if we manually input that single type we can search all hash APIs for that type and then just crack that one type :)

Unverified hahses

The APi can return something unverified, such as this:

image

NTH should ask the user "This is unverified (we can't prove that the hash == this plaintext). We can continue searching if you want? Y/N".

Use of optimised kernels

By default, the script uses the unoptimised kernels, by adding -O to:

command = f"cd {config['hashcat_folder']} && {config['hashcat_exe_name']} -a 0 -m {possible_type} {hash_formatted} {config['wordlist']}"

It should get an easy and free speed increase with the only draw back of a slightly reduced max plain length, typically from 255 to 32 characters

> hashcat -m 0 -w 4 -b --quiet
Hashmode: 0 - MD5

Speed.#1.........:  4996.0 MH/s (170.43ms) @ Accel:64 Loops:1024 Thr:1024 Vec:1

> hashcat -m 0 -w 4 -b --quiet -O
Hashmode: 0 - MD5

Speed.#1.........:  9154.5 MH/s (90.30ms) @ Accel:64 Loops:1024 Thr:1024 Vec:1

Nitrxgen doesn't work

http://www.nitrxgen.net/md5db/ is one of the third-party website/APIs and it currently doesn't work in STH. It works when visiting the URL in the browser, but it always says Failed when running STH. Run sth -t "5f4dcc3b5aa765d61d8327deb882cf99" --greppable for an example.

READTIMEOUT in STH fails

config = {'api': True, 'api_keys': {'STH': None}, 'greppable': True, 'hashcat': False, ...}

    def crack(config):
        to_del = []
        url = "https://av5b81zg3k.execute-api.us-east-2.amazonaws.com/prod/lookup"
        payload = json.dumps({"Hash": list(config["hashes"].keys())})
        headers = {"Content-Type": "application/json"}
    
        try:
            response = requests.request(
                "GET", url, headers=headers, data=payload, timeout=config["timeout"]
            )
>       except ReadTimeout:
E       NameError: name 'ReadTimeout' is not defined

search_that_hash/cracker/sth_mod/sth.py:23: NameError

Also, set it to 3 seconds -- 2 seconds seems to be breaking it :)

Windows Errors

If you want to use hashcat on windows you have to specify the PATH of where the hashcat binary is located,

Also, for the wordlist, we need to make it OS dependant as windows uses \ not /

Automatically rate limit requests made to third-party website/APIs

STH should automatically rate limit requests made to third-party website/APIs so ideally #67 doesn't happen. For example http://md5.my-addr.com says Using of our online md5 database is limited in time with 15-20 requests, otherwise IP will be blocked permanently. on their site. STH should not make a request if the rate limit has been reached for a specific website/API.

Detect if the user has been temporarily banned from a third-party website/API and display it

Some of the third-party website/APIs will temporarily ban your IP from inputting too many hashes in a day. STH should display this when it finds an error from a third-party website/API related to this.

An example is https://www.cmd5.org/, when it temporarily bans you it will output Please log in ! whenever you try to search any hash. STH should catch that error and say to the user that they were temporarily banned from that certain website.

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.