This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer | |
import urllib,os,io | |
PORT_NUMBER = 80 #http port listening on | |
#Decode URL path from ISE GET request | |
def decode_path(path): | |
number=path.split("&to=")[1].split("&message=")[0] | |
message=path.split("&message=")[1].replace('+',' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import netmiko | |
from netmiko import SCPConn | |
import os,sys,commands,re | |
def check_md5(filename): | |
command = 'md5sum '+filename | |
o = commands.getoutput(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests, re | |
headers = { | |
'Accept': 'application/vnd.com.cisco.ise.identity.endpoint.1.0+xml', | |
} | |
file = open("endpoint.txt","r") ### file which contains list of endpoints to delete | |
a = file.read().splitlines() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests, getpass, re | |
## list of firewalls | |
firewalls_ip = [ | |
'192.168.0.201', | |
'192.168.0.202', | |
'192.168.0.203', | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from netmiko import ConnectHandler | |
### function which writes commands into device | |
def set_cmd(ip, username, password,commands): | |
# establish a connection to the device | |
ssh_connection = ConnectHandler( | |
device_type='cisco_ios', | |
ip=ip, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests, datetime | |
from lxml import etree | |
### list with firewalls_ip | |
firewalls_ip = [ | |
'192.168.0.201', | |
'192.168.0.202', | |
'192.168.0.203' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import napalm, re, datetime, os | |
path = os.getcwd() | |
try: | |
os.stat(path+'/backup_config') | |
except: | |
os.mkdir(path+'/backup_config') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import nmap, time | |
start_time = time.time() | |
def scan_subnet_for_ssh_cisco(subnet): | |
### Function scanning subnet with nmap (ports tcp/22, tcp/23) and finding cisco ios devices | |
### returning dictionary with ip address and connection method (telnet, ssh) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os,commands,requests, re | |
get_ver = 'uname -r' | |
get_arch = 'dpkg --print-architecture' | |
url = 'http://kernel.ubuntu.com/~kernel-ppa/mainline/' | |
#Check processor architecture | |
status,arch = commands.getstatusoutput(get_arch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from netmiko import ConnectHandler | |
import re | |
#here is list of cisco routers ip addresses | |
ip_list = ['192.168.174.101','192.168.174.102','192.168.174.103','192.168.174.104','192.168.174.105','192.168.174.106'] | |
#list where informations will be stored | |
devices = [] |