solved rainbow
This commit is contained in:
@ -3,7 +3,7 @@ import json
|
||||
import base64
|
||||
|
||||
# Fill in the right target here
|
||||
HOST = "localhost" # TODO
|
||||
HOST = "netsec.net.in.tum.de" # TODO
|
||||
# HOST = "localhost"
|
||||
PORT = 20204 # TODO
|
||||
|
||||
@ -27,12 +27,15 @@ def search_password(target_pass, rainbow_dict):
|
||||
return None
|
||||
|
||||
|
||||
def crack_hash(target):
|
||||
def crack_hash(targets):
|
||||
rainbow_dict = None
|
||||
with open("rainbow_table.json", "r") as f:
|
||||
rainbow_dict = json.load(f)
|
||||
hash_dict = decode_hash(rainbow_dict)
|
||||
return search_password(target, hash_dict)
|
||||
password = ""
|
||||
for target in targets:
|
||||
password += search_password(target, hash_dict) + ";"
|
||||
return password
|
||||
|
||||
|
||||
def get_flag():
|
||||
@ -54,17 +57,17 @@ def get_flag():
|
||||
sf.flush()
|
||||
output = sf.readline().rstrip("\n").split("Passwords do not match hashes ")[1]
|
||||
pos_pas = parse_list_string(output)
|
||||
password = crack_hash(pos_pas[0])
|
||||
print(f"Password found {password}")
|
||||
password = crack_hash(pos_pas)[:-1]
|
||||
print(f"accumulated the password as '{password}'")
|
||||
print(sf.readline().rstrip("\n"))
|
||||
print("inserted Username admin")
|
||||
sf.write("admin\n")
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip("\n"))
|
||||
print(f"inserted password '{password}'")
|
||||
print(f"inserted password '{password}")
|
||||
sf.write(f"{password}\n")
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip("\n"))
|
||||
print(sf.readline().rstrip("\n"))
|
||||
sf.close()
|
||||
s.close()
|
||||
|
||||
|
Reference in New Issue
Block a user