router-cli 0.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.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.3
2
+ Name: router-cli
3
+ Version: 0.1.0
4
+ Summary: CLI tool to manage D-Link DSL-2750U router
5
+ Author: d3vr
6
+ Author-email: d3vr <hi@f3.al>
7
+ Requires-Dist: tomli>=2.0.0 ; python_full_version < '3.11'
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+
11
+ # router-cli
12
+
13
+ A command-line tool to manage and monitor D-Link DSL-2750U routers.
14
+
15
+ Since the router doesn't provide a formal API, this tool works by authenticating with the router's web interface and parsing the HTML status pages to extract information.
16
+
17
+ ## Features
18
+
19
+ - **Zero external dependencies** - Uses only Python standard library
20
+ - **Colorized output** - Highlights known vs unknown devices on your network
21
+ - **Comprehensive monitoring** - View status, clients, DHCP leases, routes, statistics, and logs
22
+ - **Remote management** - Reboot the router from the command line
23
+ - **ADSL statistics** - Monitor line quality metrics (SNR, attenuation, sync rates)
24
+ - **Configurable** - Define known devices with friendly aliases
25
+
26
+ ## Installation
27
+
28
+ Requires Python 3.11 or higher.
29
+
30
+ ### Using uv (recommended)
31
+
32
+ ```bash
33
+ uv tool install router-cli
34
+ ```
35
+
36
+ ### Using pip
37
+
38
+ ```bash
39
+ pip install router-cli
40
+ ```
41
+
42
+ ### From source
43
+
44
+ ```bash
45
+ git clone https://github.com/d3vr/router-cli
46
+ cd router-cli
47
+ uv sync
48
+ ```
49
+
50
+ ## Configuration
51
+
52
+ Create a configuration file at `~/.config/router/config.toml`:
53
+
54
+ ```toml
55
+ [router]
56
+ ip = "192.168.1.1"
57
+ username = "admin"
58
+ password = "your_password_here"
59
+
60
+ # Optional: Define known devices for colorized output
61
+ [known_devices]
62
+ "AA:BB:CC:DD:EE:FF" = "My Phone"
63
+ "11:22:33:44:55:66" = "Smart TV"
64
+ "DE:AD:BE:EF:00:01" = "Work Laptop"
65
+ ```
66
+
67
+ The tool searches for configuration in the following locations (in order):
68
+ 1. `./config.toml` (current directory)
69
+ 2. `~/.config/router/config.toml`
70
+ 3. `/etc/router/config.toml`
71
+
72
+ ## Usage
73
+
74
+ ### Quick Overview
75
+
76
+ ```bash
77
+ router overview
78
+ ```
79
+
80
+ Shows a dashboard with connection status, sync rates, connected devices, and warnings:
81
+
82
+ ```
83
+ ============================================================
84
+ ROUTER OVERVIEW
85
+ ============================================================
86
+
87
+ CONNECTION
88
+ ADSL Status: Showtime
89
+ Sync Rate: 8180 / 1022 Kbps (down/up)
90
+ SNR Margin: 6.5 / 12.0 dB
91
+ Default Gateway: 10.0.0.1
92
+ WAN IP: 203.0.113.45 (Connected)
93
+
94
+ NETWORK
95
+ Router IP: 192.168.1.1
96
+ SSID: MyNetwork
97
+ Wireless Clients: 3
98
+ DHCP Leases: 5
99
+
100
+ DEVICES
101
+ My Phone AA:BB:CC:DD:EE:FF 192.168.1.100 ⏱ 22:45:30
102
+ Smart TV 11:22:33:44:55:66 192.168.1.101 ⏱ 20:15:45
103
+ unknown-device CC:DD:EE:FF:00:11 192.168.1.102 ⏱ 18:30:00
104
+
105
+ WARNINGS
106
+ Unknown devices on network: 1
107
+
108
+ ============================================================
109
+ ```
110
+
111
+ ### Available Commands
112
+
113
+ | Command | Description |
114
+ |---------|-------------|
115
+ | `router status` | Display full router status (system, internet, wireless, local network) |
116
+ | `router overview` | Show quick dashboard with highlights |
117
+ | `router clients` | List connected wireless clients |
118
+ | `router dhcp` | Show DHCP leases with expiration times |
119
+ | `router stats` | Show network interface and ADSL statistics |
120
+ | `router routes` | Display the kernel routing table |
121
+ | `router logs` | Show system logs |
122
+ | `router reboot` | Reboot the router |
123
+
124
+ ### Command Details
125
+
126
+ #### Status
127
+
128
+ ```bash
129
+ router status
130
+ ```
131
+
132
+ Displays comprehensive router information:
133
+ - System info (model, firmware, date/time)
134
+ - Internet info (gateway, DNS servers, WAN connections)
135
+ - Wireless info (SSID, MAC, security mode)
136
+ - Local network (IP, subnet, DHCP status)
137
+
138
+ #### Wireless Clients
139
+
140
+ ```bash
141
+ router clients
142
+ ```
143
+
144
+ Lists all connected wireless devices with association and authorization status.
145
+
146
+ #### DHCP Leases
147
+
148
+ ```bash
149
+ router dhcp
150
+ ```
151
+
152
+ Shows all active DHCP leases with device names, MAC addresses, IP addresses, and lease expiration times.
153
+
154
+ #### Network Statistics
155
+
156
+ ```bash
157
+ router stats
158
+ ```
159
+
160
+ Displays detailed statistics including:
161
+ - LAN interface traffic (bytes, packets, errors, drops)
162
+ - WAN interface traffic
163
+ - ADSL line metrics (sync rate, SNR margin, attenuation, output power)
164
+
165
+ #### System Logs
166
+
167
+ ```bash
168
+ router logs # Show all logs
169
+ router logs --tail 20 # Show last 20 entries
170
+ router logs --level error # Filter by severity level
171
+ router logs -n 10 -l warning # Combine options
172
+ ```
173
+
174
+ #### Routing Table
175
+
176
+ ```bash
177
+ router routes
178
+ ```
179
+
180
+ Displays the kernel routing table with destination, gateway, subnet mask, flags, metric, and service.
181
+
182
+ #### Reboot
183
+
184
+ ```bash
185
+ router reboot
186
+ ```
187
+
188
+ Sends a reboot command to the router.
189
+
190
+ ## Known Devices
191
+
192
+ The `[known_devices]` section in your config file maps MAC addresses to friendly names. This enables:
193
+
194
+ - **Color-coded output**: Known devices appear in green, unknown in red
195
+ - **Friendly names**: See "My Phone" instead of a hostname or MAC address
196
+ - **Security awareness**: Quickly spot unauthorized devices on your network
197
+
198
+ ```toml
199
+ [known_devices]
200
+ "AA:BB:CC:DD:EE:FF" = "My Phone"
201
+ "11:22:33:44:55:66" = "Smart TV"
202
+ ```
203
+
204
+ MAC addresses are matched case-insensitively.
205
+
206
+ ## Development
207
+
208
+ See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for the full development guide.
209
+
210
+ ### Quick Start
211
+
212
+ ```bash
213
+ git clone https://github.com/d3vr/router-cli
214
+ cd router-cli
215
+ uv sync --all-groups
216
+ uv run pytest
217
+ ```
218
+
219
+ ## Compatibility
220
+
221
+ - **Python**: 3.11+
222
+ - **Router**: D-Link DSL-2750U (firmware ME_1.00)
223
+
224
+ This tool may work with other D-Link routers that share a similar web interface, but has only been tested with the DSL-2750U.
225
+
226
+ ## License
227
+
228
+ MIT
@@ -0,0 +1,9 @@
1
+ router_cli/__init__.py,sha256=R-j6ZUnvZT4qKwxPGaYBQEOCLsPATLn1qHLHSmdfo2c,74
2
+ router_cli/client.py,sha256=DuOqZvsCkcgut2k0LqKcdYD_rN4E1TRtwfqm9bnJTEU,29631
3
+ router_cli/config.py,sha256=SX1s1CJk_XiiCHlZ47I9vgda9IRqqUwBTQKjC3BYoVE,1803
4
+ router_cli/main.py,sha256=UzIYNKIM9f4NQ2UW-wenI8yQRVKMVMiPyaXPjyTggaU,22469
5
+ router_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ router_cli-0.1.0.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
7
+ router_cli-0.1.0.dist-info/entry_points.txt,sha256=PfkydZeDJvlgvEXYOG1gYvbTM39Cm-OgsPpREH3UNAU,49
8
+ router_cli-0.1.0.dist-info/METADATA,sha256=HqMMKyryg1MFSZneA_OMyN3rR7mJ_7VBp7OCcjuKHJA,5509
9
+ router_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.28
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ router = router_cli.main:main
3
+