Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

how to get the root-authentication information via PYEZ

‎01-03-2018 07:34 PM

I am working on a validation process to get all the user information strings from my Juniper devices using pyez. Normal users are working fine but I stuck on the root-authentication part. Is there a example that how to get the encrypted string of the root-authentication use pyez?

2 REPLIES 2
Highlighted
Junos Automation (Scripting)

Re: how to get the root-authentication information via PYEZ

‎01-04-2018 09:07 AM

Hi

 

For example you can do it this way

 

from jnpr.junos import Device
from lxml import etree
with Device(host='X.X.X.X', user='lab', password='lab123') as dev:
    conf = dev.rpc.get_config(filter_xml=etree.XML('<configuration><system><root-authentication/></system></configuration>'))
    root_pw_hash = conf.findtext("system/root-authentication/encrypted-password")
    print(root_pw_hash)
Best Regards,
PK

Juniper Ambassador, Juniper Networks Certified Instructor,
JNCIE-SEC #98, JNCIE-ENT #393, JNCIE-SP #2253
Twitter: @JuniperTrain
GitHub: https://github.com/pklimai
[Juniper Authorized Education & Support in Russia]
Highlighted
Junos Automation (Scripting)

Re: how to get the root-authentication information via PYEZ

‎01-05-2018 11:35 AM

Hi Folks,

Just my 2 cents on this…

 

The below repository holds good amount of information…

 

https://github.com/e29441/pyez_example

 

 

 

-Python JNCIE 3X [SP|DC|ENT] JNCIP-SEC JNCDS 3X [ WAN | DC|SEC] JNCIS-Cloud JNCIS-DevOps CCIP ITIL
#Please mark my solution as accepted if it helped, Kudos are appreciated as well.