Skip to content

Instantly share code, notes, and snippets.

@NullArray
Created April 27, 2021 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NullArray/d6aef3fe33ca142130a3648a0d990ed1 to your computer and use it in GitHub Desktop.
Save NullArray/d6aef3fe33ca142130a3648a0d990ed1 to your computer and use it in GitHub Desktop.
Quick wrapper for THC-Hydra could use somework.
#!/usr/bin/env python3
#____ ____ __
#\ \ / /____ _____/ |_ ___________
# \ Y // __ \_/ ___\ __\/ _ \_ __ \
# \ /\ ___/\ \___| | ( <_> ) | \/
# \___/ \___ >\___ >__| \____/|__|
# \/ \/
#----Authored by Vector/NullArray
##############################################
import os
import sys
import time
import random
TOTAL_LINES = 0
MAX_LINES = 50000000
def names():
NEW = ['A1','B1','C1','D1','A2','B2','C2','D2']
while True:
name = "output" + random.choice(NEW) + ".txt"
if not os.isfile(name):
return name
def lists_processing(f_path=''):
if f_path == '':
return print("[!] No path specified")
elif f_path != '':
try:
with open('r', f_path) as infile:
infile.read()
except IOError:
return print("[!] Invalid path specified")
for i in xrange(MAX_LINES):
for lines in infile:
TOTAL_LINES +=1
if TOTAL_LINES >= MAX_LINES or TOTAL_LINES == MAX_LINES:
n = names()
try:
os.system("tail -n " + MAX_LINES + " " + f_path + " >> " n)
except Exception as e:
print("[!] Operation Failed")
time.sleep(2)
sys.exit(e)
continue
else:
return "True"
def main(targets='',user='',passw=''):
os.system("hydra -l" + user +" -P " + passw + " -M " + targets)
if __name__ == '__main__':
targets=input("[+] Path to target list.")
if os.isfile(targets):
print("[+] List found")
else:
print("[!] List not found")
sys.exit(0)
user=input("[+] Path to user list.")
if os.isfile(user):
print("[+] List found")
else:
print("[!] List not found")
sys.exit(0)
while True:
passw=input("[+] Path to password list.")
if os.isfile(passw):
print("[+] List found")
print("[+] Checking length, auto resolving...")
a = lists_processing(passw)
if "path" in a:
print("[!] List not found")
sys.exit(0)
elif "True" in path:
print("[+] Lists found and resolved.\nShowing new lists if applicable.")
os.system("ls *.txt")
q=input("[+] Enter new password file? [Y/n or Q to Quit]: ").lower()
if 'y'in q:
passw=input("[+] Path to password list.")
main(targets,user,passw)
elif 'n' in q:
main(targets,user,passw)
elif 'q' in q:
print("[!] Quitting...")
sys.exit(0)
else:
print("[!] Unhandled Option")
sys.exit(0)
else:
print("[!] List not found")
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment