You've already forked greyhack
added decipherall script, made use of all File objects in rootshell
This commit is contained in:
35
source/decipherall.src
Normal file
35
source/decipherall.src
Normal file
@@ -0,0 +1,35 @@
|
||||
if params.len != 1 or params[0] == "-h" or params[0] == "--help" then
|
||||
current_program = get_shell.host_computer.File(program_path)
|
||||
exit "Usage: " + current_program.name + " <password file path>"
|
||||
end if
|
||||
|
||||
crypto = include_lib(current_path + "/crypto.so")
|
||||
if not crypto then exit("Unable to load crypto.so from " + current_path)
|
||||
|
||||
computer = get_shell.host_computer
|
||||
password_file = computer.File(params[0])
|
||||
if not password_file then
|
||||
password_file = computer.File(current_path + "/" + params[0])
|
||||
end if
|
||||
if not password_file then exit("Unable to find file: " + params[0])
|
||||
if password_file.is_folder then exit("Expected a file, not a folder")
|
||||
if not password_file.has_permission("r") then exit("Permission denied: " + password_file.path)
|
||||
|
||||
content = password_file.get_content
|
||||
if not content then exit("Unable to read: " + password_file.path)
|
||||
|
||||
found = 0
|
||||
for line in content.split(char(10))
|
||||
if line == "" then continue
|
||||
parts = line.split(":")
|
||||
if parts.len < 2 then continue
|
||||
user = parts[0]
|
||||
hash = parts[1]
|
||||
if user == "" or hash == "" then continue
|
||||
plain = crypto.decipher(hash)
|
||||
if not plain then continue
|
||||
print(user + ":" + plain)
|
||||
found = found + 1
|
||||
end for
|
||||
|
||||
if found == 0 then print("No passwords could be deciphered")
|
||||
Reference in New Issue
Block a user