Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (32 sloc) 1.5 KB
from Crypto.Cipher import ARC4
from base64 import b64decode
import sys
import re
def chinese2b64(m):
m = m.replace(" ","")
m = re.findall("苏尔的开始(.*)苏尔苏尔完",m)
if len(m) == 0:
return False
m = m[0]
s = ["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Z", "X", "C", "V", "B", "N", "M", "q", "w", "e", "r", "y", "u", "i", "o", "p", "a", "s", "d", "f", "g", "h", "j", "k", "l", "z", "x", "c", "v", "b", "n", "m", "=", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
t = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
for i,v in enumerate(s):
m = m.replace(t[i],s[i])
return m
def b64toC2(b64,key):
try:
data = b64decode(b64)
except:
return False
if data == "":
return False
rc4 = ARC4.new(key)
data = data.decode("utf-8")
dec = rc4.decrypt(bytes.fromhex(data)).decode("utf-8")
print(dec)
if __name__ == "__main__":
if len(sys.argv) != 3:
print('Usage : dec.py "chinesechars" "key"')
b64 = chinese2b64(sys.argv[1])
if b64:
b64toC2(b64,sys.argv[2])
You can’t perform that action at this time.