![]() |
| Ethical Hacking |
🛡️ Ethical Hacking — Day 31
Introduction to Network Traffic Analysis with Wireshark
⚠️ LEARNING PURPOSE ONLY: This tutorial is strictly for educational and defensive cybersecurity learning. Perform network analysis only on networks, devices, applications, and traffic that you own or are explicitly authorized to monitor. Never capture or inspect private network traffic without permission.
Welcome to Day 31 of the Ethical Hacking learning series.
Today, we will learn:
🌐 Network Traffic Analysis
Every time a device communicates over a network, it exchanges data.
For example:
YOUR COMPUTER
│
▼
NETWORK TRAFFIC
│
▼
ROUTER / INTERNET
│
▼
SERVER
Network traffic analysis helps cybersecurity professionals understand:
What devices are communicating
Which protocols are being used
Where traffic is going
Whether communication is normal
Whether suspicious patterns require investigation
🎯 Day 31 Learning Objectives
By the end of this tutorial, you will understand:
What network traffic analysis is
What packet capture means
What Wireshark is
Packets and frames
TCP and UDP basics
Common network protocols
Source and destination addresses
Ports and services
Display filters
Network baselining
Identifying unusual traffic patterns
Safe packet capture practices
Linux practical session
Windows practical session
macOS practical session
Wireshark basics
tcpdumpbasicsProfessional traffic analysis methodology
1. What Is Network Traffic Analysis?
Network traffic analysis is the process of observing and analyzing data moving across a network.
Conceptually:
DEVICE A
│
│ Packet
▼
NETWORK
│
│ Packet
▼
DEVICE B
A security analyst may examine:
SOURCE
DESTINATION
PROTOCOL
PORT
TIME
TRAFFIC VOLUME
CONNECTION PATTERN
2. What Is a Packet?
A packet is a small unit of data transmitted across a network.
Conceptually:
┌──────────────────────────┐
│ HEADER │
│ Source Information │
│ Destination Information │
│ Protocol Information │
├──────────────────────────┤
│ DATA / PAYLOAD │
└──────────────────────────┘
Packets contain information required for network communication.
3. What Is Packet Capture?
Packet capture means recording network traffic for analysis.
Conceptually:
NETWORK INTERFACE
│
▼
PACKET CAPTURE TOOL
│
▼
CAPTURE FILE
│
▼
ANALYSIS
Common tools include:
Wireshark
tcpdump
Always capture traffic only where you have authorization.
4. What Is Wireshark?
Wireshark is a network protocol analyzer used to inspect captured network traffic.
It can help you observe:
Protocols
Source addresses
Destination addresses
Ports
Packet timing
Network conversations
Conceptually:
CAPTURE
↓
FILTER
↓
INSPECT
↓
CORRELATE
↓
UNDERSTAND
5. Important Network Information
A network packet may contain information such as:
SOURCE IP ADDRESS
│
▼
DESTINATION IP ADDRESS
│
▼
PROTOCOL
│
▼
SOURCE / DESTINATION PORT
Example concept:
192.168.1.10
│
│ TCP
│
▼
192.168.1.20
Port: 443
6. TCP vs UDP
Two common transport protocols are:
TCP
TCP focuses on reliable communication.
Conceptually:
CLIENT
│
│ SYN
▼
SERVER
│
│ SYN-ACK
▼
CLIENT
│
│ ACK
▼
CONNECTION ESTABLISHED
TCP is commonly associated with services such as:
HTTP
HTTPS
SSH
UDP
UDP is generally connectionless and lightweight.
Conceptually:
DEVICE A
│
│ DATA
▼
DEVICE B
Common use cases may include:
DNS
Streaming
Voice applications
The exact protocol usage depends on the application.
7. Common Protocols
During analysis, you may encounter:
| Protocol | General Purpose |
|---|---|
| HTTP | Web communication |
| HTTPS | Encrypted web communication |
| DNS | Domain name resolution |
| TCP | Reliable transport |
| UDP | Lightweight transport |
| ICMP | Network diagnostics |
| ARP | Local network address resolution |
8. What Are Ports?
Ports help identify services or applications involved in network communication.
Conceptually:
IP ADDRESS
+
PORT
=
NETWORK ENDPOINT
Example:
192.168.1.10:443
Ports alone do not prove that a particular application is running.
Always investigate the context.
9. Network Traffic Baseline
Before identifying unusual activity, understand normal activity.
Example:
NORMAL NETWORK ACTIVITY
────────────────────────
Web browsing
DNS requests
Business applications
Software updates
Authorized cloud services
Then compare:
CURRENT TRAFFIC
│
▼
COMPARE WITH BASELINE
│
▼
NORMAL OR UNUSUAL?
10. What Can Be Suspicious?
Possible indicators requiring investigation include:
Unexpected destinations
Unusual traffic volume
Repeated connection failures
Unexpected protocols
Unexpected devices
Unusual communication times
Sudden traffic spikes
Unknown services
Important:
Unusual traffic is not automatically malicious.
Always verify the context.
11. Safe Packet Analysis Workflow
Use this methodology:
1. Define the authorized scope
↓
2. Select the correct interface
↓
3. Capture limited traffic
↓
4. Apply filters
↓
5. Identify normal patterns
↓
6. Investigate anomalies
↓
7. Document findings
🐧 12. Linux Practical Session
Identify Network Interfaces
Open Terminal and run:
ip addr
You can also use:
ip link
Look for interfaces such as:
eth0
wlan0
enp0s3
Interface names vary between Linux systems.
13. Linux — Check Active Connections
Use:
ss -tuln
This displays listening TCP and UDP sockets.
To view additional connection information:
ss -tun
Only inspect your own system or systems you administer.
14. Linux — Safe tcpdump Introduction
If tcpdump is installed, you can inspect traffic on your own system.
Example:
sudo tcpdump -i any -c 20
Explanation:
-i any → Monitor available interfaces
-c 20 → Stop after 20 packets
This limited capture is useful for learning.
Press:
Ctrl + C
to stop a longer capture.
15. Linux Practical Exercise
While capturing your own traffic:
Start a limited capture.
Open a website you own or a normal public website.
Observe the traffic.
Identify:
SOURCE
DESTINATION
PROTOCOL
PORT
Do not capture private networks without authorization.
🪟 16. Windows Practical Session
Open PowerShell.
Check network configuration:
ipconfig
For detailed information:
ipconfig /all
17. Windows — View Connections
Run:
netstat -ano
This can display:
Local Address
Foreign Address
Connection State
Process ID
You can also use:
Get-NetTCPConnection
18. Windows — Identify a Process
If you are investigating your own system, you can check a process ID:
Get-Process -Id <PID>
Replace:
<PID>
with a process ID from your own system.
Example workflow:
CONNECTION
│
▼
PROCESS ID
│
▼
AUTHORIZED INVESTIGATION
│
▼
IDENTIFY PROCESS
19. Windows Practical Exercise
Run:
Get-NetTCPConnection
Observe:
Local Address
Local Port
Remote Address
Remote Port
State
Then identify only processes running on your own computer.
🍎 20. macOS Practical Session
Open Terminal.
Check network interfaces:
ifconfig
You can also view network information using:
networksetup -listallhardwareports
21. macOS — View Network Connections
Run:
netstat -an
You can also inspect network sockets using:
lsof -i
This may display processes and network connections on your own Mac.
22. macOS — Safe Packet Capture
If authorized, you can use:
sudo tcpdump -i en0 -c 20
On many Macs:
en0
may represent an active network interface, but this can vary.
Check your interfaces first.
The option:
-c 20
limits the capture to 20 packets.
23. macOS Practical Exercise
Observe your own network traffic.
Record:
INTERFACE:
________________
SOURCE:
________________
DESTINATION:
________________
PROTOCOL:
________________
OBSERVATION:
________________
Do not collect or share sensitive captured data.
🔬 24. Wireshark Practical Lab
Install and open Wireshark on your own computer.
The basic workflow is:
SELECT INTERFACE
│
▼
START CAPTURE
│
▼
GENERATE NORMAL TRAFFIC
│
▼
STOP CAPTURE
│
▼
ANALYZE
Start with a short capture.
25. Understanding the Wireshark Interface
Wireshark generally displays information such as:
No.
Time
Source
Destination
Protocol
Length
Info
Each row represents a captured packet.
26. Wireshark Display Filters
Display filters help you focus on specific traffic.
For example:
dns
may display DNS-related traffic.
You can also explore:
tcp
for TCP traffic.
Or:
udp
for UDP traffic.
These filters help reduce noise during analysis.
27. Inspecting Your Own DNS Traffic
In your authorized lab:
Start a packet capture.
Visit a website.
Stop the capture.
Apply:
dns
Observe the DNS-related traffic generated by your own activity.
Ask:
Which device made the request?
When did it occur?
What protocol is shown?
Do not attempt to intercept another person's DNS traffic.
28. Inspecting TCP Traffic
Use the display filter:
tcp
Observe:
Source
Destination
Ports
Packet sequence
Connection behavior
Focus on understanding communication patterns.
29. HTTPS and Encryption
Modern web traffic commonly uses HTTPS.
Conceptually:
BROWSER
│
│ Encrypted Communication
▼
HTTPS SERVER
Packet capture does not automatically mean you can read encrypted application content.
Encryption helps protect data in transit.
30. Why Encryption Matters
Without proper protection:
DATA
│
▼
NETWORK
│
▼
POTENTIAL EXPOSURE
With encryption:
DATA
│
▼
ENCRYPTION
│
▼
NETWORK
│
▼
AUTHORIZED ENDPOINT
Encryption is an important security control.
31. Network Conversation Analysis
A useful approach is to examine communication as a conversation.
CLIENT
│
│ Request
▼
SERVER
│
│ Response
▼
CLIENT
Ask:
Who initiated communication?
Which protocol was used?
Which destination was contacted?
Was the behavior expected?
Did errors occur?
32. Traffic Analysis Timeline
Create a simple timeline.
Example:
10:00 — DNS request
10:00 — TCP connection begins
10:01 — Web application accessed
10:02 — Connection closes
Conceptually:
EVENT A
↓
EVENT B
↓
EVENT C
↓
EVENT D
Timelines help analysts understand sequences.
33. Compare Linux, Windows & macOS
| Operating System | Useful Commands |
|---|---|
| Linux | ip addr, ss, tcpdump |
| Windows | ipconfig, netstat, Get-NetTCPConnection |
| macOS | ifconfig, netstat, lsof, tcpdump |
The tools differ, but the investigation principle remains:
OBSERVE
↓
FILTER
↓
UNDERSTAND
↓
VERIFY
↓
DOCUMENT
34. Common Traffic Analysis Mistakes
❌ Mistake 1 — Capturing Too Much Data
Large captures can become difficult to analyze.
Start small.
❌ Mistake 2 — Ignoring Authorization
Never monitor networks without permission.
❌ Mistake 3 — Assuming Every Unknown Address Is Malicious
Investigate first.
An unfamiliar destination may belong to:
Cloud services
Software updates
CDNs
Business applications
Authorized services
❌ Mistake 4 — Ignoring Encryption
Understand whether traffic is encrypted before making conclusions about visible data.
❌ Mistake 5 — Not Establishing a Baseline
Normal activity must be understood before anomalies can be evaluated.
35. Professional Traffic Analysis Methodology
Use:
SCOPE
│
▼
COLLECT
│
▼
FILTER
│
▼
BASELINE
│
▼
ANALYZE
│
▼
CORRELATE
│
▼
VERIFY
│
▼
DOCUMENT
36. Day 31 Main Practical Challenge
Perform this only on your own computer and network.
Step 1 — Identify Your Interface
Linux
ip addr
Windows
ipconfig
macOS
ifconfig
Step 2 — Check Active Connections
Linux
ss -tun
Windows
Get-NetTCPConnection
macOS
netstat -an
Step 3 — Observe Normal Activity
Perform a normal activity such as:
Open your own website
Use an application
Perform a software update check
Observe how your system communicates.
Step 4 — Analyze
Record:
TIME:
________________
LOCAL DEVICE:
________________
REMOTE DESTINATION:
________________
PROTOCOL:
________________
PORT:
________________
EXPECTED OR UNEXPECTED:
________________
NOTES:
________________
37. Safe Wireshark Challenge
Capture a short sample of your own traffic.
Try to identify:
✔ DNS traffic
✔ TCP traffic
✔ UDP traffic
✔ HTTPS-related communication
Then answer:
Which protocols appeared?
Which destinations were contacted?
Which connections were expected?
Did encryption protect application data?
What did you learn about your system's normal behavior?
📝 Day 31 Assignment
Answer the following questions:
What is network traffic analysis?
What is a packet?
What is packet capture?
What is Wireshark used for?
What is the difference between TCP and UDP?
What information can a packet header contain?
What is a network port?
Why is network baselining important?
What is a display filter?
Why should packet captures be limited when learning?
What does
ip addrshow on Linux?What does
ss -tunhelp display?What does
ipconfigshow on Windows?What does
Get-NetTCPConnectiondisplay?What can
lsof -ishow on macOS?What is
tcpdump?Why is HTTPS important?
Why is unusual traffic not automatically malicious?
Why should captured data be protected?
What should be documented during traffic analysis?
🏆 Day 31 Golden Rules
Rule 1
Always analyze only authorized network traffic.
Rule 2
Start with normal behavior before looking for anomalies.
Rule 3
Use filters to reduce unnecessary noise.
Rule 4
A packet capture may contain sensitive information—handle it carefully.
Rule 5
Unknown does not automatically mean malicious.
Rule 6
Encryption is an important protection for data in transit.
Rule 7
Verify findings before reporting them.
Rule 8
Document your observations clearly.
📚 Day 31 Summary
Today you learned:
Network traffic analysis
Packets and packet capture
Wireshark basics
TCP and UDP
Common protocols
IP addresses and ports
Network baselining
Suspicious traffic indicators
Safe packet capture
Linux network analysis commands
Windows network analysis commands
macOS network analysis commands
Wireshark display filters
DNS traffic analysis
TCP traffic analysis
HTTPS and encryption
Network conversation analysis
Timeline analysis
Professional traffic investigation methodology
🔑 Most Important Lesson
Network traffic analysis is not about collecting as much data as possible.
It is about understanding communication.
AUTHORIZED SCOPE
+
OBSERVATION
+
BASELINE
+
ANALYSIS
+
VERIFICATION
=
RESPONSIBLE NETWORK SECURITY
🛡️ LEARN → CAPTURE SAFELY → ANALYZE → VERIFY → DOCUMENT → DEFEND
🔜 Day 32 — Vulnerability Assessment & Security Scanning Basics
Next, we will learn about:
What a vulnerability assessment is
Vulnerability scanning vs penetration testing
CVE and CVSS basics
Asset identification
Safe vulnerability scanning
False positives and false negatives
Vulnerability prioritization
Remediation and verification
Linux practical session
Windows practical session
macOS practical session
Professional vulnerability reporting
⚠️ LEARNING PURPOSE ONLY: Any security scanning must be performed only on systems you own or are explicitly authorized to test.

No comments:
Post a Comment