Last active
March 6, 2018 03:11
-
-
Save nhanb/74542c36d3dcc5dde4e90b34437fb523 to your computer and use it in GitHub Desktop.
Kissmanga unobfuscated wrapKA() function
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
// Works with | |
// https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js | |
var input = 'mqE5Ec6bMuj1NMBmDOpSx0VBunV1Woj3jJ9/6VAhx6+El9bfvbhuRNIsjbkRWuvXrFTfCgZukx+MAHwkMN5VGolvTK/P24u4BOECXcLudQtgHLD5SKtSKHQeH1cthYMiOP40YKbPD0CtxpIVhCphdMpArArqhVFwdixEO/B+aIQAjHY355p+8AVwWvuSj6qSN79mBQ9ATkzCDvLdi0Y4V9yManh6/gbY/jSVZnvmJqAjgqRNUbTKrpkw90aReGYY'; | |
var iv = CryptoJS.enc.Hex.parse('a5e8e2e9c2721be0a84ad660c472c1f3'); | |
var key = CryptoJS.SHA256("034nsdfns72nasdasd"); | |
var r20 = CryptoJS.lib.CipherParams.create({ | |
ciphertext: CryptoJS.enc.Base64.parse(input) | |
}); | |
var plaintext = CryptoJS.AES.decrypt(r20, key, { | |
mode: CryptoJS.mode.CBC, | |
iv: iv, | |
padding: CryptoJS.pad.Pkcs7 | |
}); | |
var result = plaintext.toString(CryptoJS.enc.Utf8); | |
console.log(result) |
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
# Python port | |
from Crypto.Hash import SHA256 | |
from Crypto.Cipher import AES | |
from base64 import b64decode | |
input = 'mqE5Ec6bMuj1NMBmDOpSx0VBunV1Woj3jJ9/6VAhx6+El9bfvbhuRNIsjbkRWuvXrFTfCgZukx+MAHwkMN5VGolvTK/P24u4BOECXcLudQtgHLD5SKtSKHQeH1cthYMiOP40YKbPD0CtxpIVhCphdMpArArqhVFwdixEO/B+aIQAjHY355p+8AVwWvuSj6qSN79mBQ9ATkzCDvLdi0Y4V9yManh6/gbY/jSVZnvmJqAjgqRNUbTKrpkw90aReGYY' | |
iv = 'a5e8e2e9c2721be0a84ad660c472c1f3'.decode('hex') | |
sha = SHA256.new() | |
sha.update('034nsdfns72nasdasd') | |
key = sha.digest() | |
encoded = b64decode(input) | |
dec = AES.new(key=key, mode=AES.MODE_CBC, IV=iv) | |
result = dec.decrypt(encoded) | |
# unpad | |
result = result[:-ord(result[-1])] | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@cooperspencer Whoops sorry I missed the notification for your comment somehow. The gist was written for python2 since my project ran on Google App Engine which didn't support python3 at the time. FWIW there's a python3 implementation here: nhanb/fundoshi@b367807 . Not sure if it's working anymore though since I haven't touched the code for months.