Created
November 20, 2014 22:50
-
-
Save adamwalz/ef9b46949722f1444cf5 to your computer and use it in GitHub Desktop.
VPN Shared Secret decoder for networkConnect files
Inspired by your code, and given the fact that if A ^ B = C, then C ^ B = A, or C ^ A = B. I wrote the following code attempting to generate the crypto text. However, I only get similar crypto code. It seems Apple put some rand data at the tail of the crypto text. So do you have idea how to generate exactly the same crypto code? Thanks.
#!/usr/bin/python
import sys
import base64
cleartext = sys.argv[1]
decryption_key = [0x7d, 0x89, 0x52, 0x23, 0xd2, 0xbc, 0xdd, 0xea, 0xa3, 0xb9, 0x1f]
i = 0
cryptotext = ""
for ch in cleartext:
b = ord(ch) ^ decryption_key[i]
cryptotext += chr(b)
i += 1
i = i % len(decryption_key)
result = base64.b64encode(cryptotext)
print("Shared Secret: %s" %(result))
It seems the clear text string's length needs to be a multiple of 12. Filling the remaining characters with null bytes worked for me.
#!/usr/bin/python
import sys
import base64
cleartext = sys.argv[1]
while len(cleartext) % 12 != 0:
cleartext += chr(0x00)
decryption_key = [0x7d, 0x89, 0x52, 0x23, 0xd2, 0xbc, 0xdd, 0xea, 0xa3, 0xb9, 0x1f]
i = 0
cryptotext = ""
for ch in cleartext:
b = ord(ch) ^ decryption_key[i]
cryptotext += chr(b)
i += 1
i = i % len(decryption_key)
result = base64.b64encode(cryptotext)
print("Shared Secret: %s" %(result))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the algorithm to generate the cryptotext from the clear text?