portmap-dev 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- portmap_dev-1.1.0/.gitignore +20 -0
- portmap_dev-1.1.0/LICENSE +21 -0
- portmap_dev-1.1.0/PKG-INFO +194 -0
- portmap_dev-1.1.0/README.md +171 -0
- portmap_dev-1.1.0/pyproject.toml +44 -0
- portmap_dev-1.1.0/src/portmap/__init__.py +2 -0
- portmap_dev-1.1.0/src/portmap/__main__.py +5 -0
- portmap_dev-1.1.0/src/portmap/cli.py +40 -0
- portmap_dev-1.1.0/src/portmap/main.py +201 -0
- portmap_dev-1.1.0/src/portmap/scraper.py +131 -0
- portmap_dev-1.1.0/src/portmap/static/index.html +806 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdallah Rabie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: portmap-dev
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Real-time dashboard for monitoring and managing local listening ports
|
|
5
|
+
Project-URL: Homepage, https://github.com/abdallah-9a/Portmap
|
|
6
|
+
Project-URL: Repository, https://github.com/abdallah-9a/Portmap
|
|
7
|
+
Project-URL: Issues, https://github.com/abdallah-9a/Portmap/issues
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: dashboard,developer-tools,monitoring,networking,ports
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: fastapi>=0.111
|
|
20
|
+
Requires-Dist: psutil>=5.9
|
|
21
|
+
Requires-Dist: uvicorn[standard]>=0.29
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Portmap
|
|
25
|
+
|
|
26
|
+
A real-time dashboard for the listening ports on your machine. Portmap shows
|
|
27
|
+
*what* is listening on every port, identifies the **project or service** behind
|
|
28
|
+
each one, and lets you terminate a process with a single click.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Overview
|
|
36
|
+
|
|
37
|
+
*"What is running on port 3000 — and why won't it die?"* Every developer hits
|
|
38
|
+
this eventually. On a busy machine, dozens of dev servers, watchers, and
|
|
39
|
+
forgotten daemons compete for ports, and tracking down which one belongs to
|
|
40
|
+
which project — then stopping it safely — usually means a chain of `lsof`,
|
|
41
|
+
`grep`, and `kill`.
|
|
42
|
+
|
|
43
|
+
Portmap turns that into a glance. It keeps a live, categorized view of every
|
|
44
|
+
listening port — which project or service owns it, and whether it is safe to
|
|
45
|
+
kill — and lets you stop a process with one click, right from the browser.
|
|
46
|
+
|
|
47
|
+
Under the hood it is a lightweight, local, single-user tool: a FastAPI backend
|
|
48
|
+
plus a single static HTML page. No database, no build step.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Why Portmap?
|
|
53
|
+
|
|
54
|
+
`lsof`, `ss`, and `netstat` already list open ports — but they stop at the PID.
|
|
55
|
+
Portmap is built for the step after that: understanding and acting on what you
|
|
56
|
+
find.
|
|
57
|
+
|
|
58
|
+
- **Answers "whose port is this?", not just "what PID?"** — each port is traced
|
|
59
|
+
to a git project and framework, instead of leaving you to map PIDs by hand.
|
|
60
|
+
- **Live, not a one-off snapshot.** The view updates as servers start and stop,
|
|
61
|
+
so you don't re-run a command and re-read its output every time.
|
|
62
|
+
- **Kill from the same place.** No copying a PID into a separate `kill` command —
|
|
63
|
+
and system-owned processes are guarded against accidental termination.
|
|
64
|
+
- **Less noise.** IDE helpers and Chromium/Electron subprocesses are filtered
|
|
65
|
+
out, so you see services rather than internals.
|
|
66
|
+
|
|
67
|
+
If you just need a one-off list, `ss -ltnp` is perfect. Portmap is for when you
|
|
68
|
+
are juggling many services and want to watch and manage them continuously.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
Linux with Python 3.12+:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/abdallah-9a/Portmap.git
|
|
78
|
+
cd Portmap
|
|
79
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
80
|
+
pip install -r requirements.txt
|
|
81
|
+
fastapi run main.py
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then open <http://127.0.0.1:8000>. See [Installation](#installation) and
|
|
85
|
+
[Usage](#usage) for details.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
|
|
91
|
+
- **Live updates** — ports are rescanned every 0.5s and pushed to the browser
|
|
92
|
+
over a websocket; the UI updates only when something actually changes.
|
|
93
|
+
- **Smart identification** — each listening port is categorized as:
|
|
94
|
+
- **Project** — traced to a git repository, with framework detection
|
|
95
|
+
(Django, Node.js, Go, Rust, Ruby, Java, PHP, …).
|
|
96
|
+
- **Infrastructure** — known daemons like Redis, PostgreSQL, MySQL, MongoDB,
|
|
97
|
+
Nginx, Docker.
|
|
98
|
+
- **System** — kernel/system sockets with no owning PID.
|
|
99
|
+
- **Unknown** — an honest fallback showing the raw process name.
|
|
100
|
+
- **Noise filtering** — IDE helpers (VS Code, Cursor, JetBrains, …) and
|
|
101
|
+
Chromium/Electron internal processes are skipped.
|
|
102
|
+
- **One-click kill** — `SIGTERM` first, escalating to `SIGKILL` if the process
|
|
103
|
+
doesn't exit within the grace period.
|
|
104
|
+
- **Safety guard** — processes owned by privileged/system accounts (UID < 1000)
|
|
105
|
+
are protected and cannot be killed from the UI.
|
|
106
|
+
- **Non-blocking scanner** — scanning runs in a background thread, so the event
|
|
107
|
+
loop stays responsive for websocket updates and kill requests.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Installation
|
|
112
|
+
|
|
113
|
+
**Requirements:** Linux, Python 3.12+.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# 1. Clone
|
|
117
|
+
git clone https://github.com/abdallah-9a/Portmap.git
|
|
118
|
+
cd Portmap
|
|
119
|
+
|
|
120
|
+
# 2. Create and activate a virtual environment
|
|
121
|
+
python3 -m venv .venv
|
|
122
|
+
source .venv/bin/activate
|
|
123
|
+
|
|
124
|
+
# 3. Install dependencies
|
|
125
|
+
pip install -r requirements.txt
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Usage
|
|
131
|
+
|
|
132
|
+
Start the server:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
fastapi run main.py
|
|
136
|
+
# or, equivalently:
|
|
137
|
+
# uvicorn main:app
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Then open the UI in your browser:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
http://127.0.0.1:8000
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Use the search box to filter by port or name, and click **Kill** next to a
|
|
147
|
+
process to terminate it.
|
|
148
|
+
|
|
149
|
+
> **Note:** `psutil` may need elevated privileges to see the owning PID of every
|
|
150
|
+
> socket. If some ports show up as "System" or with missing details, try running
|
|
151
|
+
> with `sudo` (be aware this also lets the kill endpoint act with root
|
|
152
|
+
> privileges).
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Screenshots & Demo
|
|
157
|
+
|
|
158
|
+
The hero screenshot sits at the top of this README — the first thing a visitor
|
|
159
|
+
sees. This section is for the moving picture:
|
|
160
|
+
|
|
161
|
+

|
|
162
|
+
|
|
163
|
+
_A short capture of the live updates and one-click kill in action._
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Limitations
|
|
168
|
+
|
|
169
|
+
- **Linux only.** Portmap relies on Linux semantics: `/proc`-based working
|
|
170
|
+
directory lookup for git detection, real UID ownership checks, and the
|
|
171
|
+
`UID < 1000` system-account protection. It is untested on macOS/Windows.
|
|
172
|
+
- **No authentication.** Anyone who can reach the server can kill processes.
|
|
173
|
+
Bind it to `127.0.0.1` (the default) and do **not** expose it to a network.
|
|
174
|
+
- **Single user / local use.** It is designed as a personal dev tool, not a
|
|
175
|
+
multi-tenant service.
|
|
176
|
+
- **Privilege-dependent visibility.** Without elevated privileges, some sockets'
|
|
177
|
+
PIDs and metadata may be hidden by the OS.
|
|
178
|
+
- **Git-root heuristic.** Project detection assumes a process's working
|
|
179
|
+
directory lives inside its repository; processes started elsewhere may fall
|
|
180
|
+
back to "Unknown".
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
Issues and pull requests are welcome. For anything beyond a small fix, please
|
|
187
|
+
open an issue first to discuss the approach. For local development, run
|
|
188
|
+
`fastapi dev main.py` to get auto-reload.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Portmap
|
|
2
|
+
|
|
3
|
+
A real-time dashboard for the listening ports on your machine. Portmap shows
|
|
4
|
+
*what* is listening on every port, identifies the **project or service** behind
|
|
5
|
+
each one, and lets you terminate a process with a single click.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
*"What is running on port 3000 — and why won't it die?"* Every developer hits
|
|
15
|
+
this eventually. On a busy machine, dozens of dev servers, watchers, and
|
|
16
|
+
forgotten daemons compete for ports, and tracking down which one belongs to
|
|
17
|
+
which project — then stopping it safely — usually means a chain of `lsof`,
|
|
18
|
+
`grep`, and `kill`.
|
|
19
|
+
|
|
20
|
+
Portmap turns that into a glance. It keeps a live, categorized view of every
|
|
21
|
+
listening port — which project or service owns it, and whether it is safe to
|
|
22
|
+
kill — and lets you stop a process with one click, right from the browser.
|
|
23
|
+
|
|
24
|
+
Under the hood it is a lightweight, local, single-user tool: a FastAPI backend
|
|
25
|
+
plus a single static HTML page. No database, no build step.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Why Portmap?
|
|
30
|
+
|
|
31
|
+
`lsof`, `ss`, and `netstat` already list open ports — but they stop at the PID.
|
|
32
|
+
Portmap is built for the step after that: understanding and acting on what you
|
|
33
|
+
find.
|
|
34
|
+
|
|
35
|
+
- **Answers "whose port is this?", not just "what PID?"** — each port is traced
|
|
36
|
+
to a git project and framework, instead of leaving you to map PIDs by hand.
|
|
37
|
+
- **Live, not a one-off snapshot.** The view updates as servers start and stop,
|
|
38
|
+
so you don't re-run a command and re-read its output every time.
|
|
39
|
+
- **Kill from the same place.** No copying a PID into a separate `kill` command —
|
|
40
|
+
and system-owned processes are guarded against accidental termination.
|
|
41
|
+
- **Less noise.** IDE helpers and Chromium/Electron subprocesses are filtered
|
|
42
|
+
out, so you see services rather than internals.
|
|
43
|
+
|
|
44
|
+
If you just need a one-off list, `ss -ltnp` is perfect. Portmap is for when you
|
|
45
|
+
are juggling many services and want to watch and manage them continuously.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
Linux with Python 3.12+:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/abdallah-9a/Portmap.git
|
|
55
|
+
cd Portmap
|
|
56
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
57
|
+
pip install -r requirements.txt
|
|
58
|
+
fastapi run main.py
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then open <http://127.0.0.1:8000>. See [Installation](#installation) and
|
|
62
|
+
[Usage](#usage) for details.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Live updates** — ports are rescanned every 0.5s and pushed to the browser
|
|
69
|
+
over a websocket; the UI updates only when something actually changes.
|
|
70
|
+
- **Smart identification** — each listening port is categorized as:
|
|
71
|
+
- **Project** — traced to a git repository, with framework detection
|
|
72
|
+
(Django, Node.js, Go, Rust, Ruby, Java, PHP, …).
|
|
73
|
+
- **Infrastructure** — known daemons like Redis, PostgreSQL, MySQL, MongoDB,
|
|
74
|
+
Nginx, Docker.
|
|
75
|
+
- **System** — kernel/system sockets with no owning PID.
|
|
76
|
+
- **Unknown** — an honest fallback showing the raw process name.
|
|
77
|
+
- **Noise filtering** — IDE helpers (VS Code, Cursor, JetBrains, …) and
|
|
78
|
+
Chromium/Electron internal processes are skipped.
|
|
79
|
+
- **One-click kill** — `SIGTERM` first, escalating to `SIGKILL` if the process
|
|
80
|
+
doesn't exit within the grace period.
|
|
81
|
+
- **Safety guard** — processes owned by privileged/system accounts (UID < 1000)
|
|
82
|
+
are protected and cannot be killed from the UI.
|
|
83
|
+
- **Non-blocking scanner** — scanning runs in a background thread, so the event
|
|
84
|
+
loop stays responsive for websocket updates and kill requests.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
**Requirements:** Linux, Python 3.12+.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# 1. Clone
|
|
94
|
+
git clone https://github.com/abdallah-9a/Portmap.git
|
|
95
|
+
cd Portmap
|
|
96
|
+
|
|
97
|
+
# 2. Create and activate a virtual environment
|
|
98
|
+
python3 -m venv .venv
|
|
99
|
+
source .venv/bin/activate
|
|
100
|
+
|
|
101
|
+
# 3. Install dependencies
|
|
102
|
+
pip install -r requirements.txt
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
Start the server:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
fastapi run main.py
|
|
113
|
+
# or, equivalently:
|
|
114
|
+
# uvicorn main:app
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Then open the UI in your browser:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
http://127.0.0.1:8000
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Use the search box to filter by port or name, and click **Kill** next to a
|
|
124
|
+
process to terminate it.
|
|
125
|
+
|
|
126
|
+
> **Note:** `psutil` may need elevated privileges to see the owning PID of every
|
|
127
|
+
> socket. If some ports show up as "System" or with missing details, try running
|
|
128
|
+
> with `sudo` (be aware this also lets the kill endpoint act with root
|
|
129
|
+
> privileges).
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Screenshots & Demo
|
|
134
|
+
|
|
135
|
+
The hero screenshot sits at the top of this README — the first thing a visitor
|
|
136
|
+
sees. This section is for the moving picture:
|
|
137
|
+
|
|
138
|
+

|
|
139
|
+
|
|
140
|
+
_A short capture of the live updates and one-click kill in action._
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Limitations
|
|
145
|
+
|
|
146
|
+
- **Linux only.** Portmap relies on Linux semantics: `/proc`-based working
|
|
147
|
+
directory lookup for git detection, real UID ownership checks, and the
|
|
148
|
+
`UID < 1000` system-account protection. It is untested on macOS/Windows.
|
|
149
|
+
- **No authentication.** Anyone who can reach the server can kill processes.
|
|
150
|
+
Bind it to `127.0.0.1` (the default) and do **not** expose it to a network.
|
|
151
|
+
- **Single user / local use.** It is designed as a personal dev tool, not a
|
|
152
|
+
multi-tenant service.
|
|
153
|
+
- **Privilege-dependent visibility.** Without elevated privileges, some sockets'
|
|
154
|
+
PIDs and metadata may be hidden by the OS.
|
|
155
|
+
- **Git-root heuristic.** Project detection assumes a process's working
|
|
156
|
+
directory lives inside its repository; processes started elsewhere may fall
|
|
157
|
+
back to "Unknown".
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Contributing
|
|
162
|
+
|
|
163
|
+
Issues and pull requests are welcome. For anything beyond a small fix, please
|
|
164
|
+
open an issue first to discuss the approach. For local development, run
|
|
165
|
+
`fastapi dev main.py` to get auto-reload.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "portmap-dev"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "Real-time dashboard for monitoring and managing local listening ports"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["developer-tools", "ports", "monitoring", "networking", "dashboard"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Topic :: System :: Networking :: Monitoring",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Operating System :: POSIX :: Linux",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"fastapi>=0.111",
|
|
24
|
+
"uvicorn[standard]>=0.29",
|
|
25
|
+
"psutil>=5.9",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/abdallah-9a/Portmap"
|
|
30
|
+
Repository = "https://github.com/abdallah-9a/Portmap"
|
|
31
|
+
Issues = "https://github.com/abdallah-9a/Portmap/issues"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
portmap = "portmap.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.wheel]
|
|
37
|
+
packages = ["src/portmap"]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.sdist]
|
|
40
|
+
include = [
|
|
41
|
+
"src/portmap/**",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# src/portmap/cli.py
|
|
2
|
+
import argparse
|
|
3
|
+
import uvicorn
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
prog="portmap",
|
|
10
|
+
description="Real-time dashboard for local listening ports."
|
|
11
|
+
)
|
|
12
|
+
parser.add_argument(
|
|
13
|
+
"--port", "-p",
|
|
14
|
+
type=int,
|
|
15
|
+
default=7474,
|
|
16
|
+
help="Port to run the Portmap dashboard on (default: 7474)"
|
|
17
|
+
)
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--host",
|
|
20
|
+
default="127.0.0.1",
|
|
21
|
+
help="Host to bind to (default: 127.0.0.1)"
|
|
22
|
+
)
|
|
23
|
+
parser.add_argument(
|
|
24
|
+
"--version", "-v",
|
|
25
|
+
action="version",
|
|
26
|
+
version="%(prog)s 1.1.0"
|
|
27
|
+
)
|
|
28
|
+
args = parser.parse_args()
|
|
29
|
+
|
|
30
|
+
print(f"Portmap running at http://{args.host}:{args.port}")
|
|
31
|
+
uvicorn.run(
|
|
32
|
+
"portmap.main:app",
|
|
33
|
+
host=args.host,
|
|
34
|
+
port=args.port,
|
|
35
|
+
log_level="warning" # suppress uvicorn noise, portmap speaks for itself
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
main()
|