Skip to content

UDP networking lab: Ping client/server with RTT calculation and packet loss simulation, heartbeat monitor for application health tracking, and file exfiltration demo with multi-packet transfer protocol. Demonstrates UDP-based data exfiltration security risks.

Notifications You must be signed in to change notification settings

Alien0525/udp-networking-toolkit

Repository files navigation

UDP Network Tools & Security Demonstration

Overview

This project demonstrates fundamental UDP socket programming concepts and explores potential security implications of UDP-based data transfer. It includes implementations of UDP ping utilities, heartbeat monitoring, and a proof-of-concept file exfiltration tool that highlights data security concerns.

Table of Contents

Assignment Background

This project is based on the UDP Pinger Lab from the Kurose & Ross "Computer Networking: A Top-Down Approach" textbook programming assignments.

Extensions Implemented

This implementation extends the original UDP Pinger assignment with:

  • UDP Heartbeat monitoring for application health tracking
  • Multi-packet file transfer protocol with session management
  • File exfiltration proof-of-concept demonstrating security vulnerabilities
  • ACK/retry mechanism for reliable UDP transfer
  • Comprehensive statistics and progress tracking

Project Components

1. UDP Pinger (Basic Implementation)

Standard UDP ping client-server implementation demonstrating:

  • Basic UDP socket programming
  • Round-trip time (RTT) calculation
  • Packet loss simulation (30%)
  • Timeout handling

Files: UDPPingerClient.py, UDPPingerServer.py

2. UDP Heartbeat Monitor

Application health monitoring system featuring:

  • Periodic heartbeat messages
  • One-way packet loss detection
  • Client health status tracking
  • Configurable packet loss simulation

Files: UDPHeartbeatClient.py, UDPHeartbeatServer.py

3. UDP File Exfiltration Tool (Security Demonstration)

Proof-of-concept demonstrating data exfiltration capabilities:

  • Multi-packet file transfer over UDP
  • Session management with unique IDs
  • Reliable transfer with ACK/retry mechanism
  • Automatic file reconstruction
  • Progress tracking and statistics

Files: UDPFileExfilClient.py, UDPFileExfilServer.py

Features

UDP Pinger

  • Send 10 ping messages to server
  • Calculate and display RTT for each packet
  • Handle packet loss gracefully
  • Display comprehensive statistics (min/max/avg RTT, packet loss rate)

UDP Heartbeat

  • Configurable heartbeat intervals
  • Sequence number tracking
  • Lost packet detection and reporting
  • Client timeout detection
  • Optional packet loss simulation

UDP File Exfiltration

  • Transfer files of any size via UDP
  • Automatic chunking for large files (3KB chunks)
  • Session-based file transfer protocol
  • ACK/retry mechanism for reliability
  • Progress tracking with detailed output
  • Automatic file reconstruction on server

Installation & Setup

Requirements

  • Python 3.6 or higher
  • No external dependencies (uses standard library only)

Clone the Repository

git clone https://github.com/yourusername/udp-network-tools.git
cd udp-network-tools

Running the Applications

UDP Pinger

# Terminal 1: Start the server
python UDPPingerServer.py

# Terminal 2: Run the client
python UDPPingerClient.py

UDP Heartbeat

# Terminal 1: Start the server
python UDPHeartbeatServer.py

# Terminal 2: Run the client
python UDPHeartbeatClient.py

UDP File Exfiltration (Security Demo)

# Terminal 1: Start the server
python UDPFileExfilServer.py

# Terminal 2: Run the client
python UDPFileExfilClient.py
# Choose option 2 to exfiltrate a file
# Enter the file path when prompted

Usage Examples

Basic Ping

$ python UDPPingerClient.py

UDP Pinger Client
==================================================
Reply from ('127.0.0.1', 12000): PING 1 1705968234.123456
RTT: 0.001234 seconds

Reply from ('127.0.0.1', 12000): PING 2 1705968235.234567
RTT: 0.001456 seconds

Request timed out for Ping 3

==================================================
Ping Statistics:
Packets: Sent = 10, Received = 7, Lost = 3
Packet Loss Rate: 30.0%
Round Trip Times:
  Minimum: 0.001234 seconds
  Maximum: 0.002345 seconds
  Average: 0.001678 seconds

Heartbeat Monitor

$ python UDPHeartbeatClient.py

UDP Heartbeat Client
======================================================================
Simulate packet loss? (y/n): n
Server: 127.0.0.1:12000
Heartbeat interval: 1.0 seconds
Total heartbeats to send: 20
Packet loss simulation: DISABLED
======================================================================

[SENT] Heartbeat #1 at 14:30:45
[SENT] Heartbeat #2 at 14:30:46
[SENT] Heartbeat #3 at 14:30:47
...

File Exfiltration

$ python UDPFileExfilClient.py

UDP File Exfiltration Client - Security Demonstration
============================================================

Options:
1. Send regular pings (10 pings)
2. Exfiltrate a file
3. Exit

Enter choice (1-3): 2

Enter file path to exfiltrate: document.txt

============================================================
Exfiltrating file: document.txt
Session ID: a1b2c3d4
File size: 8500 bytes
Total packets: 3
============================================================
[START] File transfer initialized
[SENT] Packet 1/3 (3000 bytes)
[SENT] Packet 2/3 (3000 bytes)
[SENT] Packet 3/3 (2500 bytes)
============================================================
[SUCCESS] File exfiltration complete!

Screenshots & Demonstration

1. UDP Pinger - Basic Operation

UDP Pinger Demo UDP Pinger demonstrating RTT calculation and 30% packet loss simulation

2. UDP Pinger - Statistics

UDP Pinger Statistics Complete ping statistics showing min/max/avg RTT and packet loss rate

3. File Exfiltration - Small File Transfer

File Exfiltration Small Successful exfiltration of secret.txt (117 bytes) in single packet

4. File Exfiltration - Success

Session Management Session-based transfer with unique session ID for tracking

5. File Exfiltration - Transfer Reliability

Transfer Reliability Demonstrating UDP unreliability - transfer failure scenario

6. File Exfiltration - Verification

File Verification Exfiltrated file successfully reconstructed on server with identical contents

7. Large File Transfer - Content Preview

Large File Content Secret2.txt containing confidential employee database (17,227 bytes)

8. Large File Transfer - Multi-Packet Success

Multi Packet Transfer Large file split into multiple packets with successful reconstruction

9. Additional Successful Transfer

Exfiltration Success Another successful file exfiltration demonstrating reliability

Video Demonstration

A comprehensive video demonstration covering:

UDP Heartbeat Monitor:

  • Periodic heartbeat transmission
  • Sequence number tracking
  • Lost packet detection and reporting
  • One-way delay calculation
  • Client timeout scenarios
  • Configurable packet loss simulation

Packet Loss Scenarios:

  • Server-side 30% packet loss simulation
  • Client-side simulated packet drops
  • Impact on heartbeat monitoring
  • Statistical analysis of loss rates
  • Recovery and detection mechanisms

Watch Full Demo Video (5 minutes)

The video provides a complete walkthrough of the UDP Heartbeat system, demonstrating how applications can monitor connectivity, detect packet loss, and handle unreliable network conditions.

File Transfer Protocol

The file exfiltration tool uses a custom protocol over UDP:

Message Type Description Fields
FILE_START Initialize transfer session session_id, filename, total_packets
FILE_DATA Transfer file chunks session_id, packet_num, data (up to 3KB)
FILE_END Finalize transfer session_id
ACK Acknowledgment packet_num
COMPLETE Transfer status status (success/failure)

Protocol Flow

Client                          Server
  |                              |
  |-------- FILE_START --------->|
  |<---------- ACK --------------|
  |                              |
  |-------- FILE_DATA (1) ------>|
  |<---------- ACK --------------|
  |                              |
  |-------- FILE_DATA (2) ------>|
  |<---------- ACK --------------|
  |                              |
  |-------- FILE_END ----------->|
  |<-------- COMPLETE -----------|

Security Implications

This project demonstrates that UDP can be used to transfer data outside a network, which has important security implications:

Threats Demonstrated

  • Data Exfiltration: Files can be transmitted via UDP packets that may bypass certain firewall rules
  • Protocol Tunneling: Legitimate-looking network traffic (pings/heartbeats) can carry hidden data
  • Covert Channels: UDP's simplicity makes it suitable for covert communication channels
  • Firewall Evasion: UDP traffic may be less scrutinized than TCP in some network configurations

Defensive Measures

Organizations should consider:

  • Deep Packet Inspection (DPI) for UDP traffic
  • Rate limiting on ICMP/UDP packets
  • Network behavior analysis and anomaly detection
  • Application-layer firewalls
  • Comprehensive logging and monitoring of UDP traffic
  • Egress filtering to control outbound traffic

Project Structure

udp-network-tools/
├── README.md
├── .gitignore
├── UDP_Pinger_programming_lab_only.pdf
├── UDPPingerClient.py
├── UDPPingerServer.py
├── UDPHeartbeatClient.py
├── UDPHeartbeatServer.py
├── UDPFileExfilClient.py
├── UDPFileExfilServer.py
├── screenshots/
│   ├── basic_ping_1.png
│   ├── basic_ping_2.png
│   ├── secret.txt.png
│   ├── exfiltrate_secret_success.png
│   ├── exfiltrate_secret_failure.png
│   ├── exfiltrated_file_on_server.png
│   ├── large_file_to_be_exfiltrated.png
│   ├── secret2_exfiltrated.png
│   └── exfiltrate_success_2.png
└── demo/
    └── udp_heartbeat_demo.mov

Educational Context

This project was developed as part of a computer networking course to understand:

  • UDP socket programming fundamentals
  • Network protocol design and implementation
  • Packet loss handling and reliability mechanisms
  • Security implications of network protocols
  • Practical cybersecurity concepts

Learning Objectives

  1. Understand connectionless vs connection-oriented protocols
  2. Implement timeout and retry mechanisms
  3. Calculate network performance metrics (RTT, packet loss)
  4. Design custom application-layer protocols
  5. Recognize security vulnerabilities in network applications

Disclaimer

IMPORTANT: The file exfiltration components are proof-of-concept demonstrations for educational and security research purposes only.

  • Unauthorized use of these techniques to exfiltrate data from networks you don't own or have permission to test is illegal and unethical
  • Only use in controlled environments with proper authorization
  • Intended for educational purposes, security research, and authorized penetration testing
  • Understanding these techniques helps in building better defenses

By using this software, you agree to use it responsibly and in accordance with all applicable laws and regulations.

Course: Computer Networks CS-GY 6843
Academic Year: Fall 2025
Institution: NYU Tandon

About

UDP networking lab: Ping client/server with RTT calculation and packet loss simulation, heartbeat monitor for application health tracking, and file exfiltration demo with multi-packet transfer protocol. Demonstrates UDP-based data exfiltration security risks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages