-
Notifications
You must be signed in to change notification settings - Fork 1
/
brute.py
34 lines (24 loc) · 1.01 KB
/
brute.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os, subprocess
brute_dir = os.path.dirname(os.path.abspath(__file__))
brute_filename = 'joaat-brute-1-simple.exe'
brute_executable_filepath = os.path.sep.join([brute_dir, brute_filename])
def brute(*args):
args = [brute_executable_filepath] + list([str(x) for x in args])
try:
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
ret = subprocess.check_output(args, stderr=subprocess.STDOUT, universal_newlines=True, startupinfo=startupinfo)
args.pop(0)
if len(args) > 2:
result = {}
for i, reversed in enumerate(ret.split("\n")):
if reversed.strip():
result[args[i*2+1]] = reversed;
return result
else:
return ret.strip()
except subprocess.CalledProcessError as e:
print("CalledProcessError: %s" % e.__dict__)
# print(brute('', '0x12345', 'bonus_', 0x12345))