Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created October 21, 2019 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CreateRemoteThread/98fec6fffb29c1a9c64fca8af1c9e35d to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/98fec6fffb29c1a9c64fca8af1c9e35d to your computer and use it in GitHub Desktop.
import sys
from Crypto.Cipher import AES
import base64
def encrypt(key, text):
s = ''
for i in range(len(text)):
s += chr((((ord(text[i]) - 0x20) + (ord(key[i % len(key)]) - 0x20)) % (0x7e - 0x20 + 1)) + 0x20)
return s
key1 = "SECCON"
key2 = "seccon2019"
text = sys.argv[1]
enc1 = encrypt(key1, text)
cipher = AES.new(key2 + chr(0x00) * (16 - (len(key2) % 16)), AES.MODE_ECB)
p = 16 - (len(enc1) % 16)
enc2 = cipher.encrypt(enc1 + chr(p) * p)
print(base64.b64encode(enc2).decode('ascii'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment