Created
May 18, 2017 13:13
-
-
Save shuax/bde23c7dfa10c00c176983428f42b3de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from array import array | |
with open("Assembly-CSharp.dll", "rb") as encrypted_file: | |
data = encrypted_file.read() | |
key = "*********" | |
S = list(range(256)) | |
j = 0 | |
out = [] | |
#KSA Phase | |
for i in range(256): | |
j = (j + S[i] + ord( key[i % len(key)] )) % 256 | |
S[i] , S[j] = S[j] , S[i] | |
#PRGA Phase | |
i = j = 0 | |
for char in data: | |
i = ( i + 1 ) % 256 | |
j = ( j + S[i] ) % 256 | |
S[i] , S[j] = S[j] , S[i] | |
out.append(char ^ S[(S[i] + S[j]) % 256]) | |
decrypted_text = array('B', out) | |
with open('Assembly-CSharp2.dll', 'wb') as decrypted_file: | |
decrypted_file.write(decrypted_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment