本组明文 = Decrypt(本组密文) ^ 上一组密文 A B C ========================================================= A = B ^ C A ^ A = 0; 0 ^ A = A C = A ^ A ^ C = B ^ C ^ A ^ C = A ^ B (即C = A ^ B ,即:上一组密文 = 本组明文 ^ Decrypt(本组密文) ) ascii('a') ^ C ^ A ^ B = ascii('a') ^ A ^ B ^ A ^ B = ascii('a') ^ 0 = ascii('a') (假设我们想要翻转成a,使用如上公式即可,即:想要的字符 = 上一组密文 ^ 本组明文 ^ Decrypt(本组密文) ^ 想要的字符 )
r2 = requests.get(url,cookies=new_cookies) plain = base64.b64decode(re.findall("decode\('(.*)'\)",r2.text)[0]) iv = base64.b64decode(urllib.unquote(new_cookies["iv"])) old = plain[:len(iv)] new = 'a:2:{s:8:"userna' new_iv = "".join([chr(ord(iv[i])^ord(old[i])^ord(new[i])) for i in xrange(16)]) new_cookies["iv"] = urllib.quote_plus(base64.b64encode(new_iv))