kport 1.1.0__tar.gz → 2.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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kport
3
- Version: 1.1.0
3
+ Version: 2.0.0
4
4
  Summary: A cross-platform command-line tool to inspect and kill processes using specific ports
5
5
  Home-page: https://github.com/farman20ali/port-killer
6
- Author: Farman Ali
7
- Author-email: farman20ali@gmail.com
6
+ Author: Farman Ali (Alien)
7
+ Author-email: farman20ali@example.com
8
8
  Project-URL: Bug Reports, https://github.com/farman20ali/port-killer/issues
9
9
  Project-URL: Source, https://github.com/farman20ali/port-killer
10
10
  Keywords: port,kill,process,network,cross-platform,cli
@@ -42,24 +42,16 @@ Dynamic: summary
42
42
 
43
43
  # 🔪 kport - Cross-Platform Port Inspector and Killer
44
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
45
  A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
51
46
 
52
47
  ## ✨ Features
53
48
 
54
49
  - 🔍 **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
50
  - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
58
51
  - 🔪 **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
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
63
55
  - 🎨 **Colorized output** - Easy-to-read colored terminal output
64
56
  - ✅ **Confirmation prompts** - Safety confirmation before killing processes
65
57
  - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
@@ -70,17 +62,13 @@ A simple, powerful command-line tool to inspect and kill processes using specifi
70
62
  ### Quick Install (Once Published to PyPI)
71
63
 
72
64
  ```bash
73
- # Recommended: Install to user directory
74
- pip install --user kport
75
-
76
- # Or install system-wide (requires admin/sudo)
77
65
  pip install kport
78
66
  ```
79
67
 
80
68
  ### Install from GitHub
81
69
 
82
70
  ```bash
83
- pip install --user git+https://github.com/farman20ali/port-killer.git
71
+ pip install git+https://github.com/farman20ali/port-killer.git
84
72
  ```
85
73
 
86
74
  ### Install from Source
@@ -90,10 +78,7 @@ pip install --user git+https://github.com/farman20ali/port-killer.git
90
78
  git clone https://github.com/farman20ali/port-killer.git
91
79
  cd port-killer
92
80
 
93
- # Install to user directory (recommended)
94
- pip install --user .
95
-
96
- # Or install system-wide (requires admin/sudo)
81
+ # Install
97
82
  pip install .
98
83
  ```
99
84
 
@@ -101,7 +86,7 @@ pip install .
101
86
 
102
87
  ```bash
103
88
  # Install in editable mode
104
- pip install --user -e .
89
+ pip install -e .
105
90
  ```
106
91
 
107
92
  After installation, `kport` will be available globally in your terminal.
@@ -113,8 +98,6 @@ After installation, `kport` will be available globally in your terminal.
113
98
  python kport.py -h
114
99
  ```
115
100
 
116
- > 💡 **Tip:** If `kport` command doesn't work after installation, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
117
- >
118
101
  > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
119
102
  >
120
103
  > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
@@ -167,48 +150,6 @@ PID Process Port State
167
150
  ✓ Total connections: 3
168
151
  ```
169
152
 
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
153
  ### Kill a process on a port
213
154
 
214
155
  Terminate the process using a specific port:
@@ -308,34 +249,6 @@ Are you sure you want to kill 3 process(es)? (y/N): y
308
249
  Ports freed: 3000, 3001, 3002
309
250
  ```
310
251
 
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
252
  ### Show help
340
253
 
341
254
  ```bash
@@ -353,13 +266,10 @@ kport -v
353
266
  | Option | Long Form | Description |
354
267
  |--------|-----------|-------------|
355
268
  | `-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
269
  | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
359
270
  | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
360
271
  | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
361
272
  | `-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
273
  | `-l` | `--list` | List all listening ports and their processes |
364
274
  | `-v` | `--version` | Show version information |
365
275
  | `-h` | `--help` | Show help message |
@@ -1,23 +1,15 @@
1
1
  # 🔪 kport - Cross-Platform Port Inspector and Killer
2
2
 
3
- [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/farman20ali/port-killer)
4
- [![Python](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/)
5
- [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6
- [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com/farman20ali/port-killer)
7
-
8
3
  A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
9
4
 
10
5
  ## ✨ Features
11
6
 
12
7
  - 🔍 **Inspect ports** - Find which process is using a specific port
13
- - 🔎 **Inspect multiple ports** - Check multiple ports at once
14
- - 🔍 **Inspect port range** - Scan a range of ports (e.g., 3000-3010)
15
8
  - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
16
9
  - 🔪 **Kill processes** - Terminate processes using specific ports
17
- - 💥 **Kill port range** - Terminate processes on a range of ports
18
- - 🔫 **Kill multiple ports** - Kill processes on multiple ports at once
19
- - 🎯 **Kill by process name** - Kill all processes matching a name (e.g., "node", "python")
20
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
21
13
  - 🎨 **Colorized output** - Easy-to-read colored terminal output
22
14
  - ✅ **Confirmation prompts** - Safety confirmation before killing processes
23
15
  - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
@@ -28,17 +20,13 @@ A simple, powerful command-line tool to inspect and kill processes using specifi
28
20
  ### Quick Install (Once Published to PyPI)
29
21
 
30
22
  ```bash
31
- # Recommended: Install to user directory
32
- pip install --user kport
33
-
34
- # Or install system-wide (requires admin/sudo)
35
23
  pip install kport
36
24
  ```
37
25
 
38
26
  ### Install from GitHub
39
27
 
40
28
  ```bash
41
- pip install --user git+https://github.com/farman20ali/port-killer.git
29
+ pip install git+https://github.com/farman20ali/port-killer.git
42
30
  ```
43
31
 
44
32
  ### Install from Source
@@ -48,10 +36,7 @@ pip install --user git+https://github.com/farman20ali/port-killer.git
48
36
  git clone https://github.com/farman20ali/port-killer.git
49
37
  cd port-killer
50
38
 
51
- # Install to user directory (recommended)
52
- pip install --user .
53
-
54
- # Or install system-wide (requires admin/sudo)
39
+ # Install
55
40
  pip install .
56
41
  ```
57
42
 
@@ -59,7 +44,7 @@ pip install .
59
44
 
60
45
  ```bash
61
46
  # Install in editable mode
62
- pip install --user -e .
47
+ pip install -e .
63
48
  ```
64
49
 
65
50
  After installation, `kport` will be available globally in your terminal.
@@ -71,8 +56,6 @@ After installation, `kport` will be available globally in your terminal.
71
56
  python kport.py -h
72
57
  ```
73
58
 
74
- > 💡 **Tip:** If `kport` command doesn't work after installation, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
75
- >
76
59
  > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
77
60
  >
78
61
  > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
@@ -125,48 +108,6 @@ PID Process Port State
125
108
  ✓ Total connections: 3
126
109
  ```
127
110
 
128
- ### Inspect multiple ports
129
-
130
- Check multiple ports at once:
131
-
132
- ```bash
133
- kport -im 3000 3001 8080 8081
134
- ```
135
-
136
- Example output:
137
- ```
138
- 🔍 Inspecting 4 port(s)...
139
-
140
- Port PID Process
141
- ────────────────────────────────────────────────────────────
142
- 3000 12345 node.exe
143
- 3001 12346 node.exe
144
- 8080 12347 python.exe
145
-
146
- ✓ Found processes on 3/4 port(s)
147
- ```
148
-
149
- ### Inspect port range
150
-
151
- Scan a range of ports:
152
-
153
- ```bash
154
- kport -ir 3000-3010
155
- ```
156
-
157
- Example output:
158
- ```
159
- 🔍 Inspecting port range 3000-3010 (11 ports)...
160
-
161
- Port PID Process
162
- ────────────────────────────────────────────────────────────
163
- 3000 12345 node.exe
164
- 3001 12346 node.exe
165
- 3005 12347 python.exe
166
-
167
- ✓ Found processes on 3/11 port(s) in range
168
- ```
169
-
170
111
  ### Kill a process on a port
171
112
 
172
113
  Terminate the process using a specific port:
@@ -266,34 +207,6 @@ Are you sure you want to kill 3 process(es)? (y/N): y
266
207
  Ports freed: 3000, 3001, 3002
267
208
  ```
268
209
 
269
- ### Kill port range
270
-
271
- Kill all processes on a range of ports:
272
-
273
- ```bash
274
- kport -kr 3000-3010
275
- ```
276
-
277
- Example output:
278
- ```
279
- 🔪 Killing processes on port range 3000-3010 (11 ports)...
280
-
281
- Found processes on 3 port(s) in range:
282
- ──────────────────────────────────────────────────
283
- Port 3000: PID 12345 (node.exe)
284
- Port 3001: PID 12346 (node.exe)
285
- Port 3005: PID 12347 (python.exe)
286
-
287
- Are you sure you want to kill 3 process(es)? (y/N): y
288
-
289
- ✓ Killed process on port 3000 (PID 12345)
290
- ✓ Killed process on port 3001 (PID 12346)
291
- ✓ Killed process on port 3005 (PID 12347)
292
-
293
- ✓ Successfully killed 3/3 process(es)
294
- Ports freed: 3000, 3001, 3005
295
- ```
296
-
297
210
  ### Show help
298
211
 
299
212
  ```bash
@@ -311,13 +224,10 @@ kport -v
311
224
  | Option | Long Form | Description |
312
225
  |--------|-----------|-------------|
313
226
  | `-i PORT` | `--inspect PORT` | Inspect which process is using the specified port |
314
- | `-im PORT [PORT ...]` | `--inspect-multiple PORT [PORT ...]` | Inspect multiple ports at once |
315
- | `-ir RANGE` | `--inspect-range RANGE` | Inspect port range (e.g., 3000-3010) |
316
227
  | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
317
228
  | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
318
229
  | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
319
230
  | `-ka PORT [PORT ...]` | `--kill-all PORT [PORT ...]` | Kill processes on multiple ports at once |
320
- | `-kr RANGE` | `--kill-range RANGE` | Kill processes on port range (e.g., 3000-3010) |
321
231
  | `-l` | `--list` | List all listening ports and their processes |
322
232
  | `-v` | `--version` | Show version information |
323
233
  | `-h` | `--help` | Show help message |
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kport
3
- Version: 1.1.0
3
+ Version: 2.0.0
4
4
  Summary: A cross-platform command-line tool to inspect and kill processes using specific ports
5
5
  Home-page: https://github.com/farman20ali/port-killer
6
- Author: Farman Ali
7
- Author-email: farman20ali@gmail.com
6
+ Author: Farman Ali (Alien)
7
+ Author-email: farman20ali@example.com
8
8
  Project-URL: Bug Reports, https://github.com/farman20ali/port-killer/issues
9
9
  Project-URL: Source, https://github.com/farman20ali/port-killer
10
10
  Keywords: port,kill,process,network,cross-platform,cli
@@ -42,24 +42,16 @@ Dynamic: summary
42
42
 
43
43
  # 🔪 kport - Cross-Platform Port Inspector and Killer
44
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
45
  A simple, powerful command-line tool to inspect and kill processes using specific ports on Windows, Linux, and macOS.
51
46
 
52
47
  ## ✨ Features
53
48
 
54
49
  - 🔍 **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
50
  - 🔎 **Inspect by process name** - Find all processes matching a name and their ports
58
51
  - 🔪 **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
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
63
55
  - 🎨 **Colorized output** - Easy-to-read colored terminal output
64
56
  - ✅ **Confirmation prompts** - Safety confirmation before killing processes
65
57
  - 🌍 **Cross-platform** - Works on Windows, Linux, and macOS
@@ -70,17 +62,13 @@ A simple, powerful command-line tool to inspect and kill processes using specifi
70
62
  ### Quick Install (Once Published to PyPI)
71
63
 
72
64
  ```bash
73
- # Recommended: Install to user directory
74
- pip install --user kport
75
-
76
- # Or install system-wide (requires admin/sudo)
77
65
  pip install kport
78
66
  ```
79
67
 
80
68
  ### Install from GitHub
81
69
 
82
70
  ```bash
83
- pip install --user git+https://github.com/farman20ali/port-killer.git
71
+ pip install git+https://github.com/farman20ali/port-killer.git
84
72
  ```
85
73
 
86
74
  ### Install from Source
@@ -90,10 +78,7 @@ pip install --user git+https://github.com/farman20ali/port-killer.git
90
78
  git clone https://github.com/farman20ali/port-killer.git
91
79
  cd port-killer
92
80
 
93
- # Install to user directory (recommended)
94
- pip install --user .
95
-
96
- # Or install system-wide (requires admin/sudo)
81
+ # Install
97
82
  pip install .
98
83
  ```
99
84
 
@@ -101,7 +86,7 @@ pip install .
101
86
 
102
87
  ```bash
103
88
  # Install in editable mode
104
- pip install --user -e .
89
+ pip install -e .
105
90
  ```
106
91
 
107
92
  After installation, `kport` will be available globally in your terminal.
@@ -113,8 +98,6 @@ After installation, `kport` will be available globally in your terminal.
113
98
  python kport.py -h
114
99
  ```
115
100
 
116
- > 💡 **Tip:** If `kport` command doesn't work after installation, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
117
- >
118
101
  > 📖 For detailed installation instructions, see [INSTALL.md](INSTALL.md)
119
102
  >
120
103
  > 🚀 For publishing instructions, see [PUBLISH.md](PUBLISH.md)
@@ -167,48 +150,6 @@ PID Process Port State
167
150
  ✓ Total connections: 3
168
151
  ```
169
152
 
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
153
  ### Kill a process on a port
213
154
 
214
155
  Terminate the process using a specific port:
@@ -308,34 +249,6 @@ Are you sure you want to kill 3 process(es)? (y/N): y
308
249
  Ports freed: 3000, 3001, 3002
309
250
  ```
310
251
 
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
252
  ### Show help
340
253
 
341
254
  ```bash
@@ -353,13 +266,10 @@ kport -v
353
266
  | Option | Long Form | Description |
354
267
  |--------|-----------|-------------|
355
268
  | `-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
269
  | `-ip NAME` | `--inspect-process NAME` | Inspect all processes matching the given name and their ports |
359
270
  | `-k PORT` | `--kill PORT` | Kill the process using the specified port |
360
271
  | `-kp NAME` | `--kill-process NAME` | Kill all processes matching the given name |
361
272
  | `-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
273
  | `-l` | `--list` | List all listening ports and their processes |
364
274
  | `-v` | `--version` | Show version information |
365
275
  | `-h` | `--help` | Show help message |
@@ -50,35 +50,6 @@ def validate_port(port):
50
50
  sys.exit(1)
51
51
 
52
52
 
53
- def parse_port_range(port_range):
54
- """Parse port range string (e.g., '3000-3010') into list of ports"""
55
- try:
56
- if '-' in port_range:
57
- start, end = port_range.split('-')
58
- start_port = int(start.strip())
59
- end_port = int(end.strip())
60
-
61
- if start_port > end_port:
62
- print(colorize(f"Error: Invalid range {port_range}. Start port must be less than end port.", Colors.RED))
63
- sys.exit(1)
64
-
65
- if end_port - start_port > 1000:
66
- print(colorize(f"Error: Range too large ({end_port - start_port} ports). Maximum 1000 ports allowed.", Colors.RED))
67
- sys.exit(1)
68
-
69
- ports = list(range(start_port, end_port + 1))
70
- for port in ports:
71
- validate_port(port)
72
- return ports
73
- else:
74
- port = int(port_range)
75
- validate_port(port)
76
- return [port]
77
- except ValueError:
78
- print(colorize(f"Error: Invalid port or range format: {port_range}", Colors.RED))
79
- sys.exit(1)
80
-
81
-
82
53
  def find_pid(port):
83
54
  """Find process ID using given port"""
84
55
  system = platform.system()
@@ -259,23 +230,16 @@ def main():
259
230
  parser = argparse.ArgumentParser(
260
231
  description="🔪 kport - Cross-platform port inspector and killer",
261
232
  epilog="Examples:\n"
262
- " kport -i 8080 Inspect port 8080\n"
263
- " kport -im 3000 3001 3002 Inspect multiple ports\n"
264
- " kport -ir 3000-3010 Inspect port range\n"
265
- " kport -ip node Inspect all processes matching 'node'\n"
266
- " kport -k 8080 Kill process using port 8080\n"
267
- " kport -ka 3000 3001 3002 Kill processes on multiple ports\n"
268
- " kport -kr 3000-3010 Kill processes on port range\n"
269
- " kport -kp node Kill all processes matching 'node'\n"
270
- " kport -l List all listening ports\n",
233
+ " kport -i 8080 Inspect port 8080\n"
234
+ " kport -ip node Inspect all processes matching 'node'\n"
235
+ " kport -k 8080 Kill process using port 8080\n"
236
+ " kport -l List all listening ports\n"
237
+ " kport -kp node Kill all processes matching 'node'\n"
238
+ " kport -ka 3000 3001 3002 Kill processes on multiple ports\n",
271
239
  formatter_class=argparse.RawDescriptionHelpFormatter
272
240
  )
273
241
  parser.add_argument("-i", "--inspect", type=int, metavar="PORT",
274
242
  help="Inspect which process is using the specified port")
275
- parser.add_argument("-im", "--inspect-multiple", type=int, nargs="+", metavar="PORT",
276
- help="Inspect multiple ports")
277
- parser.add_argument("-ir", "--inspect-range", type=str, metavar="RANGE",
278
- help="Inspect port range (e.g., 3000-3010)")
279
243
  parser.add_argument("-ip", "--inspect-process", type=str, metavar="NAME",
280
244
  help="Inspect all processes matching the given name")
281
245
  parser.add_argument("-k", "--kill", type=int, metavar="PORT",
@@ -284,67 +248,20 @@ def main():
284
248
  help="Kill all processes matching the given name")
285
249
  parser.add_argument("-ka", "--kill-all", type=int, nargs="+", metavar="PORT",
286
250
  help="Kill processes on multiple ports")
287
- parser.add_argument("-kr", "--kill-range", type=str, metavar="RANGE",
288
- help="Kill processes on port range (e.g., 3000-3010)")
289
251
  parser.add_argument("-l", "--list", action="store_true",
290
252
  help="List all listening ports and their processes")
291
- parser.add_argument("-v", "--version", action="version", version="kport 1.1.0")
253
+ parser.add_argument("-v", "--version", action="version", version="kport 2.0.0")
292
254
 
293
255
  args = parser.parse_args()
294
256
 
295
257
  # If no arguments provided, show help
296
- if not (args.inspect or args.inspect_multiple or args.inspect_range or args.inspect_process or
297
- args.kill or args.list or args.kill_process or args.kill_all or args.kill_range):
258
+ if not (args.inspect or args.inspect_process or args.kill or args.list or args.kill_process or args.kill_all):
298
259
  parser.print_help()
299
260
  sys.exit(0)
300
261
 
301
262
  if args.list:
302
263
  list_all_ports()
303
264
 
304
- if args.inspect_multiple:
305
- print(colorize(f"\n🔍 Inspecting {len(args.inspect_multiple)} port(s)...\n", Colors.CYAN + Colors.BOLD))
306
-
307
- results = []
308
- for port in args.inspect_multiple:
309
- validate_port(port)
310
- pid, info = find_pid(port)
311
- if pid:
312
- proc_name = get_process_name(pid)
313
- results.append((port, pid, proc_name))
314
-
315
- if not results:
316
- print(colorize(f"❌ No processes found on any of the specified ports", Colors.RED))
317
- else:
318
- print(colorize(f"{'Port':<10} {'PID':<10} {'Process':<30}", Colors.BOLD))
319
- print("─" * 60)
320
-
321
- for port, pid, proc_name in results:
322
- print(f"{colorize(str(port), Colors.CYAN):<19} {pid:<10} {proc_name:<30}")
323
-
324
- print(colorize(f"\n✓ Found processes on {len(results)}/{len(args.inspect_multiple)} port(s)", Colors.GREEN))
325
-
326
- if args.inspect_range:
327
- ports = parse_port_range(args.inspect_range)
328
- print(colorize(f"\n🔍 Inspecting port range {args.inspect_range} ({len(ports)} ports)...\n", Colors.CYAN + Colors.BOLD))
329
-
330
- results = []
331
- for port in ports:
332
- pid, info = find_pid(port)
333
- if pid:
334
- proc_name = get_process_name(pid)
335
- results.append((port, pid, proc_name))
336
-
337
- if not results:
338
- print(colorize(f"❌ No processes found in port range {args.inspect_range}", Colors.RED))
339
- else:
340
- print(colorize(f"{'Port':<10} {'PID':<10} {'Process':<30}", Colors.BOLD))
341
- print("─" * 60)
342
-
343
- for port, pid, proc_name in results:
344
- print(f"{colorize(str(port), Colors.CYAN):<19} {pid:<10} {proc_name:<30}")
345
-
346
- print(colorize(f"\n✓ Found processes on {len(results)}/{len(ports)} port(s) in range", Colors.GREEN))
347
-
348
265
  if args.inspect_process:
349
266
  print(colorize(f"\n🔍 Inspecting processes matching '{args.inspect_process}'...\n", Colors.CYAN + Colors.BOLD))
350
267
 
@@ -464,50 +381,6 @@ def main():
464
381
  print(colorize(f"\n✓ Successfully killed {killed_count}/{len(port_pid_map)} process(es)", Colors.GREEN + Colors.BOLD))
465
382
  print(colorize(f"Ports freed: {', '.join(map(str, port_pid_map.keys()))}", Colors.GREEN))
466
383
 
467
- if args.kill_range:
468
- ports = parse_port_range(args.kill_range)
469
- print(colorize(f"\n🔪 Killing processes on port range {args.kill_range} ({len(ports)} ports)...\n", Colors.CYAN + Colors.BOLD))
470
-
471
- # Find all PIDs in range
472
- port_pid_map = {}
473
- for port in ports:
474
- pid, info = find_pid(port)
475
- if pid:
476
- port_pid_map[port] = (pid, info)
477
-
478
- if not port_pid_map:
479
- print(colorize(f"❌ No processes found in port range {args.kill_range}", Colors.RED))
480
- else:
481
- print(colorize(f"Found processes on {len(port_pid_map)} port(s) in range:", Colors.YELLOW))
482
- print("─" * 50)
483
-
484
- for port, (pid, info) in port_pid_map.items():
485
- proc_name = get_process_name(pid)
486
- print(colorize(f" Port {port}: PID {pid} ({proc_name})", Colors.WHITE))
487
-
488
- # Ask for confirmation
489
- try:
490
- confirm = input(colorize(f"\nAre you sure you want to kill {len(port_pid_map)} process(es)? (y/N): ", Colors.MAGENTA))
491
- if confirm.lower() not in ['y', 'yes']:
492
- print(colorize("Operation cancelled.", Colors.YELLOW))
493
- sys.exit(0)
494
- except KeyboardInterrupt:
495
- print(colorize("\n\nOperation cancelled.", Colors.YELLOW))
496
- sys.exit(0)
497
-
498
- # Kill all processes
499
- killed_count = 0
500
- for port, (pid, info) in port_pid_map.items():
501
- result = kill_pid(pid, silent=True)
502
- if result or "SUCCESS" in str(result) or "killed" in str(result).lower():
503
- killed_count += 1
504
- print(colorize(f"✓ Killed process on port {port} (PID {pid})", Colors.GREEN))
505
- else:
506
- print(colorize(f"✗ Failed to kill process on port {port} (PID {pid})", Colors.RED))
507
-
508
- print(colorize(f"\n✓ Successfully killed {killed_count}/{len(port_pid_map)} process(es)", Colors.GREEN + Colors.BOLD))
509
- print(colorize(f"Ports freed: {', '.join(map(str, port_pid_map.keys()))}", Colors.GREEN))
510
-
511
384
  if args.inspect:
512
385
  validate_port(args.inspect)
513
386
  print(colorize(f"\n🔍 Inspecting port {args.inspect}...\n", Colors.CYAN + Colors.BOLD))
@@ -8,9 +8,9 @@ with open("README.md", "r", encoding="utf-8") as fh:
8
8
 
9
9
  setup(
10
10
  name="kport",
11
- version="1.1.0",
12
- author="Farman Ali",
13
- author_email="farman20ali@gmail.com",
11
+ version="2.0.0",
12
+ author="Farman Ali (Alien)",
13
+ author_email="farman20ali@example.com",
14
14
  description="A cross-platform command-line tool to inspect and kill processes using specific ports",
15
15
  long_description=long_description,
16
16
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes