最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

SecureCRTSecure7.0查看连接密码的步骤

IT圈 admin 33浏览 0评论

2024年4月15日发(作者:禾顺)

try:

return plain_('utf-16-le')

except UnicodeDecodeError:

raise(ValueError('Invalid Ciphertext.'))

class SecureCRTCryptoV2:

def __init__(self, ConfigPassphrase : str = ''):

'''

Initialize SecureCRTCryptoV2 object.

Args:

ConfigPassphrase: The config passphrase that SecureCRT uses. Leave it empty if config passphrase is not set.

'''

= b' 00' * _size

= (('utf-8')).digest()

def Encrypt(self, Plaintext : str):

'''

Encrypt plaintext and return corresponding ciphertext.

Args:

Plaintext: A string that will be encrypted.

Returns:

Hexlified ciphertext string.

'''

plain_bytes = ('utf-8')

if len(plain_bytes) > 0xffffffff:

raise OverflowError('Plaintext is too long.')

plain_bytes =

len(plain_bytes).to_bytes(4, 'little') +

plain_bytes +

(plain_bytes).digest()

padded_plain_bytes =

plain_bytes +

m(_size - len(plain_bytes) % _size)

cipher = (, _CBC, iv = )

return t(padded_plain_bytes).hex()

def Decrypt(self, Ciphertext : str):

'''

Decrypt ciphertext and return corresponding plaintext.

Args:

Ciphertext: A hex string that will be decrypted.

Returns:

Plaintext string.

'''

cipher = (, _CBC, iv = )

padded_plain_bytes = t(x(Ciphertext))

plain_bytes_length = _bytes(padded_plain_bytes[0:4], 'little')

plain_bytes = padded_plain_bytes[4:4 + plain_bytes_length]

if len(plain_bytes) != plain_bytes_length:

raise ValueError('Invalid Ciphertext.')

plain_bytes_digest = padded_plain_bytes[4 + plain_bytes_length:4 + plain_bytes_length + _size]

if len(plain_bytes_digest) != _size:

raise ValueError('Invalid Ciphertext.')

if (plain_bytes).digest() != plain_bytes_digest:

raise ValueError('Invalid Ciphertext.')

return plain_('utf-8')

if __name__ == '__main__':

import sys

def Help():

print('Usage:')

print(' [-v2] [-p ConfigPassphrase] ')

print('')

print(' "enc" for encryption, "dec" for decryption.')

print(' This parameter must be specified.')

print('')

print(' [-v2] Encrypt/Decrypt with "Password V2" algorithm.')

print(' This parameter is optional.')

print('')

print(' [-p ConfigPassphrase] The config passphrase that SecureCRT uses.')

print(' This parameter is optional.')

print('')

print(' Plaintext string or ciphertext string.')

print(' NOTICE: Ciphertext string must be a hex string.')

print(' This parameter must be specified.')

print('')

def EncryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Plaintext : str):

try:

if UseV2:

print(SecureCRTCryptoV2(ConfigPassphrase).Encrypt(Plaintext))

else:

print(SecureCRTCrypto().Encrypt(Plaintext))

return True

except:

print('Error: Failed to encrypt.')

return False

def DecryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Ciphertext : str):

try:

if UseV2:

print(SecureCRTCryptoV2(ConfigPassphrase).Decrypt(Ciphertext))

else:

print(SecureCRTCrypto().Decrypt(Ciphertext))

return True

except:

print('Error: Failed to decrypt.')

return False

def Main(argc : int, argv : list):

if 3 <= argc and argc <= 6:

bUseV2 = False

ConfigPassphrase = ''

2024年4月15日发(作者:禾顺)

try:

return plain_('utf-16-le')

except UnicodeDecodeError:

raise(ValueError('Invalid Ciphertext.'))

class SecureCRTCryptoV2:

def __init__(self, ConfigPassphrase : str = ''):

'''

Initialize SecureCRTCryptoV2 object.

Args:

ConfigPassphrase: The config passphrase that SecureCRT uses. Leave it empty if config passphrase is not set.

'''

= b' 00' * _size

= (('utf-8')).digest()

def Encrypt(self, Plaintext : str):

'''

Encrypt plaintext and return corresponding ciphertext.

Args:

Plaintext: A string that will be encrypted.

Returns:

Hexlified ciphertext string.

'''

plain_bytes = ('utf-8')

if len(plain_bytes) > 0xffffffff:

raise OverflowError('Plaintext is too long.')

plain_bytes =

len(plain_bytes).to_bytes(4, 'little') +

plain_bytes +

(plain_bytes).digest()

padded_plain_bytes =

plain_bytes +

m(_size - len(plain_bytes) % _size)

cipher = (, _CBC, iv = )

return t(padded_plain_bytes).hex()

def Decrypt(self, Ciphertext : str):

'''

Decrypt ciphertext and return corresponding plaintext.

Args:

Ciphertext: A hex string that will be decrypted.

Returns:

Plaintext string.

'''

cipher = (, _CBC, iv = )

padded_plain_bytes = t(x(Ciphertext))

plain_bytes_length = _bytes(padded_plain_bytes[0:4], 'little')

plain_bytes = padded_plain_bytes[4:4 + plain_bytes_length]

if len(plain_bytes) != plain_bytes_length:

raise ValueError('Invalid Ciphertext.')

plain_bytes_digest = padded_plain_bytes[4 + plain_bytes_length:4 + plain_bytes_length + _size]

if len(plain_bytes_digest) != _size:

raise ValueError('Invalid Ciphertext.')

if (plain_bytes).digest() != plain_bytes_digest:

raise ValueError('Invalid Ciphertext.')

return plain_('utf-8')

if __name__ == '__main__':

import sys

def Help():

print('Usage:')

print(' [-v2] [-p ConfigPassphrase] ')

print('')

print(' "enc" for encryption, "dec" for decryption.')

print(' This parameter must be specified.')

print('')

print(' [-v2] Encrypt/Decrypt with "Password V2" algorithm.')

print(' This parameter is optional.')

print('')

print(' [-p ConfigPassphrase] The config passphrase that SecureCRT uses.')

print(' This parameter is optional.')

print('')

print(' Plaintext string or ciphertext string.')

print(' NOTICE: Ciphertext string must be a hex string.')

print(' This parameter must be specified.')

print('')

def EncryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Plaintext : str):

try:

if UseV2:

print(SecureCRTCryptoV2(ConfigPassphrase).Encrypt(Plaintext))

else:

print(SecureCRTCrypto().Encrypt(Plaintext))

return True

except:

print('Error: Failed to encrypt.')

return False

def DecryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Ciphertext : str):

try:

if UseV2:

print(SecureCRTCryptoV2(ConfigPassphrase).Decrypt(Ciphertext))

else:

print(SecureCRTCrypto().Decrypt(Ciphertext))

return True

except:

print('Error: Failed to decrypt.')

return False

def Main(argc : int, argv : list):

if 3 <= argc and argc <= 6:

bUseV2 = False

ConfigPassphrase = ''

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论