https://github.com/fmotalleb/nu_plugin_port_extension
A nushell plugin to list all active connections and scanning ports on a target address (replacement of both nu_plugin_port_scan and nu_plugin_port_list since 0.102)
https://github.com/fmotalleb/nu_plugin_port_extension
netcat netstat nushell portscanner
Last synced: about 2 months ago
JSON representation
A nushell plugin to list all active connections and scanning ports on a target address (replacement of both nu_plugin_port_scan and nu_plugin_port_list since 0.102)
- Host: GitHub
- URL: https://github.com/fmotalleb/nu_plugin_port_extension
- Owner: FMotalleb
- License: mit
- Created: 2025-02-10T15:34:11.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-03-20T20:47:22.000Z (2 months ago)
- Last Synced: 2025-03-20T22:04:42.405Z (2 months ago)
- Topics: netcat, netstat, nushell, portscanner
- Language: Rust
- Homepage:
- Size: 73.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔌 nu_plugin_port_extension
A [Nushell](https://www.nushell.sh/) plugin for inspecting open ports and scanning network services. It introduces two subcommands:
- **`port list`**: Lists all open network connections, similar to `netstat`.
- **`port scan`**: Scans a target IP and port to determine if it is open.---
## ✨ Features
### **`port list`** – List Active Connections
The `port list` command retrieves all open connections on the network interface. It supports filtering by protocol, IP version, and listening state.#### 📌 Usage
```bash
port list {flags}
```#### ⚙️ Available Flags
- `-h, --help` → Show help message.
- `-6, --disable-ipv4` → Exclude IPv4 connections (only show IPv6).
- `-4, --disable-ipv6` → Exclude IPv6 connections (only show IPv4).
- `-t, --disable-udp` → Exclude UDP connections (only show TCP).
- `-u, --disable-tcp` → Exclude TCP connections (only show UDP).
- `-l, --listeners` → Show only listening connections (`state == "LISTEN"`).
- `-p, --process-info` → Include process details (name, command, binary path).#### 🔍 Example: Show Active Processes
```bash
port list -p | take 1
```#### 📊 Example Output
|pid |type|ip_version|local_address|local_port|remote_address|remote_port|state |process_name|cmd |exe_path |
|-----|----|----------|-------------|----------|--------------|----------|-----------|------------|--------------------------------------------------|--------------------------------------|
|11536|tcp |4 |127.0.0.1 |1093 |127.0.0.1 |1108 |ESTABLISHED|steam.exe |[C:\Program Files (x86)\Steam\steam.exe, -silent]|C:\Program Files (x86)\Steam\steam.exe|---
### **`port scan`** – Scan Open Ports
The `port scan` command checks if a specific port is open on a target IP, similar to `nc -vz {ip} {port}`.> **⚠️ Note:** Only **TCP** scanning is supported at the moment.
#### 📌 Usage
```bash
port scan {flags}
```#### ⚙️ Available Flags
- `-h, --help` → Show help message.
- `-t, --timeout ` → Set timeout before giving up (default: 60s).
- `-s, --send ` → Send data to the target upon connection.
- `-b, --receive-byte-count ` → Number of bytes to receive before confirming the connection is open.#### 🎯 Parameters
- **`target IP`** *(string)* – The IP address to scan.
- **`port`** *(integer)* – The port number to check.#### 🔍 Example: Check if Google's Public DNS (8.8.8.8) has Port 53 Open
```bash
port scan 8.8.8.8 53 -t 1sec
```#### 📊 Example Output
```
╭─────────┬─────────╮
│ address │ 8.8.8.8 │
│ port │ 53 │
│ is_open │ true │
│ elapsed │ 40ms │
╰─────────┴─────────╯
```#### 🔄 Example: Scan a Range of Ports on `127.0.0.1` and Filter Open Ports
```bash
7880..8000 | each { |it| port scan 127.0.0.1 $it -t 1ms } | where result == Open
```---
## 🔧 Installation
### 🚀 Recommended: Using [nupm](https://github.com/nushell/nupm)
This method automatically handles dependencies and features.
```bash
git clone https://github.com/FMotalleb/nu_plugin_port_extension.git
nupm install --path nu_plugin_port_extension -f
```### 🛠️ Manual Compilation
```bash
git clone https://github.com/FMotalleb/nu_plugin_port_extension.git
cd nu_plugin_port_extension
cargo build -r
plugin add target/release/nu_plugin_port_extension
```### 📦 Install via Cargo (using git)
```bash
cargo install --git https://github.com/FMotalleb/nu_plugin_port_extension.git
plugin add ~/.cargo/bin/nu_plugin_port_extension
```### 📦 Install via Cargo (crates.io) _Not Recommended_
> *Since I live in Iran and crates.io often restricts package updates, the version there might be outdated.*
```bash
cargo install nu_plugin_port_extension
plugin add ~/.cargo/bin/nu_plugin_port_extension
```