-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPassCrack.py
48 lines (40 loc) · 1.13 KB
/
PassCrack.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import itertools
import numpy
def randomSearch(arr, key):
count = 0.0
for x in numpy.array(numpy.meshgrid(*arr)).T.reshape(-1, len(arr)):
combination = ''.join(x)
read = open("challenge2.txt", "r")
for word in read.read().split("\n"):
if combination == word:
if combination == key:
read.close()
return count
else:
if x[3] != "":
count += 1.5
read.close()
continue
else:
count += 1.0
read.close()
continue
else:
continue
return 0.0
# Create file of possible outcomes
# write.write(''.join(x) + "\n")
# not linear
# def linearSearch(arr, key):
# count = 0
#
# for x in itertools.product(*arr):
# if x[3] != "":
# count += 1.5
# else:
# count += 1
#
# if ''.join(x) == key:
# return count
#
# # # print(list(itertools.product(*M1)))