Created
June 14, 2023 16:53
-
-
Save xl00t/7ecc1606e8115093184f43e3363e2446 to your computer and use it in GitHub Desktop.
Stegsnow bruteforce script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
import threading | |
import sys | |
compressed = True | |
def try_password(threads_i, i, password, steg_file): | |
try: | |
print(' '*74+'\r'+f"[{i}] Thread {threads_i} try password : {password}", end='\r') | |
out = subprocess.check_output([f"stegsnow -p '{password.decode()}' {'-C' if compressed else ''} {steg_file}"], stderr=subprocess.STDOUT, shell=True) | |
if b'flag' in out: | |
print(f"[{i}] Thread {threads_i} found password : {password}", out) | |
except: | |
pass | |
def threads_handler(threads, threads_i, wordlist, steg_file): | |
for i in range(threads_i, len(wordlist), threads): | |
try_password(threads_i, i ,wordlist[i], steg_file) | |
def main(): | |
if len(sys.argv) != 4: | |
print('Usage: ./crack.py stegfile wordlist threads') | |
exit(1) | |
steg_file = sys.argv[1] | |
wordlist = open(sys.argv[2], 'rb').read().splitlines() | |
threads = int(sys.argv[3]) | |
print(f"Running bruteforce with {threads} threads.\n") | |
running_threads = [] | |
for j in range(threads): | |
t = threading.Thread(target=threads_handler, args=(threads, j, wordlist, steg_file,)) | |
t.daemon = True | |
running_threads.append(t) | |
running_threads[j].start() | |
try: | |
for thread in running_threads: | |
thread.join() | |
except KeyboardInterrupt: | |
sys.exit(1) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment