Classes are held cyclically, so you can learn as you go

Python course introduction

Classes open on a recurring basis, study as you go

l Course introduction

Knowledge module

Class hours

Homework



Python basic course

24

16


Implementation and automation of classic network protocols

18

15


Django web development

12

10


Intensive class DevNet

12

10


Open source automation software

6

5


Network automation operation and maintenance system development

3

0


 

 

 

 


 

courses

 

Class hours

 

Homework

 

 

Part one

Python basic course weekend class [3.5 (all day on weekends), 3.12 (all day on weekends), 3.19 (afternoon), 3.20 (afternoon)]

 

 

 

4*6=24 class hours

 

16 assignments: 3.5; 3.7-11; 3.14-18; 3.21-25

 

 

 

part two

DevNetOps/DevSecOps network classic protocol implementation and automation [3.28-29 (evening shift), 4.4-5 (evening shift), 4.9 (afternoon)]

 

 

6*3=18 class hours

 

 

 

15 assignments: 3.28-4.1; 4.4-4.8; 4.11-15

 

 

 

part three

DevNetops/DevSecOps Django web development [4.18-19 (evening shift), 4.23 (afternoon)]

 

 

 

3*4=12 class hours

 

 

10 assignments: 4.18-22;4.25-29

 

 

 

Part 4

DevNetOps/DevSecOps intensive class DevNet (original HTTP protocol) [5.2-3 (evening shift), 5.7 (afternoon)]

 

 

 

3*4=12 class hours

 

10 assignments: 5.2-6;5.9-5.13

 

 

 

Part 5

DevNetOps/DevSecOps open source automation software (formerly Ansible Zabbix ELK) [5.14 (pm), 5.15 (pm)]

 

 

 

1*6=6 class hours

 

 

 

5 assignments: 5.16-20

 

 

 

Part Six

DevNetOps/Dev Secops network automation operation and maintenance system development [5.21 (afternoon)

 

 

1*3=3 class hours

 


A total of 56 assignments and 75 class hours

 

l Lecturer introduction

Qin Ke-- -Qin Ke CCIE#13778

•Graduated from: Beijing Institute of Technology

•Worked at Chongqing Telecom

•Cisco Security, PYTHON lecturer

• More than 20 years of teaching and problem-solving experience

•Professional training for Bank of China, Chongqing Telecom, China Mobile, Bank of Beijing, Cisco Community and other enterprises

•In-depth development and research of more than 200 online courses and more than 100 shared videos, which no one has surpassed so far

•Have personally led 1,193 security CCIE people and 137 DC CCIE people

•Take the lead in establishing DC CCIE laboratory, Asia PASS DC

CCIE first person

• Strong logical thinking ability, all courses are independently developed, and the class style is humorous and well received. It has published the first "CISCO IPSE VPN Practical Guide" in the industry with the People's Posts and Telecommunications Publishing House.

 

 

l Course details

Part one:

1. Introduction to Python language

TIOBE Index for October 2021 Python application areas

Python Philosophy Language Types

FTP Code Examples                                                                                                                                                                                                                                                                                         having Python to Have Been to Become More Python

 

2. Python environment installation

2.1Install Python3 and pip under Windows

Install Python3 (Windows) Test Python3

Test pip and easy_install pip installation module

 

2.2 Install Python3 and pip under CentOS

Install Python3 (CentOS7 &8) Test Python3

Test pip3 download module

 

2.3 Basic operations of pycharm

Video tutorial

 

2.4Python documentation

Local Documentation Online Documentation

Python module comes with help Python module introduction document

PycharmView documentation

 

3. Python built-in type: number

Panorama view in Python Why use built-in objects

Built-in objects Object classification

Basic Numeric Constants Built-in Numeric Tools

Expression operator precedence Four arithmetic operations on numbers

Type conversions Built-in math functions

Random Module Classroom Exercises

 

4. Python built-in types; strings and regular expressions

Object Classification String Constants and Expressions

Single quotes, double quotes, triple quotes and examples String backslash characters and examples

Raw string suppresses escaping Basic string operations

Introduction to For Loops Indexing and Slicing

String Conversion Tool Modify String

String methods and cases String formatting expressions and methods

String formatting type code Simple example of string formatting expression

Complete syntax for formatted string expression Advanced example of formatted string expression

String formatting method format introduction                                                                                                                                                                                             , , none you you need to be

Advanced example of string formatting method Format string f-string

Class Exercises Introduction to Regular Expressions

Regular expression: 1: Escape character Regular expression: 2: Various characters

Regular expression: 3: Customize multiple characters Regular expression: 4: Number of matches

Regular expression: 5: Represents abstract meaning Regular expression: 6: Expression relationship

RE test: 1 RE test: 2

RE Test: 3 Classroom Exercises

 

5. Python built-in types: lists and dictionaries

Object Classification List Main Attributes

Common list constants and operations Basic list operations

Iteration and parsing Indexing and sharding

Matrices and Nested List Method Calls

Quote vs copy List reference issues

copy vs deepcopy Using collections to remove duplicate entries

Classroom Exercises Main Properties of Dictionaries

Dictionary constants and operations Basic dictionary operations

Modify dictionary in place Dictionary GET

Dictionary UPDATE Dictionary POP

Methods of traversing and printing a dictionary Precautions for dictionary usage

ZIP creates dictionary                                           Dictionary analysis

Ordered dictionary (rarely used after 3.6) Classroom exercises

 

 

 

6. Python built-in types: tuples and files

Object Classification Tuple Main Attributes

Tuple constants and operations Creating tuples

Basic operations on tuples Conversion and sorting of tuples

Analysis of tuples Tuple INDEX and COUNT

Modification of the internal list of tuples Common file operations

Open Files Working with Files

Write and read the file line by line Read the file in its entirety and print

File iterator (best choice) File location

Rename and delete files Create directories, switch directories, delete directories

Class exercises

 

7. Python statements and syntax; assignment

Python program structure Python statements

Assignment statement Assignment statement form

Sequence assignment Iterative assignment

Extended Sequence Unpacking Multiple Assignment and Problems

Enhanced assignment Variable name rules

Expression statements Expression statements and in-place modifications

 

8. Python statements and syntax; printing

Print function of Python3.0 Basic operations of Print

The sep option of Print The end option of Print

Print's file options

stdout

 

9. Python statements and syntax if statements

Introduction to if statement                                                                                                                           Common format of if statement

Simple example of if statement Logical AND or NOT, ternary selection expression

Comparison Operations Python Grammar Rules

Determining blocks by indentation If/else ternary expressions

Class exercises

 

10. Python statements and syntax while and for loops

While Loop General Format While Loop Example

Break, cotinue, pass and loop else Pass does nothing

Continue skips this and executes the next loop. Break jumps out of the entire loop.

Classroom exercise                                      General syntax of a for loop

for loop example classroom exercises

 

11. Python function

What is a function? Not using modules and functions results in a lot of code redundancy

Module and function optimization of code Program, module and function flow diagram

Function-related statements and expressions def statement format

def the first example def the second example

Global variables and function local variables Modify global variables

Generate global variables and function parameter matching table

Parameter example Function control input and output type

Install kamene Classroom Exercises

Install paramiko Class practice

 

12. Python module

Why use modules Python program architecture

Module search path sys.path

Create a module Create the first module

Module usage (import) testing

Module usage (from) Testing

Module usage (from *) Testing

Import variable case test

Directory+__init__.py

Module reload If __name__== ‘__main__’

Test If __name__== ‘__main__’ Decorator

Decorator Examples Classroom Exercises

 

13.Python class

Two design ideas for programs - process-oriented (logic map)

How does the process-oriented (device polling) class work?

Characteristics of the class Initializing the class - adding attributes

Add behavior - add data processing logic Add inheritance

Polymorphic Encapsulation - before modifying the method

Encapsulation - Refactor the code after modifying the method: Enhance the method

Equivalent Operations Refactoring Code: Formatted Display

Refactor the code: custom constructor final code

Testing the final code Classroom exercises

14. Built-in modules os, sys, datetime, argparse

Other system modules sys and os

14.1sys module

1. Platform and version

Small tasks for testing platform

2.Module search path

Add path search job

3. Loaded module table

4. Extract command line parameters

Optimization of ping script

5. Other sys module tools

14.2os module

Introduction to os module Commonly used os module tools

View module properties (os)

View module properties (os.path)

1. Management tools

2. Portable constants

3.os.path tool

4. Run the Shell command in the script

os.system

os.popen

subprocess

5. Other tools exported by the os module

14.3datetime

Introduction to the datetime module datetime.datetime - Get the current time

strftime——specify format output datetime——format parameters

datetime.datetime - Get the time three days ago datetime.datetime - Get today's date

datetime.datetime——Get the date 10 days ago datetime.datetime——Get the date 10 days later

datetime - Get the specified part of time and transfer datetime objects and strings to each other

Switch Time Zones Class Exercises

14.4argparse

argparse module brief

argparse simple process - first step: create ArgumentParser object

argparse simple process - Step 2: Add Usage

argparse simple process - step three: optional arguments

argparse simple process - step 4: positional arguments

Simple process of argparse - Step 5: Call parse_args() to parse the command line

Complete code Code analysis

Tests Classroom exercises

Pyinstaller makes exe

15.Data persistence

15.1pickle

Introduction to Pickle technology Using pickle to store Python native objects

Update objects in pickle files

15.2shelves

Use shelves to generate the shelves database

Read and print the shelves database Test the shelves database

Update the shelves database

15.3 Database

Introduction to SQLite Interactive interface testing SQLite

DB Browser                                                                                                                                                                                                                 ..com (                                                       out – out out out of

SQLite code

15.4XML

Introduction to XML Multisite Markup Language HTML vs XML

HTML to represent a meeting XML to represent a meeting

An example of XML Parsing XML code

Code diagram analysis Analyze XML results

Xmltodict (recommended) Manually build XML code

Code diagram analysis and automatic construction of XML code

Recommended build solution jinjia2 template replacement

15.5JSON

Why are network devices now enabled with API? Introduction to JSON

The form of data in JSON: string The form of data in JSON: number

The form of data in JSON: object The form of data in JSON: array

JSON file content example Python objects written as JSON files

Python object converted to JSON format string

15.6base64

How to use Base64 to transmit data and convert binary objects to and from base64

Code Comparison

16.Python multi-threading and multi-process

Metaphor of processes and threads GIL

Simple example of executing task module

Problems with testing multi-process Python coroutines

Coroutine Coroutine SSH

Coroutine SSH Test Classroom Exercises

17.Python exception handling

try/except/else statement try statement clause form

Exception handling example Exception handling code

PASS Abnormality Classroom Practice

 

 

Part 2: Implementation and automation of classic network protocols

 

Basics: Scapy & Tool Modules

Introduction to Scapy Main functions of Scapy

Install kamene Interactive interface test kamene

Kamene default value Introduction to sending and receiving datagrams

Kamene constructs ping packet test Introduction to Ipaddress module

Correspondence between interface ID and name win_ifname (correspondence between interface ID and name)

get_ifname (get the unique ID of the interface) get_mac_netifaces

get_ip_netfaces                          sort_ip

Link Local address                       Link Local address

EUI-64 address                         Solicited node multicast address

           

 

1、ARP

ARP frame structure Introduction to ARP fields

ARP packet capture (request) ARP packet capture (response)

ARP request code                                                                                                                                                                                                                                                                                                   ..

ARP scanning code                         ARP scan test

ARP spoofing code ARP spoofing test

Deceptive effect of running programs on Linux

 

 

2、ICMP(ICMPv6)

Introduction to ICMP ICMP Header

Introduction to Ping Introduction to Ping package

Extract return package details Ping_one code

Ping code Ping_scan code

IPv6 address mapped to multicast NS packet capture (Linux sending)

Python constructs NS NA packet capture (IOS response)

Python constructs NA to test the poisoning effect

RS packet capture (Linux sending) Python builds RS

RA packet capture (IOS response) Python builds RA

Test RA spoofing effect Echo Request packet capture (IOS sending)

Python builds Echo Request and Echo Reply to capture packets (WIN response)

3、UDP

Introduction to UDP UDPvsTCP

UDP header UDP_Socket_Server

UDP_Socket_Client Test

Socket type Socket function

Public Socket Functions Raw Socket Socket_Raw

Change_IP_To_Bytes                    Change_MAC_To_Bytes

Checksum Struct module

4、DNS

Introduction to UDP The main records of DNS

Scapy constructs DNS A request Scapy constructs DNS A response

It is recommended to use the dns module for analysis

5、TFTP

Introduction to TFTP TFTP read operation

TFTP write operation TFTP server code

TFTP client code

6、HCP

Introduction to DHCP DHCP packet switching

DHCP packet type DHCP port number

WIN packet capture analysis (DISCOVER) Discover key parameter request list

WIN packet capture analysis (OFFER) WIN packet capture analysis (Request)

WIN packet capture analysis (ACK) Python builds DISCOVER

Python generates DISCOVER DOS Python builds Reauest

Python implements the complete process of DHCP Python implements DHCP monitoring

7、SNMP

7.1 SNMP theory

Three major components of SNMP SNMPv1/v2 Messages

Community security issues SNMP Security Models/Levels

Security features of SNMPv3

7.2 SNMP basic operations and MIB

Basic configuration of SNMPv2 OidView creates session

Download Cisco MIB Load MIB

Read CPU Utilization of Cisco Router Read SNMP Trap

Basic configuration of SNMPv3 OidView creates session

7.3 Seven SNMP operations

SNMP unified packet format The first one: get-reauest

The second type: get-response The third type: set-request

The fourth type: get-next-request The fifth type: getBulkRequest

The sixth type: trap The seventh type: informRequest

7.4SNMPv2 Python implementation

SNMPv2 GET                              SNMPv2 SET

SNMPv2 GETNEXT                          SNMPv2 GETBULK

SNMPv2 TRAP                             SNMPv2 getall

7.5SNMPv3 Python implementation

SNMPv3 configuration SNMPv3 GET

SNMPv3 SET                              SNMPv3 GETNEXT

SNMPv3 GETBULK                          SNMPv3 TRAP

7.6 SNMP Practical Combat 1 (matplotlib)

Python data rendering roadmap

Solve the problem of matplotlib module and garbled characters in Linux environment

Read SNMP write database

Data presentation (line graph)

7.7 SNMP Practical Combat 2 (influxdb_grafana)

docker-compose file docker-compose pulls up the container

Run the script to collect data and send it to InfluxDB Log in to Grafana

Change default password

Load Dashboard Detailed configuration of Dashboard

8、NTP

Introduction to NTP NTPLIB

Introduction to NTP fields NTP packet capture (request)

NTP packet capture (response) NTP RAW

9、SYSLOG

9.1 Syslog theory and simple server construction

Why configure Syslog Log Output Destinations

Syslog Severity Levels                     Syslog Facility

router syslog configuration

Python collects and analyzes SYSLOG Python sends SYSLOG

WIN system teaching research and problems

9.2 Syslog practice part 1: word segmentation and writing to the database

Split Syslog into words and write them into the database

Read database and render as pie chart

9.3 EFK actual combat 2

Use Docker-compose to pull up EFK Kibana home page

Create an index Discover

Visualization

10、TCP

Introduction to TCP TCP Header

Socket (Socket) Socket type

Socket function Public Socket function

Socket_Server                                Socket_Client_From_Input

Socket_Client_From_List                       Socket_Server_JSON

Socket_Client_JSON                           Socket_Server_PICKLE

Socket_Server_PICKLE                          Socket_Client_PICKLE

11、Telnet

Introduction to Telnet Telnet Packet Capture

Wireshark TCP stream About Telnet echo

Python Telnet code Netmiko

Telnet coroutine test

12、SSH & SFTP

Introduction to SSH Python SSH code (single command, get echo)

Python SSH code (multiple commands, execution commands) Python SFTP code

12.1 ntc-templates

Textfsm                                        Ntc-templates

Pyats-genie-command-parse

12.2 Practical Combat 1 Reading Excel and writing to the router via SSH

Read Excel data into dictionary (Pandas version)

Dictionary writing to Excel (Pandas version)

Final summary of actual code (Pandas version)

12.3 After the actual combat 2, go to the device configuration and compare

Compare text

Get configuration, calculate MD5, write to database

View configurations and compare

13、FTP

Introduction to FTP Active Mode

Passive Mode FTP Download

FTP upload FTP lists files in a specific directory

Find an entire FTP site (recursive search technique)

14、SMTP

14.1 SMTP theory and basic code

Introduction to SMTP How the SMTP protocol works

NC SMTP discovery process Email content analysis

QQ mailbox SMTP and POP3 settings SNTP sending attachment code

Send graphic emails via SMTP

14.2 Practical Combat 1 Sending Word and PDF attachments

Word processing

Email effect

Generate a more complete Word script

14.3 Practical Combat 2 Sending HTML Graphic Emails

SMTP sends HTML graphic emails

15、POP3

Introduction to POP3 NC POP3 Receiving Process

POP3 receipt (complete) Decode code

code analysis

16、LDAP

Introduction to LDAP Implementation of LDAP Query in Python

Handling Pinyin LDAP connections

get_user_info Other codes

17. Traffic analysis and processing

17.1.1 Netflow theory and python

Principles of Netflow                                                                                                                                                                                                                                                                                                The use

Version of Netflow                                   Components of Netflow

Netflow configuration example The difference between Key and nonkey field

Introduction to Netflow v9 package format Main program

Netflow analysis program Netflow graphics rendering code

17.1.2 ElastiFlow

ElastiFlow code Docker-Compose pulls up the container

Import index Import into Dashboard

The index and Dashboard have been configured

Dashboard ElashtiFlow:Overview

Dashboard ElashtiFlow:Flows(client/server)

Dashboard ElashtiFlow:Flow Records(vlient/server)

Dashboard ElashtiFlow:top Talkers

17.2Scapy traffic analysis

Scapy PCAP DoS Analysis Scapy PCAP HTTP Host Analysis

Scapy PCAP finds packets with specific fields Scapy Reset TCP stream

Scapy monitors Telnet flows Scapy Reset specific Telnet flows

17.3 PyShark traffic analysis

Introduction to Pyshark Pyshark.1. Basic display

Pyshark.2. Capturing data Pyshark.2. Filtering and options

Pyshark4. Phenomenon-level data packets Pyshark.5.1.TCP flow maximum ID

Pyshark.5.2. Packet of specific TCP flow PyShark.6.URL analysis

 

 

 

Part 3: Django web development

1. PyCharm quickly builds a Django development environment

Add new project Add SSH interpreter

Add items Add ALLOWED_HOSTS

Beijing configuration                                                                                                             activating Run Browser

Start the project The little rocket takes off

2. Bootstrap and template inheritance

Introduction to Bootstrap Bootstrap official website

Starter Template Create base.html

Navbbar Paste the Navbbar code into the Body

Add block title Add block body

Create index.html container

Template inheritance and replacement diagram views.index

url.py Test homepage

Django inner workings

3. Process images

Upload Logo image Settings.py defines the path to the static file directory

base.html Test logo image

Upload the favicon.ico (icon) image and insert the icon file link into Base.html

test icon

4. Database

Object Relational Mapping (ORM) Python’s two major ORMs

Create app qytdb and download qytdb data from the server

Result after downloading qytdb data Install psycopg2-binary

Configure settings Add qytdb to INSTALLED_APPS

Docker-compose-yaml                        Init-user-db.sh

Docker-compose starts psql and checks for configuration errors

Database foreign key design Create tables in qytdb.models

Schematic diagram of foreign key association Data Types and Model field reference document

Create a table like a database and write entry data to the table

Pycharm configuration database Pycharm view database

pgAdmin4 connects to the database to view the written content and obtains the entry get

Search term filter Get all

Update entry Delete entry

Foreign key search one Foreign key search two

5. Template practice

The simplest template: summary.html The simplest template: qyt_template.py

The simplest template: urls.py The simplest template: base.html

The Simplest Template: Test The Simplest Template Illustration

for loop: summary.html for loop: qyt_template.py

for loop: test template for loop diagram

Dictionary: summary.html Dictionary: qyt_template.py

Dictionary: test if: qyt_template.py

if : summary.html if : test

locals pass parameters

Course details: base.html

Course details: qyt_department_view_detail.py

Course details: urls.py

Course details: qyt_department_detail.html

Course details: Test

Template filters and comments

Custom filter

time filter

6. Form

Create a database Foreign key design

class Banzhuren                                class StudentsDB

Create a table in the database and write the class teacher data

Create the forms.py studentsForm form

form Types and Form field reference document studentsForm form HTML source code

bootstrap Forms Add qyt_department_addstudent.py

Add addstudent to urls.py Add qyt_department_addstudent.html

Add qyt_department_3_message.thml Add block head to base.html

Add drop-down menu and hyperlink to base.html Add student test

qyt_department_showstudents.py                  qyt_department_showstudents.html

base.html add block js                DateTables

url.py base.html add hyperlink

View students qyt_department_deletestudent.py

Add deletetestudent to urls to test deletion of student information

Delete student information graphic

7. Charts (line chart, bar chart, pie chart)

7.1 Separated URL management and framing

Create a new app                                 Add the app to INSTALLED_APPS

Global urls.py                                                                                                                                                 to create templates under crats_test

carts_test_multi_echarts.html Convert views to package

charts_test_view_multi_echarts.py

base.html Frame renderings

Introduction to Bootstrap Grid System

Bootstrap grid system testing

Introduction to Bootstrap spacing system

7.2 Echarts

Echarts official website

Load the JS file encapsulated by Qin Ke

7.3 The simplest bar chart, HTML podium data (chart1)

The simplest static histogram

Qin Ke encapsulates JS echarts_bar

JavaScript diagram

7.4 Linear, histogram data comes from Django (chart2)

HTML uses JS echarts_compound to get Django data

Function to construct echarts data

Generate data and return it to the front-end JS

Test linear and histograms, data comes from Django

7.5 Linear, histogram data comes from AJAX (chart2)

What is AJAX Add refresh button and AJAX to get data JS

Charts_test_ajax_chart2.py      Charts_test urls.py

Test AJAX attribute chart2 Illustration of how AJAX works

7.6 The simplest pie chart, HTML static data (pie1)

Pie chart 1HTML static data

Test pie chart

JavaScript diagram

7.7 Pie chart, data comes from Django (pie2)

Pie chart 2 Django data HTML

Pie chart 2 Django data view

Pie Chart 2 Django Data Test

7.8 Pie chart, data comes from AJAX (pie3)

Pie chart 3 ajax data HTML

Pie chart 3 ajax data view

Pie chart 3 ajax data urls.py

Pie chart 3 ajax data test

Illustration of how AJAX works

7.9 Ultimate line chart CPU utilization, data comes from AJAX

Ultimate Line Chart CPU Utilization HTML

Ultimate line chart CPU utilization view returns only page

Ultimate line graph CPU utilization base.html

Ultimate line graph CPU utilization urls.py

The test can see the empty box

Ultimate line chart CPU utilization view ajax

Code introduction

Ultimate line chart CPU utilization urls.py ajax

Ultimate Line Graph CPU Utilization Test

JavaScript diagram

Illustration of how AJAX works

7.10 Ultimate line chart interface speed, data comes from AJAX

Ultimate Line Chart Interface Rate HTML

Ultimate line chart interface rate view only returns page

Ultimate line chart interface ratebase.html

Ultimate line chart interface rate urls.py

The test can see the empty box

Ultimate line chart interface rate view ajax

Ultimate line chart interface rate urls.py ajax

Ultimate Line Graph Interface Rate Test

8. Backend management

Create a super user and put the database into the background management scope

The super user login management platform can manage users and database tables in the background.

Add database entry Add student Add group

Add user User login test permissions

Create group employee User employee logs in to the background management

9. Login and permission control

Create UserForm Qyt_login.py

Add login and logout URL Login page reference Bootstrap example

Login.html Put the logo.jpg image and signin.css under Static

Base.html Add name, login, logout information Login test name and login logout button in the upper right corner

Login_required() Accessing department summary and details will jump to the login page

View the permissions a user has Permission control

Test access control

10. Nginx + uWSGI deployment

WSGI Install uwsgi

Test the uWSGIF Web service

Install NGINX Configure NGINX

Testing the NGINX configuration service

Start service testing

Configure the host mapping file (it is best to have DNS) Close DEBUG and add ALLOWED_HOSTS

Access through domain name django Debu-error report disappeared

dango-crotab

 

 

Part 4: Intensive class Devnet

 

1. Introduction to the environment

2. Requests and Bottle modules

2.1 Bottle static routing

Bottle/Flask's most basic static routing (text)

Bottle's most basic static routing (text)

Bottle's most basic static routing (HTML)

2.2 Bottle dynamic routing and templates

Bottle dynamic routing and templates Flask dynamic routing and templates

Bottle dynamic routing and templates (templates) Bottle dynamic routing and templates (dynamic routing + templates)

Bottle dynamic routing and templates (complex data) Flask dynamic routing and templates (complex data)

Bottle dynamic routing and templates (complex data) Bottle dynamic routing and templates (Form)

Flask dynamic routing and templates (Form) Bottle dynamic routing and templates (test)

Bottle dynamic routing and templates (from.html) Bottle dynamic routing and templates (from_result.html)

2.3 Bottle JSON RPC

Bottle JSON RPC Server Flack JSON RPC Server

Requests post request testing

Illustration

2.4 Requests request and response processing

requests get requests requests post (server new content)

requests post (client content) requests post

requests to download images

2.5 Requests Headers processing

Get headers and cookies information Custom headers

How to get the headers requested by Chrome

1.6 Requests HTTP authentication

HTTP Basic authentication

1.7 Requests status code and exception handling

Status codes and actively throwing exceptions

Abnormal

1.8 Requests https and certificate verification

https and certificate verification

3. Cisco ASA REST API

3.1 Introduction to Cisco ASA REST API

Traditional Configuration Solutions Current Challenges

Python uses a human entry protocol and data encoding language

Protocol Comparison                                                                                                                                                                                                                          REST Introduction

API Key Points Certification

ASA REST API Requests and Responses          HTTP Method

Put vs patch                                 HTTP Status

Download the REST API file ASA basic configuration

Activate ASDM (transfer files) Load REST API IMAGE

Cisco API DOC

 

2.2 Cisco ASA REST APl Certification

Token Authentication API DOC

2.3 Cisco ASA REST API script

Object

Data structure analysis

2.4 Cisco ASA REST API Automation

ASA Automation

4. IOSXE NETCONE & YANG

4.1 Introduction to NETCONF

YANG Data Modeling                     YANG XML

NETCONF Encapsulation Model-Driven Programmability on Cisco Devices

4.2 YANG Suite

YANG Suite Official Website YANG Suite DOC

YANG Suite Github QYTang internal Gitlab address

Modifications relative to official documents Git project

Generate secret key Docker-compose build & up

User Agreement Login

Home

4.3 Use NETCONF to configure the router

Router activation netconf Add device

Test device reachability Create default repository and YANG set

View Warehouse View YANG Collection

Configure topology NETCONF YANG query

NETCONF Configure IP RUN RPC

View the configuration results on the router and generate a Python script

Get key XML

Python3 optimized code (generated XML) [using jinja2 template]

Python3 optimized code (initiating netconf request)

Introduction to NETCONF script steps

YANG Suite configuration (no shutdown interface)

Yang XML (no shutdown interface)

Python3 optimized code (generated XML) [using jinja2 template]

YANG Suite configuration (configure OSPF process and Router-id)

Yang XML (Configure OSPF process and Router-id)

YANG Suite configuration (OSPF announcement network)

Yang XML (OSPF Announcement Network)

NETCONF configure static routing (template)

NETCONF configure static routing (YAML data)

NETCONF configure static routing (code)

4.4 NETCONF, automated configuration and monitoring

NETCONF Automation Pay attention to the data structure (JSON)

Pay attention to the data structure (database) NETCONF monitoring and collection of CPU utilization

Ultimate Line Chart

5. IOSXE RESTCC NF

Introduction to RESTCONF Reference Documents

NETCONF Vs RESTCONF                   HTTP Methods

RESTCONF vs REST RESTCON as northbound exit

RESTCONF as Southbound Exit New Media Types

YANG defines four types of nodes for data modeling

Leaf                                    Leaf-list

Container                                List

YANG Date Modeling Import PostMan project

5.2 Restlet (Postman) RESTCONF test

Router activates RESTCONF according to Postman

Find the root of the RESTCONF API Media types

RESTCONF Root Resource Get version

Create a loopback port YANG Date Modeling

Delete loopback URL case

Get interface configuration Get specific interface configuration

Configure interface IP address No shutdown interface

Configure OSPF process ID and Router-ID Configure OSPF network announcement

Get CPU utilization Get configuration

Save configuration Experience summary

5.3 Python implements RESTCONEC

RESTCONF code RESTCONF automation

Pay attention to the data structure (JSON) RESTCONF collects CPU utilization

6. IOS-XE Shell and Scripting

6.1 IOS-XE Guest Shell

Guest Shell                               

Cisco IOx

Cisco IOx Application Environment 

Accelerate Time to Value for IoT-Driven Digital Business

IoT instance

Alleantia for Cisco IOx

Cisco IOx Components

Activate Cisco IOx

Configure Guestshell

Guestshell network

Enter GuestShell

Test the GuestShell network

GuestShell basic operations

6.2 CLI Python Modulen

Module Introduction configure VS configurep

execute vs executep                         cli vs clip

Install third-party modules Use rz to transfer files to guestshell

test script

6.3 EEM Python Module

Python Scripting in EEM

Python Policy

6.4 EEM Python Module

Download the relevant code Guestshell and automatically open the interface

Test automatically open the interface and track the SLA status

test

6.5 I0x container practice

The simplest Bottle WEB server Index.html template

Dockerfile                                 Package.yaml                 

Docker environment builds the image and gives ioxclient execution permissions

Initialize ioxclient Ioxclient and then encapsulate it into a package supported by iox

Configure app-hosting and upload the image to QYTang internal FTP

Download the image to the router flash Install the image

Activate Mirror Start Mirror

External testing WEB service

7. Beautiful Soup module and crawler basics

7.1 Beautiful Soup 4

Introduction to Beautiful Soup Beautiful Soup4.2 Chinese official website

Install three modules in advance to obtain the BeautifulSoup of the web page

Read the header code for authentication Copy the header content to the text document http_header.txt

About the parser                                                                                                                       using                                 out out out out out out out out out out out out out of out about      to           ’ ’ ’ ’ ’                                 down through down down down down down down through -

Findall searches for specific text content based on attributes

Findall limits the number of outputs to all direct child node contents

All descendants                    An alternative approach: find all product IDs

Change your thinking and find all the big pictures. Change your thinking and find all the thumbnails.

Change your thinking and find all prices Find the parent tag

7.2 Crawler basics

7.2.1 Crawler basics (crawling GPS information in web pages)

Crawl GPS information in web images 1 Find the image URL

Crawl GPS information in web images 2 Download images

Crawl the GPS information in web images 3 Discover the GPS information of the image

Crawl GPS information in web images 4 summary code

7.2.1 Crawler basics (crawling Tencent Classroom course information)

Crawl Tencent Classroom course information 1 to get the last page

Crawl Tencent Classroom course information 2 Crawl every page of course information

Crawl Tencent Classroom course information 3 final

Cracking the font format (finding the css of the font)

Crack font format (get css)

Crack font format (format css)

Crack font format (find font format)

Cracking the font format (finding the mapping relationship)

Crack font format (conversion method)

 

 

 

 

Part 5: Open Source Automation Software

 

0. Environment introduction

Topology

Equipment and Configuration (ASA)

Equipment and Configuration (CSR1)

Equipment and Configuration (CSR2,)

1. Configuration management (automation framework)

1.1 Ansible

1.1.1. Introduction to Ansible

Introduction

How Ansible works

Ansible's rich network-related modules

1.1.2 Ansible installation

Installation

Check Ansible version

1.1.3 Environment configuration

Ansible important documents Experimental environment explanation

Router Preconfiguration ASA Preconfiguration

Solve SSH Known host key problem Configure Hosts

SSH related parameters Ping module test

1.1.4 Playbook (script)

Introduction to Playbook Introduction to YAML

The Simplest Script Run the Simplest Script

1.1.5 Ansible implements batch configuration

YAML file of email login information

YAML file of device configuration information

Playbook YAML (1: Import of equipment and basic information)

Playbook YAML (2: Configure IP address)

Playbook YAML (3: Open interface)

Playbook YAML (4: Configure router-id)

Playbook YAML (5: Configuring OSPF network and saving)

Playbook YAML (6: Import of equipment and basic information)

Playbook YAML (7: Configure ASA interface)

Playbook YAML (8: Configure default routing and NAT)

Playbook YAML (9: Configure ACL and save)

Run playbook

Final_1_mass_config.yaml

Customer_config.yaml

About backup configuration

1.1.6 Ansible checks configuration changes

Modify the backup file name Mail_creds YMAL

Playbook YAML (checking ASA configuration consistency is not supported) Test Playbook (unmodified)

Test Playbook (modify configuration) Check emails

1.1.7 Python’s operation of YAML

Python operation test for YAML

Modified YAML

1.2 Nornir

1.2.1 Vault

Introduction to Vault Vault installation

Initialization certificate (download and install cfssl) Initialization certificate (CA root certificate configuration file)

Initialization certificate (initialization CA) Initialization certificate (certificate template)

Initialization certificate (Vault certificate request) Initialization certificate (issuance certificate)

Start the server (create directory, configure and create configuration file) Start the server (start the server)

Initialization (setting environment variables) Initialization (initializing the database)

Initialization (unseal database) Basic operations [testing, no operations in class]

Permission control (setting environment variables [root]) Permission control (creating secret engine)

Permission control (write the kv required by Nornir) Permission control (create control policy)

Permission control (create token) Permission control (adjust token [controlled])

Permission control (test reading) Permission control (deny writing)

Permission control (adjust token [root] (to ensure subsequent operations))

   

1.2.2 Vault Python code

Install relevant Python modules Initialize client

Create and read Secret tests to test the code that Nornir needs to use in the future

 

1.2.3 Introduction to Nornir

Introduction to Nornir Configuration File

Defaults.yaml                                Groups.yaml

Hosts.yaml Print Host.schema()

 

1.2.4 Nornir Inventory

Inventory query

Filtration technology

 

1.2.5 Nornir Task

The simplest Task Hello_world Advanced Task passing parameters

Advanced Task Multitasking Try to actively throw exceptions

Set the task log multiple times. Set the log printing level of print_result.

Extract the task execution results of each step

 

1.2.6 Nornir final mission

Load configuration files, filter devices, read sensitive account information from Vault, and update host

Execute show ip interface brief to configure the router

Interface template Configure router print_result result (CSR1)

Configuring the firewall Configuring the ASA print_result

final test

2. Indicator monitoring (CPU, MEM...)

2.1 Indicator monitoring (telegraf + InfluxDB + Grafana)

2.1.1 InfluxDB

Introduction to InfluxDB Three major features of InfluxDB

InfluxDB Python Operations Telgraf InfluxDB

 

2.1.2 Telgraf configuration

Docker-compose.yml(influxdb)                Docker-compose.yml(telgraf)

Telgraf OUTPUT configuration Telgraf INPUT SNMP IOS-XE configuration

Telgraf INPUT SNMP ASA configuration Telgraf INPUT grpc configuration

 

2.1.3 docker-compose pulls up the container

Telgraf OUTPUT configuration

 

2.1.4 View influxdb database

Enter influxdb

Enter the database and view measurements

View measurement data

 

2.1.5 Grafana configuration

Grafana Log in to Grafana

Change default password

Add database Import template

Template Cisco-IOS-XE SNMP Monitor Template Cisco ASA SNMP Monitor

Configure Notification Channels Configure Notification Channels DingTalk

Configure Notification Channels email settings in Grafana.ini

Root_url settings in Grafana.ini Configure alert

Alarm effect

 

2.1.6 grpc

gRPC                                   gRPC vs SNMP

Overall diagram Find YANG

Test YANG Router Configuration

Router configuration analysis View telnmetry subscriber status

TemplateCiscO-lOS-XE gRPC Monitor

3. Log analysis

3.1 Introduction to Elasticsearch Kibana Filebeat ELASTICSEARCH +KIBANA

Elasticsearch Kibana Data Collection

3.2 Rapid deployment of containers

Docker-compose.yaml analysis Cisco.yml analysis

Filebeat.yml analysis Docker-compose pulls up the container

Test elasticsearch Log in to the Kibana homepage

View Index

 

3.3 Apache filebeat installation

Apache filebeat installation MD file Download and install the signature public key

Create repo file Install filebeat

Activate apache module Modify configuration file

Activate, start and view the filebeat service View the apache index

 

3.4 Create index

Create an index (ASA) Create an index (Apache)

Query the created index

 

3.5 Discover

Discovery (Select Index Pattern) Control display time

Control display fields Filtering

Manual filters

 

3.6 Visualization

pie chart

data sheet

Create Dashboard

4. Netflow traffic analysis

Docker-Compose file highlights Netflow version comparison

Netflow configuration Access Kibana

Import index Import into Dashboard

ElashtiFlow:Overview

ElashtiFlow:Flows(client/server)

ElashtiFlow:Flow Records(client/server)

ElashtiFlow:Top Talkers

Part Six: Python builds a network monitoring/automated operation and maintenance environment

6.1 Introduction to environment and topology

Topology introduction EVE login

Open the experiment and turn on the computer

SecureCRT manages devices and provides device provisioning

6.2 Architecture design

Architecture design

database association

6.3 Add, edit and view devices

6.3.1 Adding Devices Forms DeviceForm

Views qyt_add_devices.py Attention to details

Templates add_devices.html

 

6.3.2 Editing devices

Forms EditDeviceForm

Views qyt_edit_device.py

Templates edit_device.html

 

6.3.3 View device

Detection device reachability background program How to confirm reachability

SSH confirm reachability                       SNMP confirm reachability

views qyt_show_devices.py                   templates show_devices.html

attention to detail

6.4 Utilization monitoring

Get utilization background scheduler qyt_devnet_2_devices_status.py

qyt_devnet_3_interfaces_utilization.py

 

6.4.1 CPU utilization

CPU utilization monitoring views Get CPU utilization and time

Passing data to JS drawing About the device selection card

 

6.4.2 Interface rate

Interface rate monitoring views Get interface rate and time

Obtain the interface rate and time calculation scheme                   Equipment selection card, Jiekuo and direction

Pass data to JS drawing

6.5 Device configuration backup

Backup configuration background scheduler qyt_devnet_5_get_config_md5.py

ASA backup configuration details analysis showing device backup form

Configuration View Configuration Comparison Configuration Download

6.6 Netflow protocol analysis

Write the information from the mobile phone to the database and run the Netflow collector as a service

Dictionary for protocol analysis Top 5 protocol distribution

Opinions on future improvements to Netflow

6.7 Log system ELK integration

Run the Logstash log collector as a service

Get embedded iframe

Embed code into HTML page

5.8 Automation script

Manual vs Python automation

qyt_playbook.py

6.9 System settings

Database aging time Clear data according to the database aging time (cycle one hour)

Monitor the data within the cycle after the monitoring cycle

Monitoring empty thresholds and email notifications How to use monitoring thresholds and suppression cycles

Netflow related settings Set Netflo related parameters

Equipment type query follows the principle that all data should originate from the database

For the time being, you can only use the OID in the database when editing in the background and collecting data.

When adding a device, use the device type name in the database

6.10 Automatic topology construction

Top.py       

Draw_map.js

Top_map.html

 

 

Part Six: Automated Operation and Maintenance System Catalog

 

1. Introduction to environment and topology

2. Architecture design

3. Add, edit and view devices

4. Utilization monitoring

5. Device configuration backup

6. Netflow protocol analysis

7. Log system ELK integration

8. Automated scripts

9. System settings

10. Automatic topology construction