Jesús Pérez d9ef2f0d5b
Some checks failed
Build and Test / Validate Setup (push) Has been cancelled
Build and Test / Build (darwin-amd64) (push) Has been cancelled
Build and Test / Build (darwin-arm64) (push) Has been cancelled
Build and Test / Build (linux-amd64) (push) Has been cancelled
Build and Test / Build (windows-amd64) (push) Has been cancelled
Build and Test / Build (linux-arm64) (push) Has been cancelled
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Package Results (push) Has been cancelled
Build and Test / Quality Gate (push) Has been cancelled
Nightly Build / Check for Changes (push) Has been cancelled
Nightly Build / Validate Setup (push) Has been cancelled
Nightly Build / Nightly Build (darwin-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (darwin-arm64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (windows-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-arm64) (push) Has been cancelled
Nightly Build / Create Nightly Pre-release (push) Has been cancelled
Nightly Build / Notify Build Status (push) Has been cancelled
Nightly Build / Nightly Maintenance (push) Has been cancelled
chore: update all plugins to Nushell 0.111.0
- Bump all 18 plugins from 0.110.0 to 0.111.0
  - Update rust-toolchain.toml channel to 1.93.1 (nu 0.111.0 requires ≥1.91.1)

  Fixes:
  - interprocess pin =2.2.x → ^2.3.1 in nu_plugin_mcp, nu_plugin_nats, nu_plugin_typedialog
    (required by nu-plugin-core 0.111.0)
  - nu_plugin_typedialog: BackendType::Web initializer — add open_browser: false field
  - nu_plugin_auth: implement missing user_info_to_value helper referenced in tests

  Scripts:
  - update_all_plugins.nu: fix [package].version update on minor bumps; add [dev-dependencies]
    pass; add nu-plugin-test-support to managed crates
  - download_nushell.nu: rustup override unset before rm -rf on nushell dir replace;
    fix unclosed ) in string interpolation
2026-03-11 03:22:42 +00:00

139 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🔌 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
```nushell
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
```nushell
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
```nushell
bash
port scan {flags} <target IP> <port>
```
#### ⚙️ Available Flags
- `-h, --help` → Show help message.
- `-t, --timeout <duration>` → Set timeout before giving up (default: 60s).
- `-s, --send <string>` → Send data to the target upon connection.
- `-b, --receive-byte-count <int>` → 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
```nushell
bash
port scan 8.8.8.8 53 -t 1sec
```
#### 📊 Example Output
```nushell
plaintext
╭─────────┬─────────╮
│ 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
```nushell
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.
```nushell
bash
git clone https://github.com/FMotalleb/nu_plugin_port_extension.git
nupm install --path nu_plugin_port_extension -f
```
### 🛠️ Manual Compilation
```nushell
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)
```rust
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.*
```nushell
bash
cargo install nu_plugin_port_extension
plugin add ~/.cargo/bin/nu_plugin_port_extension
```