-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdecipher.src
More file actions
125 lines (106 loc) · 3.49 KB
/
decipher.src
File metadata and controls
125 lines (106 loc) · 3.49 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// New decipher
// Handes inline user:hash or a txt file containing the users and hashes
// Uses a cache of cracked hashes for quick lookup in future
cryptools = include_lib("/lib/crypto.so")
if not cryptools then cryptools = include_lib(parent_path(program_path) + "/crypto.so")
if not cryptools then exit("Error: Missing crypto library")
help_info = "Usage: " + program_path.split("/")[-1] + " user:hash or .txt file
Can handle multiple inline hashes or txt files
Example: decipher georgankh.org:db2f350a3fd44f4e6ae5d4f2d4ccf3bf a.txt root:db2f350a3fd44f4e6ae5d4f2d4ccf3bf b.txt
"
if params.len < 1 then exit(help_info)
if params.len == 1 and (params[0] == "-h" or params[0] == "-help") then exit(help_info)
pc = get_shell.host_computer
// check for cache folder
cache_folder = home_dir + "/Config/hashcache"
if not pc.File(cache_folder) then
pc.create_folder(home_dir + "/Config", "hashcache")
pc.touch(cache_folder + "/", "cache.txt")
print("Created missing cache folder in " + cache_folder)
end if
// check for files in the cache folder
cache_files = pc.File(cache_folder).get_files
// if cache is empty, make a blank cache file
if cache_files.len == 0 then
pc.touch(cache_folder + "/", "cache.txt")
cache_files = pc.File(cache_folder).get_files
end if
if params.len == 1 then
input = params[0]
// check if input is a file
if input.indexOf(":") then is_file = false else is_file = true
if is_file then
file = pc.File(input)
if not file then exit("can't find " + input)
if not file.has_permission("r") then exit("can't read file. Permission denied")
if file.get_content.len == 0 then exit("decipher: file is empty")
work_list = file.get_content.split("\n")
else
work_list = input.split(" ")
end if
else if params.len > 1 then
work_list = []
for input in params
if input.indexOf(":") then is_file = false else is_file = true
if is_file then
file = pc.File(input)
if not file then exit("can't find " + input)
if not file.has_permission("r") then exit("can't read file. Permission denied")
if file.get_content.len == 0 then exit("decipher: file is empty")
work_content = file.get_content.split("\n")
for line in work_content
work_list.push(line)
end for
else
work_content = input.split(" ")
for line in work_content
work_list.push(line)
end for
end if
end for
end if
// load cache into memory
load_cache = function()
globals.cache = {}
for cache_file in cache_files
globals.cache_file = cache_file
globals.cache_file_content = cache_file.get_content
if cache_file_content != "" then
passwords = cache_file_content.split("\n")
for pass in passwords
if pass.len > 0 then
pass = pass.split(":")
cache[pass[0]] = pass[1]
end if
end for
end if
end for
end function
load_cache()
for i in range(0, work_list.len - 1)
test = work_list[i].split(":")
if test[0] and test[1] then
work = work_list[i].split(":")
user = work[0]
password = work[1]
if cache.hasIndex(password) then
password = cache[password]
else
decyphed_password = cryptools.decipher(password)
if not decyphed_password then
print("can't find the password")
continue
end if
if cache_file_content != "" then
z = cache_file.set_content(cache_file_content + char(10) + password + ":" + decyphed_password)
else
z = cache_file.set_content(password + ":" + decyphed_password)
end if
if z != 1 then exit(z)
password = decyphed_password
end if
load_cache()
work_list[i] = user + ":" + password
print(work_list[i])
end if
end for