wtfport 0.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.
wtfport-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: wtfport
3
+ Version: 0.1.0
4
+ Summary: CLI tool to watch system port usage
5
+ Author-email: Henry <henry@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/yourname/wtfport
8
+ Project-URL: Issues, https://github.com/yourname/wtfport/issues
9
+ Keywords: ports,network,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Debuggers
25
+ Classifier: Topic :: System :: Networking
26
+ Classifier: Topic :: Utilities
27
+ Requires-Python: >=3.7
28
+ Description-Content-Type: text/markdown
29
+ Requires-Dist: psutil
30
+ Requires-Dist: click
31
+ Provides-Extra: dev
32
+ Requires-Dist: build; extra == "dev"
33
+ Requires-Dist: twine; extra == "dev"
34
+ Requires-Dist: pytest; extra == "dev"
35
+
36
+ # wtfport
37
+
38
+ A terminal-based tool that provides developers with an intuitive, human-friendly way to identify, inspect, and interact with processes bound to specific ports on their system.
39
+
40
+ ![wtfport demo](https://raw.githubusercontent.com/hungwahenry/wtfport/main/docs/demo.gif)
41
+
42
+ ## Features
43
+
44
+ - **Port Lookup**: Quickly show details about the process using a specific port
45
+ - **Process Management**: Kill a process running on a port with a simple command
46
+ - **Cross-Platform Support**: Available for macOS, Linux, and Windows
47
+ - **Colorized Output**: Clear, visually appealing terminal output
48
+ - **Watch Mode**: Continuously monitor and update port usage
49
+ - **Interactive Mode**: Simple interface for interacting with processes
50
+ - **Clipboard Support**: Copy process commands directly to clipboard
51
+ - **Web Server Detection**: Quick access to open web servers in browser
52
+ - **Log Tailing**: Ability to detect and tail logs for processes
53
+ - **Port Statistics**: Track and analyze your most frequently used ports
54
+ - **Notifications**: Get alerted when a specific port becomes active
55
+
56
+ ## Installation
57
+
58
+ ### Using pip
59
+
60
+ ```bash
61
+ pip install wtfport
62
+ ```
63
+
64
+ ### Using Homebrew (macOS/Linux)
65
+
66
+ ```bash
67
+ brew install wtfport
68
+ ```
69
+
70
+ ### From Source
71
+
72
+ ```bash
73
+ git clone https://github.com/yourusername/wtfport.git
74
+ cd wtfport
75
+ pip install -e .
76
+ ```
77
+
78
+ ## Usage
79
+
80
+ ### Basic Commands
81
+
82
+ Check a specific port:
83
+ ```bash
84
+ wtfport 3000
85
+ ```
86
+
87
+ Show all listening ports:
88
+ ```bash
89
+ wtfport
90
+ # or
91
+ wtfport --all
92
+ ```
93
+
94
+ Kill a process on a port:
95
+ ```bash
96
+ wtfport 3000 --kill
97
+ ```
98
+
99
+ ### Monitoring Features
100
+
101
+ Watch a port for changes:
102
+ ```bash
103
+ wtfport 3000 --watch
104
+ ```
105
+
106
+ Get notified when a port becomes active:
107
+ ```bash
108
+ wtfport --notify 5000
109
+ ```
110
+
111
+ ### For Web Developers
112
+
113
+ Open a web server in browser:
114
+ ```bash
115
+ wtfport 3000 --open
116
+ ```
117
+
118
+ ### Port Statistics and History
119
+
120
+ View port usage statistics:
121
+ ```bash
122
+ wtfport --stats
123
+ ```
124
+
125
+ View detailed history for a specific port:
126
+ ```bash
127
+ wtfport --stats-detail 3000
128
+ ```
129
+
130
+ ### Automation & Scripting
131
+
132
+ Get JSON output for scripting:
133
+ ```bash
134
+ wtfport 3000 --json
135
+ ```
136
+
137
+ Copy the command to clipboard:
138
+ ```bash
139
+ wtfport 3000 --copy
140
+ ```
141
+
142
+ ### Interactive Mode
143
+
144
+ When running `wtfport <port>` without additional flags, you'll enter interactive mode where you can:
145
+
146
+ - Open the port in a browser
147
+ - Kill the process
148
+ - Copy the command to clipboard
149
+ - Tail logs (if available)
150
+
151
+ ## Examples
152
+
153
+ ### Finding What's Using a Port
154
+
155
+ ```bash
156
+ $ wtfport 3000
157
+
158
+ Port 3000 is being used by:
159
+ ╭──────────────────────────────────────────────────────────────────╮
160
+ │ │
161
+ │ ✓ Process: node │
162
+ │ PID: 1234 │
163
+ │ Command: node server.js │
164
+ │ User: yourname │
165
+ │ Started: 3m ago │
166
+ │ │
167
+ ╰──────────────────────────────────────────────────────────────────╯
168
+
169
+ Options:
170
+ [O] Open in browser (http://localhost:3000)
171
+ [K] Kill process (sudo may be required)
172
+ [C] Copy command (to clipboard)
173
+ [Q] Quit
174
+ ```
175
+
176
+ ### Viewing All Listening Ports
177
+
178
+ ```bash
179
+ $ wtfport
180
+
181
+ Listening Ports:
182
+ ┏━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓
183
+ ┃ Port ┃ Process ┃ PID ┃ User ┃ Started ┃
184
+ ┡━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━┩
185
+ │ 22 │ sshd │ 122 │ root │ 4h ago │
186
+ │ 443 │ httpd │ 436 │ www │ 2d ago │
187
+ │ 3000 │ node │ 1234 │ yourname │ 3m ago │
188
+ │ 5432 │ postgres │ 983 │ postgres │ 2d ago │
189
+ └───────┴───────────────┴───────┴───────────┴─────────────┘
190
+
191
+ Tip: run `wtfport <port>` to inspect in detail.
192
+ ```
193
+
194
+ ### Port Statistics
195
+
196
+ ```bash
197
+ $ wtfport --stats
198
+
199
+ Port Usage Statistics:
200
+
201
+ Tracking data for 15 ports and 7 processes.
202
+ Last updated: 2023-06-15T14:30:22.456789
203
+
204
+ Top Ports:
205
+ ┏━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
206
+ ┃ Port ┃ Access Count ┃ Processes ┃ Last Seen ┃
207
+ ┡━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
208
+ │ 3000 │ 42 │ node, python, ruby │ 2023-06-15 │
209
+ │ 8080 │ 27 │ java, tomcat │ 2023-06-14 │
210
+ │ 5432 │ 18 │ postgres │ 2023-06-15 │
211
+ │ 443 │ 15 │ nginx, apache │ 2023-06-15 │
212
+ │ 27017 │ 10 │ mongod │ 2023-06-13 │
213
+ └───────┴──────────────┴────────────────────────────┴──────────────┘
214
+
215
+ Top Processes:
216
+ ┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
217
+ ┃ Process ┃ Access Count ┃ Used Ports ┃
218
+ ┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
219
+ │ node │ 45 │ 3000, 8000, 9000, 4200, 4000 │
220
+ │ postgres │ 18 │ 5432 │
221
+ │ nginx │ 15 │ 443, 80 │
222
+ │ java │ 12 │ 8080, 8443 │
223
+ │ mongod │ 10 │ 27017 │
224
+ └───────────┴──────────────┴─────────────────────────────────┘
225
+
226
+ Tip: Use `wtfport --stats-detail <port>` to see detailed history for a specific port.
227
+ ```
228
+
229
+ ## Requirements
230
+
231
+ - Python 3.7 or higher
232
+ - Dependencies (automatically installed):
233
+ - typer
234
+ - rich
235
+ - psutil
236
+ - pyperclip
237
+
238
+ ## Privacy
239
+
240
+ wtfport runs completely locally on your machine. The statistics feature stores data only in a local file (~/.wtfport/stats.json) and no data is ever sent outside your computer.
241
+
242
+ ## Contributing
243
+
244
+ Contributions are welcome! Please feel free to submit a Pull Request.
245
+
246
+ 1. Fork the repository
247
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
248
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
249
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
250
+ 5. Open a Pull Request
251
+
252
+ ## License
253
+
254
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
255
+
256
+ ## Credits
257
+
258
+ Created by [Hungwa Henry](https://github.com/hungwahenry)
@@ -0,0 +1,223 @@
1
+ # wtfport
2
+
3
+ A terminal-based tool that provides developers with an intuitive, human-friendly way to identify, inspect, and interact with processes bound to specific ports on their system.
4
+
5
+ ![wtfport demo](https://raw.githubusercontent.com/hungwahenry/wtfport/main/docs/demo.gif)
6
+
7
+ ## Features
8
+
9
+ - **Port Lookup**: Quickly show details about the process using a specific port
10
+ - **Process Management**: Kill a process running on a port with a simple command
11
+ - **Cross-Platform Support**: Available for macOS, Linux, and Windows
12
+ - **Colorized Output**: Clear, visually appealing terminal output
13
+ - **Watch Mode**: Continuously monitor and update port usage
14
+ - **Interactive Mode**: Simple interface for interacting with processes
15
+ - **Clipboard Support**: Copy process commands directly to clipboard
16
+ - **Web Server Detection**: Quick access to open web servers in browser
17
+ - **Log Tailing**: Ability to detect and tail logs for processes
18
+ - **Port Statistics**: Track and analyze your most frequently used ports
19
+ - **Notifications**: Get alerted when a specific port becomes active
20
+
21
+ ## Installation
22
+
23
+ ### Using pip
24
+
25
+ ```bash
26
+ pip install wtfport
27
+ ```
28
+
29
+ ### Using Homebrew (macOS/Linux)
30
+
31
+ ```bash
32
+ brew install wtfport
33
+ ```
34
+
35
+ ### From Source
36
+
37
+ ```bash
38
+ git clone https://github.com/yourusername/wtfport.git
39
+ cd wtfport
40
+ pip install -e .
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ### Basic Commands
46
+
47
+ Check a specific port:
48
+ ```bash
49
+ wtfport 3000
50
+ ```
51
+
52
+ Show all listening ports:
53
+ ```bash
54
+ wtfport
55
+ # or
56
+ wtfport --all
57
+ ```
58
+
59
+ Kill a process on a port:
60
+ ```bash
61
+ wtfport 3000 --kill
62
+ ```
63
+
64
+ ### Monitoring Features
65
+
66
+ Watch a port for changes:
67
+ ```bash
68
+ wtfport 3000 --watch
69
+ ```
70
+
71
+ Get notified when a port becomes active:
72
+ ```bash
73
+ wtfport --notify 5000
74
+ ```
75
+
76
+ ### For Web Developers
77
+
78
+ Open a web server in browser:
79
+ ```bash
80
+ wtfport 3000 --open
81
+ ```
82
+
83
+ ### Port Statistics and History
84
+
85
+ View port usage statistics:
86
+ ```bash
87
+ wtfport --stats
88
+ ```
89
+
90
+ View detailed history for a specific port:
91
+ ```bash
92
+ wtfport --stats-detail 3000
93
+ ```
94
+
95
+ ### Automation & Scripting
96
+
97
+ Get JSON output for scripting:
98
+ ```bash
99
+ wtfport 3000 --json
100
+ ```
101
+
102
+ Copy the command to clipboard:
103
+ ```bash
104
+ wtfport 3000 --copy
105
+ ```
106
+
107
+ ### Interactive Mode
108
+
109
+ When running `wtfport <port>` without additional flags, you'll enter interactive mode where you can:
110
+
111
+ - Open the port in a browser
112
+ - Kill the process
113
+ - Copy the command to clipboard
114
+ - Tail logs (if available)
115
+
116
+ ## Examples
117
+
118
+ ### Finding What's Using a Port
119
+
120
+ ```bash
121
+ $ wtfport 3000
122
+
123
+ Port 3000 is being used by:
124
+ ╭──────────────────────────────────────────────────────────────────╮
125
+ │ │
126
+ │ ✓ Process: node │
127
+ │ PID: 1234 │
128
+ │ Command: node server.js │
129
+ │ User: yourname │
130
+ │ Started: 3m ago │
131
+ │ │
132
+ ╰──────────────────────────────────────────────────────────────────╯
133
+
134
+ Options:
135
+ [O] Open in browser (http://localhost:3000)
136
+ [K] Kill process (sudo may be required)
137
+ [C] Copy command (to clipboard)
138
+ [Q] Quit
139
+ ```
140
+
141
+ ### Viewing All Listening Ports
142
+
143
+ ```bash
144
+ $ wtfport
145
+
146
+ Listening Ports:
147
+ ┏━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓
148
+ ┃ Port ┃ Process ┃ PID ┃ User ┃ Started ┃
149
+ ┡━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━┩
150
+ │ 22 │ sshd │ 122 │ root │ 4h ago │
151
+ │ 443 │ httpd │ 436 │ www │ 2d ago │
152
+ │ 3000 │ node │ 1234 │ yourname │ 3m ago │
153
+ │ 5432 │ postgres │ 983 │ postgres │ 2d ago │
154
+ └───────┴───────────────┴───────┴───────────┴─────────────┘
155
+
156
+ Tip: run `wtfport <port>` to inspect in detail.
157
+ ```
158
+
159
+ ### Port Statistics
160
+
161
+ ```bash
162
+ $ wtfport --stats
163
+
164
+ Port Usage Statistics:
165
+
166
+ Tracking data for 15 ports and 7 processes.
167
+ Last updated: 2023-06-15T14:30:22.456789
168
+
169
+ Top Ports:
170
+ ┏━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
171
+ ┃ Port ┃ Access Count ┃ Processes ┃ Last Seen ┃
172
+ ┡━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
173
+ │ 3000 │ 42 │ node, python, ruby │ 2023-06-15 │
174
+ │ 8080 │ 27 │ java, tomcat │ 2023-06-14 │
175
+ │ 5432 │ 18 │ postgres │ 2023-06-15 │
176
+ │ 443 │ 15 │ nginx, apache │ 2023-06-15 │
177
+ │ 27017 │ 10 │ mongod │ 2023-06-13 │
178
+ └───────┴──────────────┴────────────────────────────┴──────────────┘
179
+
180
+ Top Processes:
181
+ ┏━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
182
+ ┃ Process ┃ Access Count ┃ Used Ports ┃
183
+ ┡━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
184
+ │ node │ 45 │ 3000, 8000, 9000, 4200, 4000 │
185
+ │ postgres │ 18 │ 5432 │
186
+ │ nginx │ 15 │ 443, 80 │
187
+ │ java │ 12 │ 8080, 8443 │
188
+ │ mongod │ 10 │ 27017 │
189
+ └───────────┴──────────────┴─────────────────────────────────┘
190
+
191
+ Tip: Use `wtfport --stats-detail <port>` to see detailed history for a specific port.
192
+ ```
193
+
194
+ ## Requirements
195
+
196
+ - Python 3.7 or higher
197
+ - Dependencies (automatically installed):
198
+ - typer
199
+ - rich
200
+ - psutil
201
+ - pyperclip
202
+
203
+ ## Privacy
204
+
205
+ wtfport runs completely locally on your machine. The statistics feature stores data only in a local file (~/.wtfport/stats.json) and no data is ever sent outside your computer.
206
+
207
+ ## Contributing
208
+
209
+ Contributions are welcome! Please feel free to submit a Pull Request.
210
+
211
+ 1. Fork the repository
212
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
213
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
214
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
215
+ 5. Open a Pull Request
216
+
217
+ ## License
218
+
219
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
220
+
221
+ ## Credits
222
+
223
+ Created by [Hungwa Henry](https://github.com/hungwahenry)
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wtfport"
7
+ version = "0.1.0"
8
+ description = "CLI tool to watch system port usage"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name="Henry", email="henry@example.com" }
12
+ ]
13
+ license = { text = "MIT" }
14
+ keywords = ["ports", "network", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: System Administrators",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.7",
24
+ "Programming Language :: Python :: 3.8",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Topic :: Software Development :: Debuggers",
31
+ "Topic :: System :: Networking",
32
+ "Topic :: Utilities"
33
+ ]
34
+ requires-python = ">=3.7"
35
+ dependencies = [
36
+ "psutil",
37
+ "click"
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ dev = ["build", "twine", "pytest"]
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/yourname/wtfport"
45
+ Issues = "https://github.com/yourname/wtfport/issues"
46
+
47
+ [project.scripts]
48
+ wtfport = "wtfport.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """
2
+ wtfport - A terminal tool to identify, inspect, and interact with processes bound to specific ports.
3
+ """
4
+
5
+ from .version import __version__
6
+
7
+ from wtfport.core import get_process_by_port, get_all_listening_ports, kill_process