GithubHelp home page GithubHelp logo

fmotalleb / nu_plugin_port_list Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 208 KB

A nushell plugin to display all active network connections.

License: MIT License

Rust 94.62% Nushell 5.38%
netstat networking nushell-plugin

nu_plugin_port_list's Introduction

nu_plugin_port_list

A nushell plugin to display all active network connections. similar to netstat -ntp

Important: to list pid correctly it needs to run as a privileged user (root)

  • flags
  -6, --disable-ipv4 - do not fetch ipv4 connections (ipv6 only)
  -4, --disable-ipv6 - do not fetch ipv6 connections (ipv4 only)
  -t, --disable-udp - do not fetch UDP connections (TCP only)
  -u, --disable-tcp - do not fetch TCP connections (UDP only)
  -p, --process-info - loads process info (process_name, cmd, binary path, ...)

Examples

  • list all open ports
~> port list
type ip_version local_address local_port remote_address remote_port state pid
tcp 4 0.0.0.0 22 0.0.0.0 0 LISTEN 1000
tcp 4 192.168.100.8 42352 ... 780 ESTABLISHED 9343
tcp 4 192.168.100.8 60564 ... 443 ESTABLISHED 2899
tcp 4 127.0.0.1 38946 127.0.0.1 7890 ESTABLISHED 3376
tcp 4 127.0.0.1 50180 127.0.0.1 37921 ESTABLISHED 7620
  • list all open tcp port that are in LISTEN state and using local address 0.0.0.0
~> port list | where state == LISTEN and local_address == 0.0.0.0
type ip_version local_address local_port remote_address remote_port state pid
tcp 4 0.0.0.0 7070 0.0.0.0 0 LISTEN 993
tcp 4 0.0.0.0 3306 0.0.0.0 0 LISTEN 9953
tcp 4 0.0.0.0 9000 0.0.0.0 0 LISTEN 1525
tcp 4 0.0.0.0 8585 0.0.0.0 0 LISTEN 10693
tcp 4 0.0.0.0 22 0.0.0.0 0 LISTEN 1000
  • get process that is listening on a port
~> port list -t4p
type ip_version local_address local_port remote_address remote_port state pid process_name cmd exe_path process_status process_user process_group process_effective_user process_effective_group process_environments
tcp 4 127.0.0.1 631 0.0.0.0 0 LISTEN 986 cupsd /usr/sbin/cupsd -l /usr/sbin/cupsd Sleeping 0 0 0 0 [LANG=en_US.UTF-8,...]

Installing

git clone https://github.com/FMotalleb/nu_plugin_port_list.git
nupm install --path nu_plugin_port_list -f
  • or compile manually
git clone https://github.com/FMotalleb/nu_plugin_port_list.git
cd nu_plugin_port_list
cargo build -r
register target/release/nu_plugin_port_list
  • or using cargo
cargo install nu_plugin_port_list
register ~/.cargo/bin/nu_plugin_port_list

nu_plugin_port_list's People

Contributors

dependabot[bot] avatar fmotalleb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.