kport 2.1.1__py3-none-any.whl → 2.1.2__py3-none-any.whl

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.
@@ -1,451 +1,509 @@
1
- Metadata-Version: 2.4
2
- Name: kport
3
- Version: 2.1.1
4
- Summary: A cross-platform command-line tool to inspect and kill processes using specific ports
5
- Home-page: https://github.com/farman20ali/port-killer
6
- Author: Farman Ali
7
- Author-email: farman20ali@gmail.com
8
- Project-URL: Bug Reports, https://github.com/farman20ali/port-killer/issues
9
- Project-URL: Source, https://github.com/farman20ali/port-killer
10
- Keywords: port,kill,process,network,cross-platform,cli
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Intended Audience :: System Administrators
14
- Classifier: Topic :: System :: Networking
15
- Classifier: Topic :: System :: Systems Administration
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.6
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
- Classifier: Programming Language :: Python :: 3.10
23
- Classifier: Programming Language :: Python :: 3.11
24
- Classifier: Operating System :: OS Independent
25
- Classifier: Operating System :: Microsoft :: Windows
26
- Classifier: Operating System :: POSIX :: Linux
27
- Classifier: Operating System :: MacOS
28
- Requires-Python: >=3.6
29
- Description-Content-Type: text/markdown
30
- License-File: LICENSE
31
- Dynamic: author
32
- Dynamic: author-email
33
- Dynamic: classifier
34
- Dynamic: description
35
- Dynamic: description-content-type
36
- Dynamic: home-page
37
- Dynamic: keywords
38
- Dynamic: license-file
39
- Dynamic: project-url
40
- Dynamic: requires-python
41
- Dynamic: summary
42
-
43
- # 🔪 kport - Cross-Platform Port Inspector and Killer
44
-
45
- [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/farman20ali/port-killer)
46
- [![Python](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/)
47
- [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
48
- [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com/farman20ali/port-killer)
49
-
50
- A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
51
-
52
- ## ✨ Features
53
-
54
- - 🔍 **Inspect ports** - Find which process is using a specific port
55
- - 🔎 **Inspect multiple ports** - Check multiple ports at once
56
- - 🔍 **Inspect port range** - Scan a range of ports (e.g., 3000-3010)
57
- - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
58
- - 🔪 **Kill processes** - Terminate processes using specific ports
59
- - 💥 **Kill port range** - Terminate processes on a range of ports
60
- - 🔫 **Kill multiple ports** - Kill processes on multiple ports at once
61
- - 🎯 **Kill by process name** - Kill all processes matching a name (e.g., "node", "python")
62
- - 📋 **List all ports** - View all listening ports and their processes
63
- - 🎨 **Colorized output** - Easy-to-read colored terminal output
64
- - **Confirmation prompts** - Safety confirmation before killing processes
65
- - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
66
- - 🚀 **Easy to use** - Simple command-line interface
67
-
68
- ## 📦 Installation
69
-
70
- ### Quick Install (Once Published to PyPI)
71
-
72
- ```bash
73
- # Recommended: Install to user directory
74
- pip install --user kport
75
-
76
- # Or install system-wide (requires admin/sudo)
77
- pip install kport
78
- ```
79
-
80
- ### Install from GitHub
81
-
82
- ```bash
83
- pip install --user git+https://github.com/farman20ali/port-killer.git
84
- ```
85
-
86
- ### Install from Source
87
-
88
- ```bash
89
- # Clone the repository
90
- git clone https://github.com/farman20ali/port-killer.git
91
- cd port-killer
92
-
93
- # Install to user directory (recommended)
94
- pip install --user .
95
-
96
- # Or install system-wide (requires admin/sudo)
97
- pip install .
98
- ```
99
-
100
- ### Install for Development
101
-
102
- ```bash
103
- # Install in editable mode
104
- pip install --user -e .
105
- ```
106
-
107
- After installation, `kport` will be available globally in your terminal.
108
-
109
- ### Run Without Installing
110
-
111
- ```bash
112
- # Run directly with Python
113
- python kport.py -h
114
- ```
115
-
116
- > 💡 **Tip:** If `kport` command doesn't work after installation, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
117
- >
118
- > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
119
- >
120
- > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
121
-
122
- ## 🚀 Usage
123
-
124
- ### Inspect a port
125
-
126
- Find out which process is using a specific port:
127
-
128
- ```bash
129
- kport -i 8080
130
- ```
131
-
132
- Example output:
133
- ```
134
- 🔍 Inspecting port 8080...
135
-
136
- Port 8080 is being used by PID 12345
137
-
138
- Process Information:
139
- ──────────────────────────────────────────────────
140
- PID: 12345
141
- Image Name: node.exe
142
- Session Name: Console
143
- Mem Usage: 45,678 K
144
- ```
145
-
146
- ### Inspect by process name
147
-
148
- Find all processes matching a name and see what ports they're using:
149
-
150
- ```bash
151
- kport -ip node
152
- ```
153
-
154
- Example output:
155
- ```
156
- 🔍 Inspecting processes matching 'node'...
157
-
158
- Found 3 connection(s) for processes matching 'node':
159
-
160
- PID Process Port State
161
- ──────────────────────────────────────────────────────────────────────
162
- 12345 node.exe 3000 LISTENING
163
- 3001 LISTENING
164
- 12346 node.exe 8080 LISTENING
165
-
166
- Total processes found: 2
167
- Total connections: 3
168
- ```
169
-
170
- ### Inspect multiple ports
171
-
172
- Check multiple ports at once:
173
-
174
- ```bash
175
- kport -im 3000 3001 8080 8081
176
- ```
177
-
178
- Example output:
179
- ```
180
- 🔍 Inspecting 4 port(s)...
181
-
182
- Port PID Process
183
- ────────────────────────────────────────────────────────────
184
- 3000 12345 node.exe
185
- 3001 12346 node.exe
186
- 8080 12347 python.exe
187
-
188
- ✓ Found processes on 3/4 port(s)
189
- ```
190
-
191
- ### Inspect port range
192
-
193
- Scan a range of ports:
194
-
195
- ```bash
196
- kport -ir 3000-3010
197
- ```
198
-
199
- Example output:
200
- ```
201
- 🔍 Inspecting port range 3000-3010 (11 ports)...
202
-
203
- Port PID Process
204
- ────────────────────────────────────────────────────────────
205
- 3000 12345 node.exe
206
- 3001 12346 node.exe
207
- 3005 12347 python.exe
208
-
209
- Found processes on 3/11 port(s) in range
210
- ```
211
-
212
- ### Kill a process on a port
213
-
214
- Terminate the process using a specific port:
215
-
216
- ```bash
217
- kport -k 8080
218
- ```
219
-
220
- Example output:
221
- ```
222
- 🔪 Attempting to kill process on port 8080...
223
-
224
- Found PID 12345 using port 8080
225
-
226
- Process to be terminated:
227
- PID: 12345
228
- Image Name: node.exe
229
-
230
- Are you sure you want to kill this process? (y/N): y
231
-
232
- ✓ Successfully killed process 12345
233
- Port 8080 is now free.
234
- ```
235
-
236
- ### List all listening ports
237
-
238
- View all active listening ports and their associated processes:
239
-
240
- ```bash
241
- kport -l
242
- ```
243
-
244
- Example output:
245
- ```
246
- 📋 Listing all active ports...
247
-
248
- Protocol Local Address State PID
249
- ──────────────────────────────────────────────────────────────────────
250
- TCP 0.0.0.0:80 LISTENING 1234
251
- TCP 0.0.0.0:443 LISTENING 1234
252
- TCP 0.0.0.0:3000 LISTENING 5678
253
- TCP 0.0.0.0:8080 LISTENING 9012
254
- ```
255
-
256
- ### Kill by process name
257
-
258
- Kill all processes matching a specific name:
259
-
260
- ```bash
261
- kport -kp node
262
- ```
263
-
264
- Example output:
265
- ```
266
- 🔪 Killing all processes matching 'node'...
267
-
268
- Found 3 process(es) matching 'node':
269
- ──────────────────────────────────────────────────
270
- PID 12345: node.exe
271
- PID 12346: node.exe
272
- PID 12347: node.exe
273
-
274
- Are you sure you want to kill 3 process(es)? (y/N): y
275
-
276
- ✓ Killed PID 12345
277
- ✓ Killed PID 12346
278
- Killed PID 12347
279
-
280
- Successfully killed 3/3 process(es)
281
- ```
282
-
283
- ### Kill multiple ports at once
284
-
285
- Kill processes on multiple ports simultaneously:
286
-
287
- ```bash
288
- kport -ka 3000 3001 3002
289
- ```
290
-
291
- Example output:
292
- ```
293
- 🔪 Killing processes on 3 port(s)...
294
-
295
- Found processes on 3 port(s):
296
- ──────────────────────────────────────────────────
297
- Port 3000: PID 12345 (node.exe)
298
- Port 3001: PID 12346 (node.exe)
299
- Port 3002: PID 12347 (python.exe)
300
-
301
- Are you sure you want to kill 3 process(es)? (y/N): y
302
-
303
- ✓ Killed process on port 3000 (PID 12345)
304
- Killed process on port 3001 (PID 12346)
305
- ✓ Killed process on port 3002 (PID 12347)
306
-
307
- ✓ Successfully killed 3/3 process(es)
308
- Ports freed: 3000, 3001, 3002
309
- ```
310
-
311
- ### Kill port range
312
-
313
- Kill all processes on a range of ports:
314
-
315
- ```bash
316
- kport -kr 3000-3010
317
- ```
318
-
319
- Example output:
320
- ```
321
- 🔪 Killing processes on port range 3000-3010 (11 ports)...
322
-
323
- Found processes on 3 port(s) in range:
324
- ──────────────────────────────────────────────────
325
- Port 3000: PID 12345 (node.exe)
326
- Port 3001: PID 12346 (node.exe)
327
- Port 3005: PID 12347 (python.exe)
328
-
329
- Are you sure you want to kill 3 process(es)? (y/N): y
330
-
331
- ✓ Killed process on port 3000 (PID 12345)
332
- Killed process on port 3001 (PID 12346)
333
- ✓ Killed process on port 3005 (PID 12347)
334
-
335
- Successfully killed 3/3 process(es)
336
- Ports freed: 3000, 3001, 3005
337
- ```
338
-
339
- ### Show help
340
-
341
- ```bash
342
- kport -h
343
- ```
344
-
345
- ### Show version
346
-
347
- ```bash
348
- kport -v
349
- ```
350
-
351
- ## 📚 Command-Line Options
352
-
353
- | Option | Long Form | Description |
354
- |--------|-----------|-------------|
355
- | `-i PORT` | `--inspect PORT` | Inspect which process is using the specified port |
356
- | `-im PORT [PORT ...]` | `--inspect-multiple PORT [PORT ...]` | Inspect multiple ports at once |
357
- | `-ir RANGE` | `--inspect-range RANGE` | Inspect port range (e.g., 3000-3010) |
358
- | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
359
- | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
360
- | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
361
- | `-ka PORT [PORT ...]` | `--kill-all PORT [PORT ...]` | Kill processes on multiple ports at once |
362
- | `-kr RANGE` | `--kill-range RANGE` | Kill processes on port range (e.g., 3000-3010) |
363
- | `-l` | `--list` | List all listening ports and their processes |
364
- | `-v` | `--version` | Show version information |
365
- | `-h` | `--help` | Show help message |
366
-
367
- ## 🛠️ Requirements
368
-
369
- - Python 3.6 or higher
370
- - No external dependencies (uses only Python standard library)
371
-
372
- ### Platform-specific tools
373
-
374
- The tool uses platform-native commands:
375
-
376
- - **Windows**: `netstat`, `tasklist`, `taskkill`
377
- - **Linux/macOS**: `lsof`, `ps`, `kill`
378
-
379
- These tools are typically pre-installed on all platforms.
380
-
381
- ## 🔧 Development
382
-
383
- ### Clone and setup
384
-
385
- ```bash
386
- git clone https://github.com/farman20ali/port-killer.git
387
- cd port-killer
388
-
389
- # Install in development mode
390
- pip install -e .
391
- ```
392
-
393
- ### Run tests
394
-
395
- ```bash
396
- # Test inspecting a port
397
- kport -i 80
398
-
399
- # Test listing ports
400
- kport -l
401
- ```
402
-
403
- ## 🤝 Contributing
404
-
405
- Contributions are welcome! Please feel free to submit a Pull Request.
406
-
407
- 1. Fork the repository
408
- 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
409
- 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
410
- 4. Push to the branch (`git push origin feature/AmazingFeature`)
411
- 5. Open a Pull Request
412
-
413
- ## 📝 License
414
-
415
- This project is licensed under the MIT License - see the LICENSE file for details.
416
-
417
- ## ⚠️ Important Notes
418
-
419
- - **Administrator/sudo privileges**: Killing processes may require elevated privileges on some systems
420
- - **Port validation**: Port numbers must be between 1 and 65535
421
- - **Safety**: The tool asks for confirmation before killing any process
422
- - **Multiple processes**: If multiple processes use the same port, the first one found will be shown/killed
423
-
424
- ## 🐛 Troubleshooting
425
-
426
- ### "Permission denied" errors
427
-
428
- On Linux/macOS, you may need to run with sudo:
429
- ```bash
430
- sudo kport -k 80
431
- ```
432
-
433
- On Windows, run your terminal as Administrator.
434
-
435
- ### Port not found
436
-
437
- Make sure the port number is correct and that a process is actually using it. Use `kport -l` to see all active ports.
438
-
439
- ### Color output not working on Windows
440
-
441
- Colors should work on Windows 10 and later. If you're on an older version, colors may not display correctly.
442
-
443
- ## 📧 Contact
444
-
445
- Your Name - farman20ali@example.com
446
-
447
- Project Link: [https://github.com/farman20ali/port-killer](https://github.com/farman20ali/port-killer)
448
-
449
- ---
450
-
451
- Made with ❤️ for developers who are tired of hunting down processes
1
+ Metadata-Version: 2.4
2
+ Name: kport
3
+ Version: 2.1.2
4
+ Summary: A cross-platform command-line tool to inspect and kill processes using specific ports
5
+ Home-page: https://github.com/farman20ali/port-killer
6
+ Author: Farman Ali
7
+ Author-email: farman20ali@gmail.com
8
+ Project-URL: Bug Reports, https://github.com/farman20ali/port-killer/issues
9
+ Project-URL: Source, https://github.com/farman20ali/port-killer
10
+ Keywords: port,kill,process,network,cross-platform,cli
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Topic :: System :: Networking
15
+ Classifier: Topic :: System :: Systems Administration
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Operating System :: OS Independent
25
+ Classifier: Operating System :: Microsoft :: Windows
26
+ Classifier: Operating System :: POSIX :: Linux
27
+ Classifier: Operating System :: MacOS
28
+ Requires-Python: >=3.6
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: keywords
38
+ Dynamic: license-file
39
+ Dynamic: project-url
40
+ Dynamic: requires-python
41
+ Dynamic: summary
42
+
43
+ # 🔪 kport - Cross-Platform Port Inspector and Killer
44
+
45
+ [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/farman20ali/port-killer)
46
+ [![Python](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/)
47
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
48
+ [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com/farman20ali/port-killer)
49
+
50
+ A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
51
+
52
+ ## ✨ Features
53
+
54
+ - 🔍 **Inspect ports** - Find which process is using a specific port
55
+ - 🔎 **Inspect multiple ports** - Check multiple ports at once
56
+ - 🔍 **Inspect port range** - Scan a range of ports (e.g., 3000-3010)
57
+ - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
58
+ - 🔪 **Kill processes** - Terminate processes using specific ports
59
+ - 💥 **Kill port range** - Terminate processes on a range of ports
60
+ - 🔫 **Kill multiple ports** - Kill processes on multiple ports at once
61
+ - 🎯 **Kill by process name** - Kill all processes matching a name (e.g., "node", "python")
62
+ - 📋 **List all ports** - View all listening ports and their processes
63
+ - 🐳 **Docker-aware** - Detect ports published by Docker containers (even when you don't see a host process)
64
+ - 🎨 **Colorized output** - Easy-to-read colored terminal output
65
+ - **Confirmation prompts** - Safety confirmation before killing processes
66
+ - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
67
+ - 🚀 **Easy to use** - Simple command-line interface
68
+
69
+ ## 📦 Installation
70
+
71
+ ### Quick Install (Once Published to PyPI)
72
+
73
+ ```bash
74
+ # Recommended: Install to user directory
75
+ pip install --user kport
76
+
77
+ # Or install system-wide (requires admin/sudo)
78
+ pip install kport
79
+ ```
80
+
81
+ ### Install from GitHub
82
+
83
+ ```bash
84
+ pip install --user git+https://github.com/farman20ali/port-killer.git
85
+ ```
86
+
87
+ ### Install from Source
88
+
89
+ ```bash
90
+ # Clone the repository
91
+ git clone https://github.com/farman20ali/port-killer.git
92
+ cd port-killer
93
+
94
+ # Install to user directory (recommended)
95
+ pip install --user .
96
+
97
+ # Or install system-wide (requires admin/sudo)
98
+ pip install .
99
+ ```
100
+
101
+ ### Install for Development
102
+
103
+ ```bash
104
+ # Install in editable mode
105
+ pip install --user -e .
106
+ ```
107
+
108
+ After installation, `kport` will be available globally in your terminal.
109
+
110
+ ### Run Without Installing
111
+
112
+ ```bash
113
+ # Run directly with Python
114
+ python kport.py -h
115
+ ```
116
+
117
+ > 💡 **Tip:** If `kport` command doesn't work after installation, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
118
+ >
119
+ > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
120
+ >
121
+ > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
122
+
123
+ ## 🚀 Usage
124
+
125
+ ### PRODUCT.md command style (recommended)
126
+
127
+ These commands are Docker-aware by default:
128
+
129
+ ```bash
130
+ # Inspect a port (local or docker)
131
+ kport inspect 8080
132
+
133
+ # Explain why a port is blocked
134
+ kport explain 8080
135
+
136
+ # Safely free a port (will offer docker stop/restart/remove if needed)
137
+ kport kill 8080
138
+
139
+ # List ports (local + docker)
140
+ kport list
141
+
142
+ # List docker published ports
143
+ kport docker
144
+
145
+ # Detect port conflicts (docker + local)
146
+ kport conflicts
147
+ ```
148
+
149
+ > Note: `--json`, `--dry-run`, `--yes`, and `--debug` work with subcommands.
150
+
151
+ ### Why a port may show without PID
152
+
153
+ On Linux, some ports may appear as `LISTEN` but the owning PID/process name is not visible without elevated privileges (common with system services).
154
+
155
+ If you see `local-unknown` in `inspect` / `explain`, try:
156
+
157
+ ```bash
158
+ sudo kport inspect 6379
159
+ sudo kport explain 6379
160
+ ```
161
+
162
+ ### Config file support (Phase 2)
163
+
164
+ You can set default flags via JSON config:
165
+
166
+ - `.kport.json` (current directory)
167
+ - `~/.kport.json`
168
+ - `~/.config/kport/config.json`
169
+
170
+ Example:
171
+
172
+ ```json
173
+ {
174
+ "yes": true,
175
+ "dry_run": false,
176
+ "force": false,
177
+ "graceful_timeout": 5,
178
+ "docker_action": "stop"
179
+ }
180
+ ```
181
+
182
+ ### Inspect a port
183
+
184
+ Find out which process is using a specific port:
185
+
186
+ ```bash
187
+ kport -i 8080
188
+ ```
189
+
190
+ Example output:
191
+ ```
192
+ 🔍 Inspecting port 8080...
193
+
194
+ ✓ Port 8080 is being used by PID 12345
195
+
196
+ Process Information:
197
+ ──────────────────────────────────────────────────
198
+ PID: 12345
199
+ Image Name: node.exe
200
+ Session Name: Console
201
+ Mem Usage: 45,678 K
202
+ ```
203
+
204
+ ### Inspect by process name
205
+
206
+ Find all processes matching a name and see what ports they're using:
207
+
208
+ ```bash
209
+ kport -ip node
210
+ ```
211
+
212
+ Example output:
213
+ ```
214
+ 🔍 Inspecting processes matching 'node'...
215
+
216
+ Found 3 connection(s) for processes matching 'node':
217
+
218
+ PID Process Port State
219
+ ──────────────────────────────────────────────────────────────────────
220
+ 12345 node.exe 3000 LISTENING
221
+ 3001 LISTENING
222
+ 12346 node.exe 8080 LISTENING
223
+
224
+ Total processes found: 2
225
+ ✓ Total connections: 3
226
+ ```
227
+
228
+ ### Inspect multiple ports
229
+
230
+ Check multiple ports at once:
231
+
232
+ ```bash
233
+ kport -im 3000 3001 8080 8081
234
+ ```
235
+
236
+ Example output:
237
+ ```
238
+ 🔍 Inspecting 4 port(s)...
239
+
240
+ Port PID Process
241
+ ────────────────────────────────────────────────────────────
242
+ 3000 12345 node.exe
243
+ 3001 12346 node.exe
244
+ 8080 12347 python.exe
245
+
246
+ Found processes on 3/4 port(s)
247
+ ```
248
+
249
+ ### Inspect port range
250
+
251
+ Scan a range of ports:
252
+
253
+ ```bash
254
+ kport -ir 3000-3010
255
+ ```
256
+
257
+ Example output:
258
+ ```
259
+ 🔍 Inspecting port range 3000-3010 (11 ports)...
260
+
261
+ Port PID Process
262
+ ────────────────────────────────────────────────────────────
263
+ 3000 12345 node.exe
264
+ 3001 12346 node.exe
265
+ 3005 12347 python.exe
266
+
267
+ ✓ Found processes on 3/11 port(s) in range
268
+ ```
269
+
270
+ ### Kill a process on a port
271
+
272
+ Terminate the process using a specific port:
273
+
274
+ ```bash
275
+ kport -k 8080
276
+ ```
277
+
278
+ Example output:
279
+ ```
280
+ 🔪 Attempting to kill process on port 8080...
281
+
282
+ Found PID 12345 using port 8080
283
+
284
+ Process to be terminated:
285
+ PID: 12345
286
+ Image Name: node.exe
287
+
288
+ Are you sure you want to kill this process? (y/N): y
289
+
290
+ ✓ Successfully killed process 12345
291
+ Port 8080 is now free.
292
+ ```
293
+
294
+ ### List all listening ports
295
+
296
+ View all active listening ports and their associated processes:
297
+
298
+ ```bash
299
+ kport -l
300
+ ```
301
+
302
+ Example output:
303
+ ```
304
+ 📋 Listing all active ports...
305
+
306
+ Protocol Local Address State PID
307
+ ──────────────────────────────────────────────────────────────────────
308
+ TCP 0.0.0.0:80 LISTENING 1234
309
+ TCP 0.0.0.0:443 LISTENING 1234
310
+ TCP 0.0.0.0:3000 LISTENING 5678
311
+ TCP 0.0.0.0:8080 LISTENING 9012
312
+ ```
313
+
314
+ ### Kill by process name
315
+
316
+ Kill all processes matching a specific name:
317
+
318
+ ```bash
319
+ kport -kp node
320
+ ```
321
+
322
+ Example output:
323
+ ```
324
+ 🔪 Killing all processes matching 'node'...
325
+
326
+ Found 3 process(es) matching 'node':
327
+ ──────────────────────────────────────────────────
328
+ PID 12345: node.exe
329
+ PID 12346: node.exe
330
+ PID 12347: node.exe
331
+
332
+ Are you sure you want to kill 3 process(es)? (y/N): y
333
+
334
+ ✓ Killed PID 12345
335
+ Killed PID 12346
336
+ Killed PID 12347
337
+
338
+ ✓ Successfully killed 3/3 process(es)
339
+ ```
340
+
341
+ ### Kill multiple ports at once
342
+
343
+ Kill processes on multiple ports simultaneously:
344
+
345
+ ```bash
346
+ kport -ka 3000 3001 3002
347
+ ```
348
+
349
+ Example output:
350
+ ```
351
+ 🔪 Killing processes on 3 port(s)...
352
+
353
+ Found processes on 3 port(s):
354
+ ──────────────────────────────────────────────────
355
+ Port 3000: PID 12345 (node.exe)
356
+ Port 3001: PID 12346 (node.exe)
357
+ Port 3002: PID 12347 (python.exe)
358
+
359
+ Are you sure you want to kill 3 process(es)? (y/N): y
360
+
361
+ Killed process on port 3000 (PID 12345)
362
+ Killed process on port 3001 (PID 12346)
363
+ Killed process on port 3002 (PID 12347)
364
+
365
+ Successfully killed 3/3 process(es)
366
+ Ports freed: 3000, 3001, 3002
367
+ ```
368
+
369
+ ### Kill port range
370
+
371
+ Kill all processes on a range of ports:
372
+
373
+ ```bash
374
+ kport -kr 3000-3010
375
+ ```
376
+
377
+ Example output:
378
+ ```
379
+ 🔪 Killing processes on port range 3000-3010 (11 ports)...
380
+
381
+ Found processes on 3 port(s) in range:
382
+ ──────────────────────────────────────────────────
383
+ Port 3000: PID 12345 (node.exe)
384
+ Port 3001: PID 12346 (node.exe)
385
+ Port 3005: PID 12347 (python.exe)
386
+
387
+ Are you sure you want to kill 3 process(es)? (y/N): y
388
+
389
+ Killed process on port 3000 (PID 12345)
390
+ Killed process on port 3001 (PID 12346)
391
+ ✓ Killed process on port 3005 (PID 12347)
392
+
393
+ Successfully killed 3/3 process(es)
394
+ Ports freed: 3000, 3001, 3005
395
+ ```
396
+
397
+ ### Show help
398
+
399
+ ```bash
400
+ kport -h
401
+ ```
402
+
403
+ ### Show version
404
+
405
+ ```bash
406
+ kport -v
407
+ ```
408
+
409
+ ## 📚 Command-Line Options
410
+
411
+ | Option | Long Form | Description |
412
+ |--------|-----------|-------------|
413
+ | `-i PORT` | `--inspect PORT` | Inspect which process is using the specified port |
414
+ | `-im PORT [PORT ...]` | `--inspect-multiple PORT [PORT ...]` | Inspect multiple ports at once |
415
+ | `-ir RANGE` | `--inspect-range RANGE` | Inspect port range (e.g., 3000-3010) |
416
+ | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
417
+ | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
418
+ | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
419
+ | `-ka PORT [PORT ...]` | `--kill-all PORT [PORT ...]` | Kill processes on multiple ports at once |
420
+ | `-kr RANGE` | `--kill-range RANGE` | Kill processes on port range (e.g., 3000-3010) |
421
+ | `-l` | `--list` | List all listening ports and their processes |
422
+ | `-v` | `--version` | Show version information |
423
+ | `-h` | `--help` | Show help message |
424
+
425
+ ## 🛠️ Requirements
426
+
427
+ - Python 3.6 or higher
428
+ - No external dependencies (uses only Python standard library)
429
+
430
+ ### Platform-specific tools
431
+
432
+ The tool uses platform-native commands:
433
+
434
+ - **Windows**: `netstat`, `tasklist`, `taskkill`
435
+ - **Linux/macOS**: `lsof`, `ps`, `kill`
436
+
437
+ These tools are typically pre-installed on all platforms.
438
+
439
+ ## 🔧 Development
440
+
441
+ ### Clone and setup
442
+
443
+ ```bash
444
+ git clone https://github.com/farman20ali/port-killer.git
445
+ cd port-killer
446
+
447
+ # Install in development mode
448
+ pip install -e .
449
+ ```
450
+
451
+ ### Run tests
452
+
453
+ ```bash
454
+ # Test inspecting a port
455
+ kport -i 80
456
+
457
+ # Test listing ports
458
+ kport -l
459
+ ```
460
+
461
+ ## 🤝 Contributing
462
+
463
+ Contributions are welcome! Please feel free to submit a Pull Request.
464
+
465
+ 1. Fork the repository
466
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
467
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
468
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
469
+ 5. Open a Pull Request
470
+
471
+ ## 📝 License
472
+
473
+ This project is licensed under the MIT License - see the LICENSE file for details.
474
+
475
+ ## ⚠️ Important Notes
476
+
477
+ - **Administrator/sudo privileges**: Killing processes may require elevated privileges on some systems
478
+ - **Port validation**: Port numbers must be between 1 and 65535
479
+ - **Safety**: The tool asks for confirmation before killing any process
480
+ - **Multiple processes**: If multiple processes use the same port, the first one found will be shown/killed
481
+
482
+ ## 🐛 Troubleshooting
483
+
484
+ ### "Permission denied" errors
485
+
486
+ On Linux/macOS, you may need to run with sudo:
487
+ ```bash
488
+ sudo kport -k 80
489
+ ```
490
+
491
+ On Windows, run your terminal as Administrator.
492
+
493
+ ### Port not found
494
+
495
+ Make sure the port number is correct and that a process is actually using it. Use `kport -l` to see all active ports.
496
+
497
+ ### Color output not working on Windows
498
+
499
+ Colors should work on Windows 10 and later. If you're on an older version, colors may not display correctly.
500
+
501
+ ## 📧 Contact
502
+
503
+ Your Name - farman20ali@example.com
504
+
505
+ Project Link: [https://github.com/farman20ali/port-killer](https://github.com/farman20ali/port-killer)
506
+
507
+ ---
508
+
509
+ Made with ❤️ for developers who are tired of hunting down processes