Skip to content

Instantly share code, notes, and snippets.

@wodim
Last active August 29, 2015 13:56
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 wodim/038b7863efb229d900bb to your computer and use it in GitHub Desktop.
Save wodim/038b7863efb229d900bb to your computer and use it in GitHub Desktop.
from base64 import b64decode
from Crypto.Cipher import AES
def descifra_ip(cookie, claveCifrado):
t = bytearray(b64decode(cookie))
k = bytearray(b64decode(claveCifrado))
v = b''
v2 = bytearray('\0' * 16)
v3 = b''
r = b''
k[24:] = t[0:8]
t = t[8:]
v = t[8:8+16]
aes = AES.new(buffer(k))
i = 0
while i < len(t):
v = t[i:i+16].rjust(16, '\0')
v3 = v[0:16]
v = bytearray(aes.decrypt(buffer(v)))
v = xor(v, v2)
v2 = v3[0:16]
r += v[0:16]
print str(i) + '\t' + repr(v)
i = i + 16
return r
def xor(str1, str2):
ret = bytearray(len(str1))
for i in range(len(str1)):
ret[i] = str1[i] ^ str2[i]
return ret
descifra_ip('93xJGQfvBp6tuYJogOfZoFgPRvvltNLaiZurZKTgi7QWHgTcIcWZCs5Q67Lu1Gv[Q4cfRnPczC5GhN[10bO09yjKYU2sBKR9FAaxuJQVfuEYDs4IJPSGy[5b8Fg1sH]wHaTI3BlyzaQ=', 'DKAE2jDQUpC4AvQgqTDRaniTBQCiMrDE1aNUBIuSnWCg')
print "---"
descifra_ip('qDWGIQ7rYc6wouq2adJXAW1DqZbJTc463Iv48om1TtrmQmig3truDaa[D71XoTcGSK34pSA7[VgQTuqECeE8jW8u9IJZeR4wO39ys6L[L[TWlnePO8FsJ15Zl2RcssDze0[o99JePKc8jaJShReYiBj2RC9XbVuKmPkvLLBw0l7G7gYrZZAZhL[rKsT3XtjwabNPu5eEsWeOL0txaGuckU[rx54T8nABVcKGcooa0c3ULJIEc0YfbeyUYBt5PrRPu1FjjUZcW]gHlAqT3c]icQAyRjvSAmhdMau5d4M2XZl[R7XCz12iFhdp6eW3Y6slCuMjSjKbJC9J6udW7yHkf64I6iXCzRVR[PAOxFAq44Nj5woPAqgGkQ==', 'DKAE2jDQUpC4AvQgqTDRaniTBQCiMrDE1aNUBIuSnWCg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment