Skip to content

h0wdee/portscraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

portscraper

A CLI tool that looks up port information from speedguide.net (via web.archive.org) and displays it in a formatted table in your terminal.

Features

  • Looks up port information for any valid port (0-65535)
  • Fetches data from web.archive.org snapshot of speedguide.net
  • Formats output as a readable table in your terminal
  • Automatically adapts to terminal width (defaults to 80 columns if detection fails)

Dependencies

System Dependencies

# Debian/Ubuntu
sudo apt install libssl-dev

# Fedora/RHEL
sudo dnf install openssl-devel

# macOS (via Homebrew)
brew install openssl

Rust Dependencies

  • reqwest - HTTP client for fetching port data
  • scraper - HTML parsing and CSS selector support
  • html2text - Converts HTML tables to terminal-friendly text
  • term_size - Terminal dimension detection

Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/portscraper.git
cd portscraper

# Build and install
cargo install --path .

Using the Install Script (Linux)

./linux_install.sh

Usage

portscraper <port>

Examples

# Look up HTTP port
portscraper 80

# Look up HTTPS port
portscraper 443

# Look up SSH port
portscraper 22

Exit Codes

  • 0 - Success
  • 1 - Error (invalid port, no data found, or network error)

API

The library exposes the following public functions:

build_target(port: i32, target: String) -> String

Constructs the full URL by appending the port number to the base URL.

do_gets(port: i32, target: String) -> Result<Response, reqwest::Error>

Performs an HTTP GET request to fetch port information.

parse_table(html: &str) -> Option<String>

Parses the HTML response and extracts the port information table.

License

See LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors