10.2. Juniper $9 passwords Encryption/Decryption

Activities that can be done are:
  • Encrypt/Decrypt plain-text password string v/s Juniper $9$ encrypted string

  • Decrypt all $9$ passwords from juniper configuration. (creates a new file)

  • Mask all $9$ passwords from juniper configuration. (creates a new file)


10.2.1. Password encrypt ($9)

Steps Involved:

  • Import the juniper_encrypt() function from nettoolkit.

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

>>> from nettoolkit.pyNetCrypt import juniper_encrypt
>>> juniper_encrypt("welcome1234")
'$9$DDk5FCA0Rhrmf0IEyW8-VwYaZDikPTzji'                          ## Encrypted password string.

10.2.2. Password decrypt ($9)

Steps Involved:

  • Import the juniper_decrypt() function from nettoolkit.

  • Pass encrypted string as argument for the function

>>> from nettoolkit.pyNetCrypt import juniper_decrypt
>>> juniper_decrypt("$9$DDk5FCA0Rhrmf0IEyW8-VwYaZDikPTzji")
'welcome1234'                   ## Decrypted password string

10.2.3. Decrypt all $9 passwords from Juniper configuration file

Steps Involved:

  • Import the decrypt_doller9_file_passwords function from nettoolkit

  • First argument for the function is juniper configuration file name

  • Second argument for the function is new output file name

  • Output file will have all $9$ passwords decrypted

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

10.2.4. Mask all $9 passwords from juniper configuration file

Steps Involved:

  • Import the mask_doller9_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 $9$ password masked

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

Note

Refer Version Control log to see the version from where these features are made available.