T9 šŸ

Practical 7

Aim: Write a program to sniff packets sent over a network.

Introduction to Packet Sniffing

Packet sniffing (a.k.a. wire-tapping) is the act of intercepting and logging every packet that flows across a network segment. By forcing a Network-Interface Card (NIC) into promiscuous mode, the host receives frames regardless of the MAC address they were destined for.

Python Simulation Code: Harmless "Fork Bomb" Behavior

# Simulated harmless virus behavior - for educational purposes ONLY # WARNING: This script is safe but annoying – opens multiple windows. # Run in a sandboxed or virtual environment only. import os import time import subprocess def harmless_simulation(): print("Starting harmless simulation...") for i in range(5): # Limit the loop for safety subprocess.Popen(['notepad.exe']) # On Windows # For Linux use: subprocess.Popen(['gedit']) print(f"[{i+1}] Dummy window opened.") time.sleep(1) if __name__ == "__main__": harmless_simulation()

Analysis of Behavior

BehaviorDescription
Window spawningSimulates DoS-like effect by opening multiple apps.
Resource usageShows how malware consumes system resources.
No damageNo files are deleted or modified.

Types of Malware

TypeEffect
WormSpreads across networks.
TrojanDisguises as legitimate software.
RansomwareEncrypts files and demands payment.
SpywareCollects user data secretly.
AdwareDisplays unwanted ads.

Tools for Safe Malware Testing

ToolUse
Cuckoo SandboxMalware analysis.
Remnux VMReverse engineering.
Any.runOnline sandbox environment.