{"id":16899925,"url":"https://github.com/gyulyvgc/listeners","last_synced_at":"2025-04-05T07:01:45.996Z","repository":{"id":223751727,"uuid":"761426071","full_name":"GyulyVGC/listeners","owner":"GyulyVGC","description":"Get processes listening on a TCP port in a cross-platform way","archived":false,"fork":false,"pushed_at":"2025-03-19T12:11:01.000Z","size":161,"stargazers_count":51,"open_issues_count":4,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T06:01:36.827Z","etag":null,"topics":["network-programming","rust","tcp"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GyulyVGC.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T21:04:56.000Z","updated_at":"2025-03-09T16:56:01.000Z","dependencies_parsed_at":"2024-03-04T12:47:34.895Z","dependency_job_id":"4a012f97-f31e-4daa-9f9b-0a429f2ce7df","html_url":"https://github.com/GyulyVGC/listeners","commit_stats":null,"previous_names":["gyulyvgc/listeners"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GyulyVGC%2Flisteners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GyulyVGC%2Flisteners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GyulyVGC%2Flisteners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GyulyVGC%2Flisteners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GyulyVGC","download_url":"https://codeload.github.com/GyulyVGC/listeners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299828,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["network-programming","rust","tcp"],"created_at":"2024-10-13T17:50:56.400Z","updated_at":"2025-04-05T07:01:45.931Z","avatar_url":"https://github.com/GyulyVGC.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Listene*rs*\n\n[![Crates](https://img.shields.io/crates/v/listeners?\u0026logo=rust)](https://crates.io/crates/listeners)\n[![Downloads](https://img.shields.io/crates/d/listeners.svg)](https://crates.io/crates/listeners)\n[![Docs](https://docs.rs/listeners/badge.svg)](https://docs.rs/listeners/latest/)\n[![CI](https://github.com/gyulyvgc/listeners/workflows/CI/badge.svg)](https://github.com/GyulyVGC/listeners/actions/)\n\n**Rust library to get processes listening on a TCP port in a cross-platform way.**\n\n## Motivation\n\nDespite some Rust libraries to get process information already exist,\nnone of them satisfies the need to get process ID and name of TCP listeners in a cross-platform way.\n\nSome examples of existing libraries:\n- [netstat2](https://crates.io/crates/netstat2): doesn't provide the process name (and it's unmaintained)\n- [libproc](https://crates.io/crates/libproc): only for Linux and macOS\n- [sysinfo](https://crates.io/crates/sysinfo): doesn't expose the sockets used by each process\n\nThis library wants to fill this gap, and it aims to be: \n- **Cross-platform**: it currently supports Windows, Linux and macOS\n- **Performant**: it internally uses low-level system APIs\n- **Simple**: it exposes intuitive APIs to get details about the listening processes\n- **Lightweight**: it has only the strictly necessary dependencies\n\n## Roadmap\n\n- [x] Windows\n- [x] Linux\n- [x] macOS\n- [ ] BSD\n- [ ] iOS\n- [ ] Android\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n``` toml\n[dependencies]\n\nlisteners = \"0.2\"\n```\n\nGet all the listening processes:\n\n``` rust\nif let Ok(listeners) = listeners::get_all() {\n    for l in listeners {\n        println!(\"{l}\");\n    }\n}\n```\n\nOutput:\n\n``` text\nPID: 1088       Process name: rustrover                 Socket: [::7f00:1]:63342\nPID: 609        Process name: Microsoft SharePoint      Socket: [::1]:42050\nPID: 160        Process name: mysqld                    Socket: [::]:33060\nPID: 160        Process name: mysqld                    Socket: [::]:3306\nPID: 460        Process name: rapportd                  Socket: 0.0.0.0:50928\nPID: 460        Process name: rapportd                  Socket: [::]:50928 \n```\n \nFor more examples of usage, including how to get listening processes in a more granular way,\ncheck the [`examples`](https://github.com/GyulyVGC/listeners/tree/main/examples) folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyulyvgc%2Flisteners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgyulyvgc%2Flisteners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyulyvgc%2Flisteners/lists"}