The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

Python programming course aimed at network professionals with little or no experience in coding. This hands-on training takes you from "Hello World!" to complex network applications in no time.

Save Time And Money By Writing Your Own Python Programs To Automate Daily Network Tasks.

During this course you will learn Python concepts which are relevant to your networking job and build some amazing tools:

1. A basic subnet calculator.
2. A script for pushing the same configuration on multiple devices at the same time via SSH (secured connection) or Telnet (unsecured connection).
3. A DHCP client simulator for testing DHCP services in your network.
4. A tool for collecting CPU and Memory information from routers and storing it in a MySQL database for further statistics.
5. An application for OSPF network discovery via SNMP, which finds all your OSPF routers and returns them in a nice map format.

Sounds unbelievable given your current programming experience? Well, it's true! How?

First, every Python key concept is explained in one or more video lectures, followed by a short quiz. Each video is filled with relevant examples, in a learn-by-doing fashion and the quizzes will help you consolidate the main ideas behind each topic.

After laying the foundation, we will dive right into the real-life networking scenarios and apply our knowledge to build 5 great network utilities.

Complete with working files, network topologies and code samples (in .pdf and .py formats), you will be able to work alongside me on each lecture and each application. I will provide a virtual machine with all the Python modules already installed and also the full code for each application, so you can start coding on the spot.

We will use emulated routers in GNS3 to test our apps in a network environment, so you can see the actual results of running your code.

I encourage you to take your networking job to a higher level of automation, thus allowing you to save time and take care of complex network issues or improvements.

Hop on the network programming train by enrolling in this course. Let's get started!

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by teodosiu_mc, 2015-05-31 03:19:41

Python Network Programming Ebook

Python programming course aimed at network professionals with little or no experience in coding. This hands-on training takes you from "Hello World!" to complex network applications in no time.

Save Time And Money By Writing Your Own Python Programs To Automate Daily Network Tasks.

During this course you will learn Python concepts which are relevant to your networking job and build some amazing tools:

1. A basic subnet calculator.
2. A script for pushing the same configuration on multiple devices at the same time via SSH (secured connection) or Telnet (unsecured connection).
3. A DHCP client simulator for testing DHCP services in your network.
4. A tool for collecting CPU and Memory information from routers and storing it in a MySQL database for further statistics.
5. An application for OSPF network discovery via SNMP, which finds all your OSPF routers and returns them in a nice map format.

Sounds unbelievable given your current programming experience? Well, it's true! How?

First, every Python key concept is explained in one or more video lectures, followed by a short quiz. Each video is filled with relevant examples, in a learn-by-doing fashion and the quizzes will help you consolidate the main ideas behind each topic.

After laying the foundation, we will dive right into the real-life networking scenarios and apply our knowledge to build 5 great network utilities.

Complete with working files, network topologies and code samples (in .pdf and .py formats), you will be able to work alongside me on each lecture and each application. I will provide a virtual machine with all the Python modules already installed and also the full code for each application, so you can start coding on the spot.

We will use emulated routers in GNS3 to test our apps in a network environment, so you can see the actual results of running your code.

I encourage you to take your networking job to a higher level of automation, thus allowing you to save time and take care of complex network issues or improvements.

Hop on the network programming train by enrolling in this course. Let's get started!

Keywords: python,python programming,network programming,python networking,networking

Python Programming for Real-Life Networking Use
- Udemy Course Ebook –

Python programming course aimed at network professionals with little or no experience
in coding. This hands-on training takes you from "Hello World!" to complex network
applications in no time.

Save Time And Money By Writing Your Own Python Programs To Automate Daily
Network Tasks!

During this course you will learn Python concepts which are relevant to your networking
job and build some amazing tools:

1. A basic subnet calculator.
2. A script for pushing the same configuration on multiple devices at the

same time via SSH (secured connection) or Telnet (unsecured connection).
3. A DHCP client simulator for testing DHCP services in your network.
4. A tool for collecting CPU and Memory information from routers and storing

it in a MySQL database for further statistics.
5. An application for OSPF network discovery via SNMP, which finds all your

OSPF routers and returns them in a nice map format.

Sounds unbelievable given your current programming experience? Well, it's true! How?

First, every Python key concept is explained in one or more video lectures, followed by
a short quiz. Each video is filled with relevant examples, in a learn-by-doing fashion and
the quizzes will help you consolidate the main ideas behind each topic.

After laying the foundation, we will dive right into the real-life networking scenarios and
apply our knowledge to build 5 great network utilities.

Complete with working files, network topologies and code samples (in .pdf and .py
formats), you will be able to work alongside me on each lecture and each application. I
will provide a virtual machine with all the Python modules already installed and also the
full code for each application, so you can start coding on the spot.

We will use emulated routers in GNS3 to test our apps in a network environment, so
you can see the actual results of running your code.

You will learn how to use Python in conjunction with Telnet, SSH, SNMP, MySQL,
Scapy. I will give you some code templates in this ebook. Enjoy!

Telnet with Python
#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 = telnetlib.Telnet(ip, TELNET_PORT, TELNET_TIMEOUT)

output = connection.read_until("name:", READ_TIMEOUT)
connection.write(username + "\n")

output = connection.read_until("word:", READ_TIMEOUT)
connection.write(password + "\n")
time.sleep(1)

#Setting terminal length for entire output - no pagination
connection.write("terminal length 0\n")
time.sleep(1)

#Entering global config mode
connection.write("\n")
connection.write("configure terminal\n")
time.sleep(1)

#Open user selected file for reading
selected_cmd_file = open(cmd_file, 'r')

#Starting from the beginning of the file
selected_cmd_file.seek(0)

#Writing each line in the file to the device
for each_line in selected_cmd_file.readlines():

connection.write(each_line + '\n')
time.sleep(1)

#Closing the file
selected_cmd_file.close()

#Test for reading command output
#output = connection.read_very_eager()
#print output

#Closing the connection

connection.close()

except IOError:
print "Input parameter error! Please check username, password and file name."

#Calling the Telnet function
open_telnet_conn(ip)

SSH with Python
#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.readlines()[0].split(',')[0]

#Starting from the beginning of the file
selected_user_file.seek(0)

password = selected_user_file.readlines()[0].split(',')[1]

#Logging into device
session = paramiko.SSHClient()

session.set_missing_host_key_policy(
paramiko.AutoAddPolicy())

session.connect(ip, username = username, password = password)

connection = session.invoke_shell()

#Setting terminal length for entire output - no pagination
connection.send("terminal length 0\n")
time.sleep(1)

#Entering global config mode
connection.send("\n")
connection.send("configure terminal\n")
time.sleep(1)

#Open user selected file for reading
selected_cmd_file = open(cmd_file, 'r')

#Starting from the beginning of the file
selected_cmd_file.seek(0)

#Writing each line in the file to the device
for each_line in selected_cmd_file.readlines():

connection.send(each_line + '\n')
time.sleep(2)

#Closing the user file
selected_user_file.close()

#Closing the command file
selected_cmd_file.close()

#Checking command output for IOS syntax errors
output = connection.recv(65535)

if re.search(r"% Invalid input detected at", output):
print "* There was at least one IOS syntax error on device %s" % ip

else:
print "\nDONE for device %s" % ip

#Test for reading command output
#print output + "\n"

#Closing the connection
session.close()

except paramiko.AuthenticationException:
print "* Invalid username or password. \n* Please check the username/password

file or the device configuration!"
print "* Closing program...\n"

#Calling the SSH function
open_ssh_conn(ip)

SNMP with Python
#!/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 nextCmd: nextCmd(authData, transportTarget, *varNames)
#The nextCmd method returns a tuple of (errorIndication, errorStatus, errorIndex,
varBindTable)

errorIndication, errorStatus, errorIndex, varBindNbrTable =
cmdGen.nextCmd(cmdgen.CommunityData(comm),

cmdgen.UdpTransportTarget((ip,

161)),

'1.3.6.1.2.1.14.10.1.3')

#print
cmdGen.nextCmd(cmdgen.CommunityData(comm),cmdgen.UdpTransportTarget((ip,
161)),'1.3.6.1.2.1.14.10.1.3')

#print varBindNbrTable

errorIndication, errorStatus, errorIndex, varBindNbrIpTable =
cmdGen.nextCmd(cmdgen.CommunityData(comm),

cmdgen.UdpTransportTarget((ip,

161)),

'1.3.6.1.2.1.14.10.1.1')

#print varBindNbrIpTable

errorIndication, errorStatus, errorIndex, varBindHostTable =
cmdGen.nextCmd(cmdgen.CommunityData(comm),

cmdgen.UdpTransportTarget((ip,

161)),

'1.3.6.1.4.1.9.2.1.3')

#print varBindHostTable

errorIndication, errorStatus, errorIndex, varBindHostIdTable =
cmdGen.nextCmd(cmdgen.CommunityData(comm),

cmdgen.UdpTransportTarget((ip,

161)),

'1.3.6.1.2.1.14.1.1')

#print varBindHostIdTable

Visit the course curriculum using the link below and check out the FREE lectures in
Sections 12-16 for a preview of what you are going to get from this course!

I encourage you to take your networking job to a higher level of automation, thus
allowing you to save time and take care of complex network issues or improvements.

Hop on the network programming train by enrolling in this course. Let's get started!

*** For the FULL course with LIFETIME ACCESS please SIGN UP using the link ***
*** The course also comes with a 64% DISCOUNT. Buy now to SAVE $48! ***
*** COUPON CODE: PYRLNET27CP ***
I'LL JUST CLICK HERE TO SIGN UP


Click to View FlipBook Version