I want to figure out a way to create a script to look at the Session Hostname in SecureCRT, and lookup the IP Address in the Excel File next to the Hostname in the Excel file, then run the script that I am doing above. I have a Master Excel file that has the 1200 Hostnames and the IP Addresses of the Element IP Address. 1200 of them.Įach of the 1200 sessions are by the Hostname separated by State and City. Now I have to basically repeat this script 1200 times each with the Element IP Address for the particular element choice. I created a script that Goes to the option of allowing me to enter the Element by IP Address. This service them lets me pick what network element I want to login to. Python SecureCRTCipher.Each of the 1200 all login to the same service. Return 0 if DecryptionRoutine(bUseV2, ConfigPassphrase, argv) else - 1 Return 0 if EncryptionRoutine(bUseV2, ConfigPassphrase, argv) else - 1 Print( 'Error: ConfigPassphrase is not supported if "-v2" is not specified') If bUseV2 = False and len(ConfigPassphrase) != 0: Print(SecureCRTCrypto().Decrypt(Ciphertext))Įlif argv.lower() = '-p' and i 1 < argc - 1: Print(SecureCRTCryptoV2(ConfigPassphrase).Decrypt(Ciphertext)) Print(SecureCRTCrypto().Encrypt(Plaintext))ĭef DecryptionRoutine( UseV2 : bool, ConfigPassphrase : str, Ciphertext : str): Print(SecureCRTCryptoV2(ConfigPassphrase).Encrypt(Plaintext)) Print( ' NOTICE: Ciphertext string must be a hex string.')ĭef EncryptionRoutine( UseV2 : bool, ConfigPassphrase : str, Plaintext : str): Print( ' Plaintext string or ciphertext string.') Print( ' The config passphrase that SecureCRT uses.') Print( ' Encrypt/Decrypt with "Password V2" algorithm.') Print( ' This parameter must be specified.') Print( ' "enc" for encryption, "dec" for decryption.') If SHA256.new(plain_bytes).digest() != plain_bytes_digest: If len(plain_bytes_digest) != SHA256.digest_size: If len(plain_bytes) != plain_bytes_length: Plain_bytes_length = int.from_bytes(padded_plain_bytes, 'little') Padded_plain_bytes = crypt( omhex(Ciphertext)) Return cipher.encrypt(padded_plain_bytes). Os.urandom(AES.block_size - len(plain_bytes) % AES.block_size)Ĭipher = AES.new(self.Key, AES.MODE_CBC, iv = self.IV) Len(plain_bytes).to_bytes( 4, 'little') \ Raise OverflowError( 'Plaintext is too long.') hex()ĭecrypt ciphertext and return corresponding plaintext.Ĭiphertext: A hex string that will be decrypted.Ĭiphered_bytes = omhex(Ciphertext) Return cipher1.encrypt(os.urandom( 4) cipher2.encrypt(padded_plain_bytes) os.urandom( 4)). Padded_plain_bytes = plain_bytes os.urandom(Blowfish.block_size - len(plain_bytes) % Blowfish.block_size)Ĭipher1 = Blowfish.new(self.Key1, Blowfish.MODE_CBC, iv = self.IV)Ĭipher2 = Blowfish.new(self.Key2, Blowfish.MODE_CBC, iv = self.IV) Plain_bytes = Plaintext.encode( 'utf-16-le') Plaintext: A string that will be encrypted.
0 Comments
Leave a Reply. |