Skip to content

Repository files navigation

MiniHping

MiniHping is a lightweight packet crafting and sending utility written in C#.
It provides functionality similar to hping, but implemented for .NET environments, focusing on ICMP echo requests (ping) and basic packet manipulation.


Features

  • Send ICMPv4 echo requests (ping) with customizable options
  • Capture and parse ICMP replies
  • Adjustable packet size, count, and interval
  • Modular design:
    • PacketSender.cs → handles raw packet sending
    • PacketReceiver.cs → listens for responses
    • NetworkManager.cs → network-level configuration
    • HpingService.cs → core service integrating sender/receiver
    • Options.cs → command-line arguments and options
    • Program.cs → entry point with CLI parsing

Usage

Build

dotnet build

Run (ICMP mode)

dotnet run -- --mode icmp --dst 8.8.8.8 --count 4

Run (TCP SYN mode)

dotnet run -- --mode tcp --dst 8.8.8.8 --port 80 --syn --count 3

Example Output

🚀 Starting ICMP packet transmission...
Press Ctrl+C to stop

📤 ICMP 8.8.8.8: id=1 seq=1 ttl=64
📤 ICMP 8.8.8.8: id=2 seq=2 ttl=64
📤 ICMP 8.8.8.8: id=3 seq=3 ttl=64
📤 ICMP 8.8.8.8: id=4 seq=4 ttl=64

📊 --- 8.8.8.8 hping statistics ---
📤 4 packets transmitted
📥 0 packets received
📉 100.0% packet loss
⏱️ Total time: 6.0s

Options

Option Description
-m, --mode Protocol mode: tcp, icmp (default: tcp)
--dst Target host or IP address (required)
-i, --iface Network interface index (0, 1, 2, …)
-c, --count Number of packets to send (-1 = unlimited, default)
-p, --port Target port (TCP mode only, default: 80)
-S, --syn Set TCP SYN flag (TCP mode only)
-t, --interval Interval between packets in milliseconds (default: 1000)
-v, --verbose Verbose output

Project Structure

MiniHping/
 ├── HpingService.cs      # Core service logic
 ├── NetworkManager.cs    # Network setup
 ├── Options.cs           # Command-line options
 ├── PacketReceiver.cs    # ICMP response handler
 ├── PacketSender.cs      # Packet sending logic
 ├── Program.cs           # Entry point
 └── MiniHping.csproj     # Project file

Requirements

  • .NET 8.0 SDK
  • Windows or Linux with raw socket support
  • Administrator/root privileges may be required

About

MiniHping is a lightweight packet crafting and sending tool inspired by hping.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages