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