91 - Entire application code .pdf Plus .py

############# Application #3 - Part #1 ############# #DHCP client simulator #In scapy interactive mode - DHCP packets: ''' 'Ether / IP / UDP 0.0.0.0:b...

34 downloads 44 Views 150KB Size

Recommend Documents

############# Application #5 - Part #1 ############# ''' Make the following configuration on each router in the network: configure terminal snmp-server community public RO ''' # Open a regular Linux terminal # Go to the folder containing the script,

############# Application #1 - Part #1 ############# import random import sys def subnet_calc(): try: print "\n" #Checking IP address validity while True: ip_address = raw_input("Enter an IP address: ") #Checking octets a = ip_address.split('.') if (

############# Application #4 - Part #1 ############# #Configure the permissions on the script first! 'chmod 755 script.py" #Make sure to have SSHv2 enabled and RSA 1024 bit key generated on every device! import MySQLdb as mdb import paramiko import t

#!/usr/bin/env python import telnetlib import threading import os.path import subprocess import time import sys #Checking IP address validity def ip_is_valid(): check = False global ip_list while True: #Prompting user for input ip_file = raw_input("E

############# Application #2 - Part #1 ############# import paramiko import threading import os.path import subprocess import time import sys import re #Checking IP address file and content validity def ip_is_valid(): check = False global ip_list whi

#Open SSHv2 connection to devices def open_ssh_conn(ip): #Change exception message try: #Define SSH parameters selected_user_file = open(user_file, 'r') #Starting from the beginning of the file selected_user_file.seek(0) username = selected_user_file

#Open telnet connection to devices def open_telnet_conn(ip): #Change exception message try: #Define telnet parameters username = 'teopy' password = 'python' TELNET_PORT = 23 TELNET_TIMEOUT = 5 READ_TIMEOUT = 5 #Logging into device connection = telnet

#!/usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen #SNMP function def snmp_get(ip): #Creating command generator object cmdGen = cmdgen.CommandGenerator() #Performing SNMP GETNEXT operations on the OSPF OIDs #The basic syntax of n