kport 1.0.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.
kport-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kport
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.
kport-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.4
2
+ Name: kport
3
+ Version: 1.0.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 (Alien)
7
+ Author-email: farman20ali@example.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
+ A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
46
+
47
+ ## ✨ Features
48
+
49
+ - 🔍 **Inspect ports** - Find which process is using a specific port
50
+ - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
51
+ - 🔪 **Kill processes** - Terminate processes using specific ports
52
+ - 📋 **List all ports** - View all listening ports and their processes
53
+ - 🎯 **Kill by process name** - Kill all processes matching a name (e.g., "node", "python")
54
+ - 🔥 **Kill multiple ports** - Kill processes on multiple ports at once
55
+ - 🎨 **Colorized output** - Easy-to-read colored terminal output
56
+ - ✅ **Confirmation prompts** - Safety confirmation before killing processes
57
+ - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
58
+ - 🚀 **Easy to use** - Simple command-line interface
59
+
60
+ ## 📦 Installation
61
+
62
+ ### Quick Install (Once Published to PyPI)
63
+
64
+ ```bash
65
+ pip install kport
66
+ ```
67
+
68
+ ### Install from GitHub
69
+
70
+ ```bash
71
+ pip install git+https://github.com/farman20ali/port-killer.git
72
+ ```
73
+
74
+ ### Install from Source
75
+
76
+ ```bash
77
+ # Clone the repository
78
+ git clone https://github.com/farman20ali/port-killer.git
79
+ cd port-killer
80
+
81
+ # Install
82
+ pip install .
83
+ ```
84
+
85
+ ### Install for Development
86
+
87
+ ```bash
88
+ # Install in editable mode
89
+ pip install -e .
90
+ ```
91
+
92
+ After installation, `kport` will be available globally in your terminal.
93
+
94
+ ### Run Without Installing
95
+
96
+ ```bash
97
+ # Run directly with Python
98
+ python kport.py -h
99
+ ```
100
+
101
+ > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
102
+ >
103
+ > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
104
+
105
+ ## 🚀 Usage
106
+
107
+ ### Inspect a port
108
+
109
+ Find out which process is using a specific port:
110
+
111
+ ```bash
112
+ kport -i 8080
113
+ ```
114
+
115
+ Example output:
116
+ ```
117
+ 🔍 Inspecting port 8080...
118
+
119
+ ✓ Port 8080 is being used by PID 12345
120
+
121
+ Process Information:
122
+ ──────────────────────────────────────────────────
123
+ PID: 12345
124
+ Image Name: node.exe
125
+ Session Name: Console
126
+ Mem Usage: 45,678 K
127
+ ```
128
+
129
+ ### Inspect by process name
130
+
131
+ Find all processes matching a name and see what ports they're using:
132
+
133
+ ```bash
134
+ kport -ip node
135
+ ```
136
+
137
+ Example output:
138
+ ```
139
+ 🔍 Inspecting processes matching 'node'...
140
+
141
+ Found 3 connection(s) for processes matching 'node':
142
+
143
+ PID Process Port State
144
+ ──────────────────────────────────────────────────────────────────────
145
+ 12345 node.exe 3000 LISTENING
146
+ 3001 LISTENING
147
+ 12346 node.exe 8080 LISTENING
148
+
149
+ ✓ Total processes found: 2
150
+ ✓ Total connections: 3
151
+ ```
152
+
153
+ ### Kill a process on a port
154
+
155
+ Terminate the process using a specific port:
156
+
157
+ ```bash
158
+ kport -k 8080
159
+ ```
160
+
161
+ Example output:
162
+ ```
163
+ 🔪 Attempting to kill process on port 8080...
164
+
165
+ Found PID 12345 using port 8080
166
+
167
+ Process to be terminated:
168
+ PID: 12345
169
+ Image Name: node.exe
170
+
171
+ Are you sure you want to kill this process? (y/N): y
172
+
173
+ ✓ Successfully killed process 12345
174
+ Port 8080 is now free.
175
+ ```
176
+
177
+ ### List all listening ports
178
+
179
+ View all active listening ports and their associated processes:
180
+
181
+ ```bash
182
+ kport -l
183
+ ```
184
+
185
+ Example output:
186
+ ```
187
+ 📋 Listing all active ports...
188
+
189
+ Protocol Local Address State PID
190
+ ──────────────────────────────────────────────────────────────────────
191
+ TCP 0.0.0.0:80 LISTENING 1234
192
+ TCP 0.0.0.0:443 LISTENING 1234
193
+ TCP 0.0.0.0:3000 LISTENING 5678
194
+ TCP 0.0.0.0:8080 LISTENING 9012
195
+ ```
196
+
197
+ ### Kill by process name
198
+
199
+ Kill all processes matching a specific name:
200
+
201
+ ```bash
202
+ kport -kp node
203
+ ```
204
+
205
+ Example output:
206
+ ```
207
+ 🔪 Killing all processes matching 'node'...
208
+
209
+ Found 3 process(es) matching 'node':
210
+ ──────────────────────────────────────────────────
211
+ PID 12345: node.exe
212
+ PID 12346: node.exe
213
+ PID 12347: node.exe
214
+
215
+ Are you sure you want to kill 3 process(es)? (y/N): y
216
+
217
+ ✓ Killed PID 12345
218
+ ✓ Killed PID 12346
219
+ ✓ Killed PID 12347
220
+
221
+ ✓ Successfully killed 3/3 process(es)
222
+ ```
223
+
224
+ ### Kill multiple ports at once
225
+
226
+ Kill processes on multiple ports simultaneously:
227
+
228
+ ```bash
229
+ kport -ka 3000 3001 3002
230
+ ```
231
+
232
+ Example output:
233
+ ```
234
+ 🔪 Killing processes on 3 port(s)...
235
+
236
+ Found processes on 3 port(s):
237
+ ──────────────────────────────────────────────────
238
+ Port 3000: PID 12345 (node.exe)
239
+ Port 3001: PID 12346 (node.exe)
240
+ Port 3002: PID 12347 (python.exe)
241
+
242
+ Are you sure you want to kill 3 process(es)? (y/N): y
243
+
244
+ ✓ Killed process on port 3000 (PID 12345)
245
+ ✓ Killed process on port 3001 (PID 12346)
246
+ ✓ Killed process on port 3002 (PID 12347)
247
+
248
+ ✓ Successfully killed 3/3 process(es)
249
+ Ports freed: 3000, 3001, 3002
250
+ ```
251
+
252
+ ### Show help
253
+
254
+ ```bash
255
+ kport -h
256
+ ```
257
+
258
+ ### Show version
259
+
260
+ ```bash
261
+ kport -v
262
+ ```
263
+
264
+ ## 📚 Command-Line Options
265
+
266
+ | Option | Long Form | Description |
267
+ |--------|-----------|-------------|
268
+ | `-i PORT` | `--inspect PORT` | Inspect which process is using the specified port |
269
+ | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
270
+ | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
271
+ | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
272
+ | `-ka PORT [PORT ...]` | `--kill-all PORT [PORT ...]` | Kill processes on multiple ports at once |
273
+ | `-l` | `--list` | List all listening ports and their processes |
274
+ | `-v` | `--version` | Show version information |
275
+ | `-h` | `--help` | Show help message |
276
+
277
+ ## 🛠️ Requirements
278
+
279
+ - Python 3.6 or higher
280
+ - No external dependencies (uses only Python standard library)
281
+
282
+ ### Platform-specific tools
283
+
284
+ The tool uses platform-native commands:
285
+
286
+ - **Windows**: `netstat`, `tasklist`, `taskkill`
287
+ - **Linux/macOS**: `lsof`, `ps`, `kill`
288
+
289
+ These tools are typically pre-installed on all platforms.
290
+
291
+ ## 🔧 Development
292
+
293
+ ### Clone and setup
294
+
295
+ ```bash
296
+ git clone https://github.com/farman20ali/port-killer.git
297
+ cd port-killer
298
+
299
+ # Install in development mode
300
+ pip install -e .
301
+ ```
302
+
303
+ ### Run tests
304
+
305
+ ```bash
306
+ # Test inspecting a port
307
+ kport -i 80
308
+
309
+ # Test listing ports
310
+ kport -l
311
+ ```
312
+
313
+ ## 🤝 Contributing
314
+
315
+ Contributions are welcome! Please feel free to submit a Pull Request.
316
+
317
+ 1. Fork the repository
318
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
319
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
320
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
321
+ 5. Open a Pull Request
322
+
323
+ ## 📝 License
324
+
325
+ This project is licensed under the MIT License - see the LICENSE file for details.
326
+
327
+ ## ⚠️ Important Notes
328
+
329
+ - **Administrator/sudo privileges**: Killing processes may require elevated privileges on some systems
330
+ - **Port validation**: Port numbers must be between 1 and 65535
331
+ - **Safety**: The tool asks for confirmation before killing any process
332
+ - **Multiple processes**: If multiple processes use the same port, the first one found will be shown/killed
333
+
334
+ ## 🐛 Troubleshooting
335
+
336
+ ### "Permission denied" errors
337
+
338
+ On Linux/macOS, you may need to run with sudo:
339
+ ```bash
340
+ sudo kport -k 80
341
+ ```
342
+
343
+ On Windows, run your terminal as Administrator.
344
+
345
+ ### Port not found
346
+
347
+ Make sure the port number is correct and that a process is actually using it. Use `kport -l` to see all active ports.
348
+
349
+ ### Color output not working on Windows
350
+
351
+ Colors should work on Windows 10 and later. If you're on an older version, colors may not display correctly.
352
+
353
+ ## 📧 Contact
354
+
355
+ Your Name - your.email@example.com
356
+
357
+ Project Link: [https://github.com/yourusername/port-killer](https://github.com/yourusername/port-killer)
358
+
359
+ ---
360
+
361
+ Made with ❤️ for developers who are tired of hunting down processes
kport-1.0.0/README.md ADDED
@@ -0,0 +1,319 @@
1
+ # 🔪 kport - Cross-Platform Port Inspector and Killer
2
+
3
+ A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
4
+
5
+ ## ✨ Features
6
+
7
+ - 🔍 **Inspect ports** - Find which process is using a specific port
8
+ - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
9
+ - 🔪 **Kill processes** - Terminate processes using specific ports
10
+ - 📋 **List all ports** - View all listening ports and their processes
11
+ - 🎯 **Kill by process name** - Kill all processes matching a name (e.g., "node", "python")
12
+ - 🔥 **Kill multiple ports** - Kill processes on multiple ports at once
13
+ - 🎨 **Colorized output** - Easy-to-read colored terminal output
14
+ - ✅ **Confirmation prompts** - Safety confirmation before killing processes
15
+ - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
16
+ - 🚀 **Easy to use** - Simple command-line interface
17
+
18
+ ## 📦 Installation
19
+
20
+ ### Quick Install (Once Published to PyPI)
21
+
22
+ ```bash
23
+ pip install kport
24
+ ```
25
+
26
+ ### Install from GitHub
27
+
28
+ ```bash
29
+ pip install git+https://github.com/farman20ali/port-killer.git
30
+ ```
31
+
32
+ ### Install from Source
33
+
34
+ ```bash
35
+ # Clone the repository
36
+ git clone https://github.com/farman20ali/port-killer.git
37
+ cd port-killer
38
+
39
+ # Install
40
+ pip install .
41
+ ```
42
+
43
+ ### Install for Development
44
+
45
+ ```bash
46
+ # Install in editable mode
47
+ pip install -e .
48
+ ```
49
+
50
+ After installation, `kport` will be available globally in your terminal.
51
+
52
+ ### Run Without Installing
53
+
54
+ ```bash
55
+ # Run directly with Python
56
+ python kport.py -h
57
+ ```
58
+
59
+ > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
60
+ >
61
+ > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
62
+
63
+ ## 🚀 Usage
64
+
65
+ ### Inspect a port
66
+
67
+ Find out which process is using a specific port:
68
+
69
+ ```bash
70
+ kport -i 8080
71
+ ```
72
+
73
+ Example output:
74
+ ```
75
+ 🔍 Inspecting port 8080...
76
+
77
+ ✓ Port 8080 is being used by PID 12345
78
+
79
+ Process Information:
80
+ ──────────────────────────────────────────────────
81
+ PID: 12345
82
+ Image Name: node.exe
83
+ Session Name: Console
84
+ Mem Usage: 45,678 K
85
+ ```
86
+
87
+ ### Inspect by process name
88
+
89
+ Find all processes matching a name and see what ports they're using:
90
+
91
+ ```bash
92
+ kport -ip node
93
+ ```
94
+
95
+ Example output:
96
+ ```
97
+ 🔍 Inspecting processes matching 'node'...
98
+
99
+ Found 3 connection(s) for processes matching 'node':
100
+
101
+ PID Process Port State
102
+ ──────────────────────────────────────────────────────────────────────
103
+ 12345 node.exe 3000 LISTENING
104
+ 3001 LISTENING
105
+ 12346 node.exe 8080 LISTENING
106
+
107
+ ✓ Total processes found: 2
108
+ ✓ Total connections: 3
109
+ ```
110
+
111
+ ### Kill a process on a port
112
+
113
+ Terminate the process using a specific port:
114
+
115
+ ```bash
116
+ kport -k 8080
117
+ ```
118
+
119
+ Example output:
120
+ ```
121
+ 🔪 Attempting to kill process on port 8080...
122
+
123
+ Found PID 12345 using port 8080
124
+
125
+ Process to be terminated:
126
+ PID: 12345
127
+ Image Name: node.exe
128
+
129
+ Are you sure you want to kill this process? (y/N): y
130
+
131
+ ✓ Successfully killed process 12345
132
+ Port 8080 is now free.
133
+ ```
134
+
135
+ ### List all listening ports
136
+
137
+ View all active listening ports and their associated processes:
138
+
139
+ ```bash
140
+ kport -l
141
+ ```
142
+
143
+ Example output:
144
+ ```
145
+ 📋 Listing all active ports...
146
+
147
+ Protocol Local Address State PID
148
+ ──────────────────────────────────────────────────────────────────────
149
+ TCP 0.0.0.0:80 LISTENING 1234
150
+ TCP 0.0.0.0:443 LISTENING 1234
151
+ TCP 0.0.0.0:3000 LISTENING 5678
152
+ TCP 0.0.0.0:8080 LISTENING 9012
153
+ ```
154
+
155
+ ### Kill by process name
156
+
157
+ Kill all processes matching a specific name:
158
+
159
+ ```bash
160
+ kport -kp node
161
+ ```
162
+
163
+ Example output:
164
+ ```
165
+ 🔪 Killing all processes matching 'node'...
166
+
167
+ Found 3 process(es) matching 'node':
168
+ ──────────────────────────────────────────────────
169
+ PID 12345: node.exe
170
+ PID 12346: node.exe
171
+ PID 12347: node.exe
172
+
173
+ Are you sure you want to kill 3 process(es)? (y/N): y
174
+
175
+ ✓ Killed PID 12345
176
+ ✓ Killed PID 12346
177
+ ✓ Killed PID 12347
178
+
179
+ ✓ Successfully killed 3/3 process(es)
180
+ ```
181
+
182
+ ### Kill multiple ports at once
183
+
184
+ Kill processes on multiple ports simultaneously:
185
+
186
+ ```bash
187
+ kport -ka 3000 3001 3002
188
+ ```
189
+
190
+ Example output:
191
+ ```
192
+ 🔪 Killing processes on 3 port(s)...
193
+
194
+ Found processes on 3 port(s):
195
+ ──────────────────────────────────────────────────
196
+ Port 3000: PID 12345 (node.exe)
197
+ Port 3001: PID 12346 (node.exe)
198
+ Port 3002: PID 12347 (python.exe)
199
+
200
+ Are you sure you want to kill 3 process(es)? (y/N): y
201
+
202
+ ✓ Killed process on port 3000 (PID 12345)
203
+ ✓ Killed process on port 3001 (PID 12346)
204
+ ✓ Killed process on port 3002 (PID 12347)
205
+
206
+ ✓ Successfully killed 3/3 process(es)
207
+ Ports freed: 3000, 3001, 3002
208
+ ```
209
+
210
+ ### Show help
211
+
212
+ ```bash
213
+ kport -h
214
+ ```
215
+
216
+ ### Show version
217
+
218
+ ```bash
219
+ kport -v
220
+ ```
221
+
222
+ ## 📚 Command-Line Options
223
+
224
+ | Option | Long Form | Description |
225
+ |--------|-----------|-------------|
226
+ | `-i PORT` | `--inspect PORT` | Inspect which process is using the specified port |
227
+ | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
228
+ | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
229
+ | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
230
+ | `-ka PORT [PORT ...]` | `--kill-all PORT [PORT ...]` | Kill processes on multiple ports at once |
231
+ | `-l` | `--list` | List all listening ports and their processes |
232
+ | `-v` | `--version` | Show version information |
233
+ | `-h` | `--help` | Show help message |
234
+
235
+ ## 🛠️ Requirements
236
+
237
+ - Python 3.6 or higher
238
+ - No external dependencies (uses only Python standard library)
239
+
240
+ ### Platform-specific tools
241
+
242
+ The tool uses platform-native commands:
243
+
244
+ - **Windows**: `netstat`, `tasklist`, `taskkill`
245
+ - **Linux/macOS**: `lsof`, `ps`, `kill`
246
+
247
+ These tools are typically pre-installed on all platforms.
248
+
249
+ ## 🔧 Development
250
+
251
+ ### Clone and setup
252
+
253
+ ```bash
254
+ git clone https://github.com/farman20ali/port-killer.git
255
+ cd port-killer
256
+
257
+ # Install in development mode
258
+ pip install -e .
259
+ ```
260
+
261
+ ### Run tests
262
+
263
+ ```bash
264
+ # Test inspecting a port
265
+ kport -i 80
266
+
267
+ # Test listing ports
268
+ kport -l
269
+ ```
270
+
271
+ ## 🤝 Contributing
272
+
273
+ Contributions are welcome! Please feel free to submit a Pull Request.
274
+
275
+ 1. Fork the repository
276
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
277
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
278
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
279
+ 5. Open a Pull Request
280
+
281
+ ## 📝 License
282
+
283
+ This project is licensed under the MIT License - see the LICENSE file for details.
284
+
285
+ ## ⚠️ Important Notes
286
+
287
+ - **Administrator/sudo privileges**: Killing processes may require elevated privileges on some systems
288
+ - **Port validation**: Port numbers must be between 1 and 65535
289
+ - **Safety**: The tool asks for confirmation before killing any process
290
+ - **Multiple processes**: If multiple processes use the same port, the first one found will be shown/killed
291
+
292
+ ## 🐛 Troubleshooting
293
+
294
+ ### "Permission denied" errors
295
+
296
+ On Linux/macOS, you may need to run with sudo:
297
+ ```bash
298
+ sudo kport -k 80
299
+ ```
300
+
301
+ On Windows, run your terminal as Administrator.
302
+
303
+ ### Port not found
304
+
305
+ Make sure the port number is correct and that a process is actually using it. Use `kport -l` to see all active ports.
306
+
307
+ ### Color output not working on Windows
308
+
309
+ Colors should work on Windows 10 and later. If you're on an older version, colors may not display correctly.
310
+
311
+ ## 📧 Contact
312
+
313
+ Your Name - your.email@example.com
314
+
315
+ Project Link: [https://github.com/yourusername/port-killer](https://github.com/yourusername/port-killer)
316
+
317
+ ---
318
+
319
+ Made with ❤️ for developers who are tired of hunting down processes