DEV Community

Brian Shisia
Brian Shisia

Posted on

Pentest-Kit: A Lightweight Go-Based Network Scanner

Pentest-Kit: A Lightweight Go-Based Network Scanner

Building a comprehensive penetration testing toolkit is a common task for security professionals. Today, I want to share Pentest-Kit, an open-source network scanning tool written in Go that I've been working on.

What is Pentest-Kit?

Pentest-Kit is a command-line tool designed for reconnaissance and network scanning during penetration tests. It supports multiple scanning techniques commonly used in the security industry, all packaged in a single, lightweight binary.

Key Features

Multiple Scanning Techniques

  • SYN Scan: Stealthy scanning using TCP SYN packets
  • UDP Scan: Discover open UDP ports and services
  • FIN Scan: Advanced scanning technique using FIN packets
  • XMAS Scan: Flag combination scanning for firewall evasion
  • Null Scan: Null flag scanning for host discovery
  • TCP Scan: Standard TCP connect scanning
  • Aggressive Scan: Fast, aggressive scanning for quick results

Advanced Capabilities

  • OS Detection: Identify operating systems and services
  • Service Detection: Discover running services and versions
  • Port Range Support: Flexible port specification (e.g., 1-1000, 22,80,443)
  • Timing Templates: Control scan speed with configurable timing
  • Verbose Output: Detailed logging for debugging and analysis

Project Structure

pentest-kit/
├── main.go              # Entry point
├── args.go              # CLI argument parsing
├── scanner/
│   ├── scanner.go       # Core scanning logic
│   ├── types.go         # Data structures
│   ├── output.go        # Result formatting
│   ├── tcp/             # TCP scanning
│   ├── syn/             # SYN scanning
│   ├── udp/             # UDP scanning
│   ├── fin/             # FIN scanning
│   ├── xmas/            # XMAS scanning
│   ├── null/            # Null scanning
│   ├── os/              # OS detection
│   ├── service/         # Service detection
│   ├── aggressive/      # Aggressive scanning
│   └── timing/          # Timing templates
├── utils/
│   └── parser.go        # Utility functions
└── README.md
Enter fullscreen mode Exit fullscreen mode

Usage Examples

Basic TCP Scan

./pentest-kit -host example.com -ports 1-1000
Enter fullscreen mode Exit fullscreen mode

SYN Stealth Scan

./pentest-kit -host example.com -ports 1-1000 -syn
Enter fullscreen mode Exit fullscreen mode

Service Detection with UDP Scan

./pentest-kit -host example.com -ports 53,123,161 -udp -service-detection
Enter fullscreen mode Exit fullscreen mode

Aggressive Scan with Timing

./pentest-kit -host example.com -ports 1-65535 -aggressive -timing insane
Enter fullscreen mode Exit fullscreen mode

OS Detection

./pentest-kit -host example.com -ports 1-10000 -os-detection -verbose
Enter fullscreen mode Exit fullscreen mode

Why Go?

Go is an excellent choice for building security tools:

  1. Performance: Compiled binary with minimal overhead
  2. Concurrency: Goroutines for efficient parallel scanning
  3. Cross-Platform: Easily compile for Linux, macOS, Windows
  4. Simplicity: Clean syntax for building robust tools
  5. Distribution: Single binary with no runtime dependencies

Getting Started

Prerequisites

  • Go 1.16+ (for building from source)
  • Root/Administrator privileges (for raw socket access)

Installation

git clone https://github.com/yourusername/pentest-kit.git
cd pentest-kit
go build
sudo ./pentest-kit -host target.com -ports 1-1000
Enter fullscreen mode Exit fullscreen mode

Important Notes

⚠️ Ethical Considerations: Always use this tool only on systems you own or have explicit permission to test. Unauthorized network scanning is illegal in most jurisdictions.

What's Next?

Future improvements planned for Pentest-Kit include:

  • UDP raw socket scanning improvements
  • NMAP NSE script integration
  • Export results to multiple formats (JSON, CSV, XML)
  • Web UI dashboard for results visualization
  • Performance optimizations for large-scale scans
  • IPv6 support

Contributing

This project is open to contributions! Whether you want to add new scanning techniques, improve performance, or fix bugs, please feel free to submit pull requests.

Conclusion

Pentest-Kit demonstrates how to build powerful security tools with Go. Whether you're learning about network scanning or building your own toolkit, this project provides a solid foundation to expand upon.

Check out the project on GitHub and let me know your thoughts in the comments below!


Have you built any security tools? Share your experience in the comments! 💬

golang #security #networking #opensource

Top comments (0)