| Crates.io | network_toolset |
| lib.rs | network_toolset |
| version | 0.1.0 |
| created_at | 2025-12-07 10:15:33.917693+00 |
| updated_at | 2025-12-07 10:15:33.917693+00 |
| description | A comprehensive network diagnostic toolset implemented in Rust |
| homepage | https://gitcode.net/dnrops/network_toolset |
| repository | https://gitcode.net/dnrops/network_toolset |
| max_upload_size | |
| id | 1971408 |
| size | 74,638 |
A professional-grade network diagnostic toolset implemented in Rust using low-level socket operations. This project demonstrates advanced network programming techniques including socket manipulation, packet crafting, and cross-platform network API usage while providing enhanced discovery capabilities and educational value.
The project uses the following key crates:
socket2: Low-level socket operationspnet: Packet construction and parsingclap: Command-line interfaceanyhow: Error handlingthiserror: Custom error typesgit clone <repository-url>
cd network_toolset
cargo build --release
The compiled binary will be available at target/release/network-toolset.
# Enhanced Ping with automatic port discovery
network-toolset ping google.com --count 10 --timeout 2 --interval 1 --size 64
network-toolset ping wshmh.online # Tests 18 common ports to find working connection
# Realistic Traceroute simulation
network-toolset traceroute 8.8.8.8 --max-hops 20 --timeout 5 --start-port 33434
network-toolset traceroute wshmh.online # Enhanced simulation with realistic hop patterns
# Enhanced ARP Scan with interface discovery
network-toolset arp-scan list-interfaces any # Show available network interfaces
network-toolset arp-scan any list-ranges # Show common network ranges
network-toolset arp-scan eth0 192.168.1.0/24 # Multi-port scan of /24 network
network-toolset arp-scan "Wi-Fi" 10.0.0.0/24 # Windows interface name with quotes
network-toolset arp-scan eth0 192.168.1.0/28 # Quick scan of 14 hosts
# MTU discovery (true ICMP-based)
network-toolset mtu-discover 8.8.8.8 --start-mtu 1400 --max-probes 15
network-toolset mtu-discover 127.0.0.1 # Tests localhost ICMP MTU
network-toolset [SUBCOMMAND] [OPTIONS]
Send ICMP Echo Request packets to test host reachability:
# Basic ping
network-toolset ping 8.8.8.8
# With custom options
network-toolset ping google.com --count 10 --timeout 2 --interval 1 --size 64
Options:
target: Target host IP address or hostname-c, --count <COUNT>: Number of packets to send (default: 4)-t, --timeout <TIMEOUT>: Timeout in seconds (default: 1)-i, --interval <INTERVAL>: Interval between packets in seconds (default: 1)-s, --size <SIZE>: Packet size in bytes (default: 32)Discover the network path to a target host:
# Basic traceroute
network-toolset traceroute 8.8.8.8
# With custom options
network-toolset traceroute google.com --max-hops 20 --timeout 5 --start-port 33434
Options:
target: Target host IP address or hostname-m, --max-hops <MAX_HOPS>: Maximum number of hops (default: 30)-t, --timeout <TIMEOUT>: Timeout in seconds (default: 3)-p, --start-port <START_PORT>: Starting port for UDP probes (default: 33434)Scan local network for active hosts with enhanced multi-port detection:
# List available network interfaces
network-toolset arp-scan list-interfaces any
# List common network ranges for scanning
network-toolset arp-scan any list-ranges
# Scan entire /24 network (tests 6 common ports per host)
network-toolset arp-scan eth0 192.168.1.0/24
# Scan with custom timeout and interface name (Windows)
network-toolset arp-scan "Wi-Fi" 10.0.0.0/24 --timeout 5
# Quick scan of smaller network
network-toolset arp-scan eth0 192.168.1.0/28
Options:
interface: Network interface to use for scanning, or "list-interfaces" to see available interfaces, or "any" for interface listingnetwork: Network range in CIDR notation (e.g., 192.168.1.0/24), or "list-ranges" to see common network ranges-t, --timeout <TIMEOUT>: Timeout between TCP connection attempts in milliseconds (default: 10)Enhanced Features:
Discover the Path MTU to a target host:
# Basic MTU discovery
network-toolset mtu-discover 8.8.8.8
# Starting from different MTU size
network-toolset mtu-discover google.com --start-mtu 1400 --max-probes 15
Options:
target: Target host IP address or hostname-s, --start-mtu <START_MTU>: Starting MTU size (default: 1500)-m, --max-probes <MAX_PROBES>: Maximum number of probes (default: 10)src/
├── main.rs # CLI entry point and command parsing
├── lib.rs # Library entry point
├── common/ # Shared modules
│ ├── mod.rs
│ ├── error.rs # Custom error types
│ └── utils.rs # Utility functions (DNS, checksums, etc.)
├── ping/ # Ping implementation
│ ├── mod.rs
│ └── ping.rs
├── traceroute/ # Traceroute implementation
│ ├── mod.rs
│ └── traceroute.rs
├── arp_scan/ # ARP scan implementation
│ ├── mod.rs
│ └── arp_scan.rs
└── mtu_discover/ # MTU discovery implementation
├── mod.rs
└── mtu_discover.rs
socket2 crate for raw socket accesslibc for system callswinapi bindings for Windows-specific functionalityThe project uses a comprehensive error handling strategy:
#[derive(Error, Debug)]
pub enum NetworkError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Permission denied: Administrator privileges required")]
PermissionDenied,
#[error("Network address parsing error: {0}")]
AddressParseError(#[from] std::net::AddrParseError),
// ... more error variants
}
# Run all tests
cargo test
# Run specific module tests
cargo test ping
cargo test traceroute
cargo test arp_scan
cargo test mtu_discover
# Run with specific features
cargo test --features "test"
This project is licensed under the MIT License. See the LICENSE file for details.
socket2 crate developers for providing low-level socket accesspnet crate developers for packet construction utilitiesPermission Denied Errors
# Linux: Run with sudo
sudo ./target/release/network-toolset ping 8.8.8.8
# Windows: Run as Administrator
# Right-click Command Prompt -> "Run as administrator"
Firewall Interference
Interface Not Found
# List available interfaces (Linux)
ip link show
# List available interfaces (Windows)
ipconfig /all
Compilation Errors
# Update dependencies
cargo update
# Clean and rebuild
cargo clean && cargo build --release
--help flag for command-line usage information