Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ['200', '530', '540']
- ssh_conn.send('show running-config crypto map | i 200n')
- ssh_conn.send('show running-config crypto map | i 530n')
- ssh_conn.send('show running-config crypto map | i 540n')
- #!/usr/bin/env python
- import paramiko
- import time
- import re
- # Variables
- host = xxxx = 'xxxxx'
- # Create instance of SSHClient object
- ssh = paramiko.SSHClient()
- # Automatically add untrusted hosts
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- # Automatically add untrusted hosts
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- # initiate SSH connection
- ssh.connect('xxxxx', port=22, username='xxxx', password='xxxxx', look_for_keys=False, allow_agent=False)
- print "SSH COnnection established with %s" % host
- # Use invoke_shell to establish an 'interactive session'
- ssh_conn = ssh.invoke_shell()
- print "Interactive SSH session established"
- print "Give the name of the 3PPartnern"
- partner = raw_input('>')
- # Commands prompted
- ssh_conn.send('n')
- ssh_conn.send('enablen')
- time.sleep(.5)
- ssh_conn.send('xxxxxn')
- time.sleep(.5)
- ssh_conn.send("terminal pager 0n")
- time.sleep(.5)
- ssh_conn.send('show running-config crypto map | i ' + str(partner) + 'n')
- time.sleep(1)
- output = ssh_conn.recv(65535)
- print output
- crypto_list = re.findall("OUTSIDEMAP (d+) match",output)
- print crypto_list
- python IPSEC_config_attributes.py
- SSH COnnection established with XXXX
- Interactive SSH session established
- Give the name of the 3PPartner
- >XXXX
- Type help or '?' for a list of available commands.
- XXXX/pri/act>
- XXXX/pri/act> enable
- Password: ************
- XXXX/pri/act# terminal pager 0
- XXXX/pri/act# show running-config crypto map | i XXX
- crypto map OUTSIDEMAP 200 match address XXXX
- crypto map OUTSIDEMAP 530 match address XXXX
- crypto map OUTSIDEMAP 540 match address XXXX
- XXXX/pri/act#
- ['200', '530', '540']
- 200
- 530
- 540
- Logged out of device XXXXXXXX
Add Comment
Please, Sign In to add comment