10.1. Cisco type-7 key encryption/decryption

Activities that can be done are:
  • Encrypt/Decrypt plain-text password string v/s Cisco type-7 encrypted string

  • Decrypt all type-7 passwords from cisco configuration. (create a new file)

  • Mask all type-7, type-9 passwords from cisco configuration. (create a new file)


10.1.1. Password encrypt (type-7)

Steps Involved:

  • Import the encrypt_type7() function from nettoolkit.

  • Pass plain-text-password as string argument for the function

>>> from nettoolkit.pyNetCrypt import encrypt_type7
>>> encrypt_type7("Cisco1234")
'062506324f41584b5643'                          ## Encrypted password string.

10.1.2. Password decrypt (type-7)

Steps Involved:

  • Import the decrypt_type7() function from nettoolkit.

  • Pass plain-text-password as string argument for the function

>>> from nettoolkit.pyNetCrypt import decrypt_type7
>>> decrypt_type7("062506324f41584b5643")
'Cisco1234'                     ## Decrypted password string

10.1.3. Decrypt type7 passwords from cisco configuration file

Steps Involved:

  • Import the decrypt_file_passwords function from nettoolkit

  • First argument for the function is cisco configuration file name

  • Second argument for the function is new output file name

  • Output file will have all type-7 passwords decrypted

>>> from nettoolkit.pyNetCrypt import decrypt_file_passwords
>>> decrypt_file_passwords("input_file.log", "output_file.log")

10.1.4. Mask type7 passwords from cisco configuration file

Steps Involved:

  • Import the mask_file_passwords function from nettoolkit

  • First argument for the function is cisco configuration file name

  • Second argument for the function is new output file name

  • Output file will have all type7 and type9 password masked

>>> from nettoolkit.pyNetCrypt import mask_file_passwords
>>> mask_file_passwords("input_file.log", "output_file.log")

Note

These features are available in the package >= 0.0.14