import json
from base64 import b64encode, b64decode
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad


class ShanHuZhuFuAes:
    def __init__(self):
        self.key = 'xlc2ze7qnqg8xi1d'.encode('utf-8')  # 需要一个bytes类型的key
        self.iv = self.key  # 在这个例子中，key和iv是相同的

    def encrypt(self, data):
        cipher = AES.new(self.key, AES.MODE_CBC, self.iv)
        ct_bytes = cipher.encrypt(pad(data.encode('utf-8'), AES.block_size))
        ct = b64encode(ct_bytes).decode('utf-8')
        return ct

    def decrypt(self, data):
        try:
            ct = b64decode(data.encode('utf-8'))
            cipher = AES.new(self.key, AES.MODE_CBC, self.iv)
            pt = unpad(cipher.decrypt(ct), AES.block_size)
            return pt.decode('utf-8')
        except Exception as e:
            print("Incorrect decryption")
            return None


if __name__ == '__main__':
    cr = {
        "code": 1,
        "info": "",
        "data": "e3Dze+eLj8b4RfUh8Hucja+OFpo79AkOYWC5M2MbEML3hnwQ6JDkHiTS0mebuTt\/JcS2cb53KcpkARDDRlAoiWKtxHLr\/HjTH1SKFRr3rabSlp\/Kjdh\/CEsoD65FYB39Ic2hgd316gS1RX6vIg1\/wRtOuHpY5UJU0JaImYXKPDd0r9C1\/Tx3FWox8RhwOy6azcGNA60TQSbrelvUxuXzb1URIW1n5CjvfejmymAEfi90CZQQYRs+WIsBVS8iNUedfj0yDyBIlWnd3Wc9Xn9ZtjCp1hUyctovAEviNq\/wpHRsdOO8UmAujKjlooajLKLVmPeh1\/\/D+1Sv+JkJ+aAs5D7hiYMZXcX9vZYMCgKp1zhSIhq3sT1SUfiQ9AXJimBwzYDQPnb4pj3OSEIWm\/Iu2KRx2yg0QfvuAyR5qfNFbP7JwEp2pj8d0cCH7kiv32co8JyXowiVqA3smslWyRZeEfCt5W3zG4jsVlOAb6Bt\/vOMhQTzq7WiF+dnhm3CXaEgqvSVo8lu7RZRa2onj+25dg2clhVAG1a6ZOkOjrgV48EVXbGzAT\/VnG\/Dl9dDzxkG8KvXDRBxEDzgPscc08mozc0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AV94JOXwg0v82uGCbWKdx7xw6p\/gVK+33760cFYD2X8I8rE7nWw\/ilVuaLQ0JbxQnnydLsbpNOMlvnrFHh5Fq5snbRWfs9xJ5uzkDNlW4vC1RGjyMz\/KR9I2vLAqrWGbAndloH5kJyhT0ZAwDYodtGxg2c6q94omkFG9DKJjOzAe+GZz297tAVw1BIrIRryHq5qckoiw=="
    }
    A = ShanHuZhuFuAes()
    w = A.decrypt(cr['data'])
    a = json.loads(w)
    print(json.dumps(a, indent=4, ensure_ascii=False))
