#connection #access-control #command-line-tool #process #activity #monitoring #real-time

app reqtrace

A Simple command-line tool for real-time network activity monitoring, connection tracing, and network access control of any process or command

5 releases

new 0.2.2 Dec 12, 2024
0.2.1 Dec 12, 2024
0.2.0 Dec 12, 2024
0.1.1 Dec 12, 2024
0.1.0 Dec 12, 2024

#256 in Network programming

MIT license

23KB
354 lines

reqtrace 🔍

A Simple command-line tool for real-time network activity monitoring, connection tracing, and network access control of any process or command.

Crates.io License: MIT

🚀 Features

  • Universal Command Monitoring: Monitor any command or process (curl, wget, npm, python, etc.)
  • Real-time Connection Tracking: Live visualization of all network connections
  • Domain Resolution: Automatic DNS resolution for IP addresses
  • Network Control Modes:
    • Monitor Only: Watch and log connections
    • Block & Exit: Terminate on first connection attempt
    • Block & Continue: Prevent network access while allowing execution
  • Detailed Statistics: Connection counts, unique domains, and IPs
  • Beautiful CLI Interface: Clear, colorful, and informative output

📦 Installation

cargo install reqtrace

🎯 Use Cases

Development & Testing

  • Test applications for unexpected network calls
  • Debug API integrations
  • Monitor dependency downloads
  • Verify offline-first functionality

Security & Compliance

  • Audit network behavior of third-party tools
  • Enforce network access policies
  • Detect unwanted analytics or tracking
  • Validate security requirements

System Administration

  • Monitor service network activity
  • Debug connection issues
  • Profile network usage
  • Control application network access

📚 Examples

Monitor Package Manager Activity

# Track npm installation network activity
reqtrace npm install express

# Monitor pip package downloads
reqtrace pip install requests

# Watch cargo dependencies
reqtrace cargo build

Security Testing

# Ensure a script doesn't make unauthorized connections
reqtrace -e python script.py

# Block all network access but allow execution
reqtrace -b node app.js

# Monitor Docker container network activity
reqtrace docker run nginx

API Development

# Debug API client connections
reqtrace curl api.example.com

# Monitor GraphQL queries
reqtrace npm run graphql-app

# Track WebSocket connections
reqtrace node websocket-server.js

🛠️ Command-Line Options

reqtrace [OPTIONS] <COMMAND> [ARGS]...

Options:
  -e, --exit-first     Exit on first network connection
  -b, --block         Block all network connections
  -t, --timeout       DNS lookup timeout (default: 1000ms)
  -v, --verbose       Show detailed debug information
  -h, --help          Show help information
  -V, --version       Show version information

🔧 Technical Details

Platform Support

  • ✅ Linux: Native /proc filesystem monitoring
  • ✅ macOS: Integration with lsof

Monitoring Capabilities

  • TCP connections (IPv4 and IPv6)
  • Domain name resolution
  • Connection timestamps
  • Process hierarchy

Performance Impact

  • Minimal overhead
  • Non-blocking DNS resolution
  • Efficient connection caching

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

📄 License

MIT License - feel free to use in personal and commercial projects.

🌟 Star History

Star History Chart

Dependencies

~5–13MB
~142K SLoC