Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
97 views

01. Lecture PPT - Python Programming Intro v2.3 (1)

The document outlines a Python programming course tailored for network engineers, cybersecurity, and ethical hacking, emphasizing Python's versatility and ease of use. It includes practical examples, security recommendations, and various Python libraries relevant to networking and cybersecurity. Additionally, it provides guidance on Python installation, syntax rules, and project ideas for hands-on practice.

Uploaded by

adams enock
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

01. Lecture PPT - Python Programming Intro v2.3 (1)

The document outlines a Python programming course tailored for network engineers, cybersecurity, and ethical hacking, emphasizing Python's versatility and ease of use. It includes practical examples, security recommendations, and various Python libraries relevant to networking and cybersecurity. Additionally, it provides guidance on Python installation, syntax rules, and project ideas for hands-on practice.

Uploaded by

adams enock
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Lecture File

MAKE YOUR OWN PYTHON TOOLS


PYTHON PROGRAMMING - ONLINE TRAINING COURSE
FOR NETWORK ENGINEERS, CYBERSECURITY & ETHICAL HACKING

Free Short Course


NETWORKWALKS ACADEMY
Python

“Python is an open source, high level & general purpose programming language”

Type: Open Source Programming Language

Author: Guido van Rossum

Version: Python 3 (2008), Python 2 (2000), Python 1 (1994)

Supported IDE’s: Pycharm, Microsoft Visual Studio, Eclipse, Spyder, Jupyter, …

Supported Code Editors: Notepad++, Atom, Sublime text,…

Uses: Network automation, Hacking, web development, SW development, Mathematics, ….

Supported Platforms: Windows, Mac, Linux, Raspberry Pi, …

Hacking

Ethical
www.networkwalks.com Hacking
Lab Setup
For Cyber Security, Ethical Hacking, Networking & Programming practice

Network Settings on all VM’s:


NATNetwork (custom)
Range: 10.0.0.2-19 /24

Main OS
(Windows10)
Manual IP: 10.0.0.2/24 (NATNetwork)
IP: x.x.x.x

Manual IP:
Manual IP: Manual IP: 10.0.0.16 /24 (NATNetwork) Manual IP:
10.0.0.10 /24 (NATNetwork) 10.0.0.7 /24 (NATNetwork) Follow networkwalks.com for detail 10.0.0.9 /24 (NATNetwork)

Windows 7 Server 2016


(Optional)
WHY CYBER SECURITY IS IN SO HIGH DEMAND?
PRACTICAL EXAMPLES
SECURITY RECOMMENDATIONS (with practical examples) (HOMOGRAPHS BASED ATTACKS)
www.facebook.com
www.fаcebook.com
• Never click on an un-trusted link www.facеbook.com
e.g. Phishing & Homograph based attacks can lead to Virus & Malware attacks
PRACTICAL EXAMPLES
• Always change your default security credentials Intitle webcamxp 5 intext live stream
intitle webcamXP inurl:8080
Intitle yawcam” “It's a webcam! "user"
e.g. Admin access to network devices can lead to unauthorized access "pass"
GHDB intitle Index of WhatsApp Images

• Always implement strict end points security policies


e.g. Admin access to servers or other devices can lead to password crack attacks PRACTICAL EXAMPLES

• Always keep all unused services & ports disabled


e.g. Open ports like 445 can cause SMB based DoS attack PASSWORD
ATTACKS
• Always implement strict security policies
e.g. weak email security policy can lead to Social Engineering attacks
howsecureismypassword.net
passwordmonster.com
• Always update your endpoints with security patches
e.g. Old versions can cause Hacking attacks using Metasploit
PRACTICAL EXAMPLES
PRACTICAL EXAMPLES PRACTICAL EXAMPLES (Social Engg & Email Spoofing)

VIRUS ATTACKS

DOS ATTACKS PHISHING ATTACKS


(SPOOFING)
LIVE QUIZ

Which one is current version of Python?

A. Version 1
B. Version 3
C. Version 4

www.networkwalks.com
Why Python for Cybersecurity & Networking?

Python is used heavily in Hacking scripts, pentesting scripts, Security tools & Network tools

• Python can be used to blend multiple technologies with Cybersecurity & Hacking like AI, ML, web applications,
Databases, perform complex mathematics, Data Analytics , …
• Python has a simple syntax, similar to the English language (making it simple for Cybersecurity & hacking related
tools)
• Python is object-oriented (main need for Cybersecurity & hacking related tools)
• Python runs on an interpreter system, meaning that code can be executed as soon as it is written, making it fast
(main need for Cybersecurity & hacking related tools)
• Python can be used by Hackers to create scripts & make malicious application.
• Python can be used by White-hat hackers to create defence scripts & Anti-viruses
• Python can be used to automate Security Devices like Firewalls & Networking Devices like Routers

www.networkwalks.com
Why Python for Cybersecurity & Networking?

DDoS tool Zip cracker Clipboard sniffer IP Location tracker BW monitoring tool
Beginner

Password Generator IP & MAC finder MAC Address Changer basic Network Mapping Tool (N-map)

Intermediate

Password Generator WiFi passwords stealer NFC Cracker WiFi Password cracker Vulnerabilities Scanner
Advanced

Network Automation for Cisco Routers Keylogger Replicating virus Kali Linux tools like MSF, Aircrack-ng, …
www.networkwalks.com
SOME MORE CYBERSECURITY PROJECTS/LABS BASED ON PYTHON

Practice Lab - Create a Password Generator in Python

Practice Lab - Create a Password Strength Checker in Python

Practice Lab - Create an IP & MAC finder of local PC in Python

Practice Lab - Create an IP Location Finder in Python

Practice Lab - Create a MAC Address Changer in Python for Linux

Practice Lab - Create a basic Network Mapping Tool (N-map) with single Port scan

Practice Lab - Create a Network Mapping Tool (N-map) with multiple ports scan (port range)

Practice Lab - Create a basic Network Automation Lab for Cisco Routers

Practice Lab - Create an advanced Network Automation Lab for Cisco Routers

Practice Lab - Create a WiFi passwords stealer from Windows in Python


PYTHON INSTALLATION

• Many PCs and MACs will have python already installed. To check if you have

python installed on a Windows PC, search in the start bar for Python or run the

following on the Command Line (cmd.exe):

• If you find that you do not have python installed on your computer, then you can

download it for free from the official website or student drive:

www.python.org/downloads/windows/
www.python.org/downloads/release/python-381/

*Note: We have used Python version 3.8.1 in this course & labs. It is recommended that all
students should install & use same version to be in sync with class.
www.networkwalks.com
LIVEQUIZ
LIVE QUIZ

WHICH OF THESE IDE’s SUPPORT PYTHON?

A. Pycharm
B. Turbo Pascal
C. Visual Studio Code
D. Sublime Text
www.networkwalks.com
Python Syntax (Rules)

✓ Take care of Indentation & whitespaces (no more curly brackets, as in other languages like C++)

✓ Variables don’t need to be declared first (they are declared as we assign first value to it)

✓ Comments start with a # and Python will ignore them

#print (“Hello, World!”)


print("Hello, World!")

✓ We can use single quotes ‘ ’ or double quotes “” for string values


print("Hello") is same as
✓ print() is used for display print('Hello')

www.networkwalks.com
Print Function (for display)

✓ Example 1 print("Hello, World!")

✓ Example 2 print("""Network Walks Training Academy offers


Cisco CCNA
Cisco CCNP
Cisco CCIE
Huawei HCNA
ITIL
& many more training courses
""")

www.networkwalks.com
LIVEQUIZ
LIVE QUIZ

What will be the output of below Python codes?

A. print(“One”)
B. print(One)
C. print(1)

www.networkwalks.com
User Input

✓ Example 1 username = input("Enter Username")


print("Username is" + username)

✓ Example 2 print("Enter your name:")


x = input()
print("Hello ", x)

www.networkwalks.com
If Else (Decision Making in Python)

✓ Example 1 a = 10
b = 2
if a>b:
print("a is greater than b")

✓ Example 2 a = 200
b = 33
if b>a:
print("b is greater than a")
else:
print("b is not greater than a")
All Python conditions:
• Equals: a == b
• Not Equals: a != b
• Less than: a < b
• Less than or equal to: a <= b
• Greater than: a > b
• Greater than or equal to: a >= b
*Elif is used for multiple level/nested IfElse

www.networkwalks.com
Loops (Repeated Tasks)

✓ For Loops Execute a sequence of statements multiple times


Example for i in range(0,5):
print("Network Walks Academy")

✓ While Loops Repeat a statement while a given condition is TRUE (tests the condition before executing the loop body)
Example i = 0
while i < 5:
print("Network Walks Academy")
i=i+1 #(or use i+=1)

www.networkwalks.com
LIVE QUIZ

Write a Python Program (script) that will produce


following output using for Loop:

networkwalks
networkwalks
networkwalks
networkwalks
networkwalks

www.networkwalks.com
Lecture PPT

THE REAL POWER OF PYTHON

LIBRARIES, PACKAGES &


MODULES IN PYTHON

NETWORKWALKS ACADEMY
www.networkwalks.com
Python Hierarchy
A Library is a collection of Packages & modules.

A Package is a collection of related modules that work together to provide certain functionality & so on…

Library

Pkg Pkg

Module Module Module Module

fn fn fn fn fn fn fn fn

www.networkwalks.com
Python Libraries

A Library is a collection of Packages & modules. It is having a collection of related functionality of codes that allows us to
perform many tasks without writing full code. It is a reusable chunk of code that we can use by importing it in our program,
we can just use it by importing that library and calling the function of that library with period (.)

Example: Importing pandas library and call read_csv method/function using alias of pandas i.e. pd.

import pandas as pd

df = pd.read_csv("file1.csv")

www.networkwalks.com
Popular Python Libraries (General)

GUI
LIBRARIES
Tkinter

www.networkwalks.com
POPULAR PYTHON LIBRARIES for NETWORKING

Telnet

SUBPROCESS

pySNMP
pyATS
Paramiko
www.networkwalks.com
POPULAR PYTHON LIBRARIES for ETHICAL HACKING &
CYBERSECURITY

SUBPROCESS
Getmac

Telnet
Impacket

Getpass

www.networkwalks.com
Thank You

You might also like