tplinkrouterc6u 5.3.0__tar.gz → 5.4.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.
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/PKG-INFO +3 -2
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/README.md +2 -1
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/setup.py +1 -1
- tplinkrouterc6u-5.4.0/test/test_client_c1200.py +259 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/c1200.py +36 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/package_enum.py +5 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/PKG-INFO +3 -2
- tplinkrouterc6u-5.3.0/test/test_client_c1200.py +0 -142
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/LICENSE +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/setup.cfg +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/__init__.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/test_client_c6u.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/test_client_deco.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/test_client_ex.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/test_client_mr.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/test/test_client_xdr.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/__init__.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/__init__.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/c5400x.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/c6u.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/c6v4.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/deco.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/ex.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/mr.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client/xdr.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/client_abstract.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/__init__.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/dataclass.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/encryption.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/exception.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/common/helper.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u/provider.py +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/SOURCES.txt +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/dependency_links.txt +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/requires.txt +0 -0
- {tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.4.0
|
|
4
4
|
Summary: TP-Link Router API
|
|
5
5
|
Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
|
|
6
6
|
Author: Alex Erohin
|
|
@@ -303,7 +303,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
303
303
|
- Archer C7 (v4.0, v5.0)
|
|
304
304
|
- Archer C5400X V1
|
|
305
305
|
- Archer GX90 v1.0
|
|
306
|
-
- Archer MR200 (v5, v5.3)
|
|
306
|
+
- Archer MR200 (v5, v5.3, v6.0)
|
|
307
307
|
- Archer MR550 v1
|
|
308
308
|
- Archer MR600 (v1, v2, v3)
|
|
309
309
|
- Archer VR600 v3
|
|
@@ -328,6 +328,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
328
328
|
- TL-MR6500v
|
|
329
329
|
- TL-XDR3010 V2
|
|
330
330
|
- TL-WA3001 v1.0
|
|
331
|
+
- NX510v v1.0
|
|
331
332
|
|
|
332
333
|
### Not fully tested Hardware Versions
|
|
333
334
|
- AD7200 V2
|
|
@@ -281,7 +281,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
281
281
|
- Archer C7 (v4.0, v5.0)
|
|
282
282
|
- Archer C5400X V1
|
|
283
283
|
- Archer GX90 v1.0
|
|
284
|
-
- Archer MR200 (v5, v5.3)
|
|
284
|
+
- Archer MR200 (v5, v5.3, v6.0)
|
|
285
285
|
- Archer MR550 v1
|
|
286
286
|
- Archer MR600 (v1, v2, v3)
|
|
287
287
|
- Archer VR600 v3
|
|
@@ -306,6 +306,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
306
306
|
- TL-MR6500v
|
|
307
307
|
- TL-XDR3010 V2
|
|
308
308
|
- TL-WA3001 v1.0
|
|
309
|
+
- NX510v v1.0
|
|
309
310
|
|
|
310
311
|
### Not fully tested Hardware Versions
|
|
311
312
|
- AD7200 V2
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
from unittest import main, TestCase
|
|
2
|
+
from json import loads
|
|
3
|
+
from tplinkrouterc6u import (
|
|
4
|
+
TplinkC1200Router,
|
|
5
|
+
Connection,
|
|
6
|
+
ClientException,
|
|
7
|
+
)
|
|
8
|
+
from tplinkrouterc6u.common.package_enum import VPN
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestTPLinkC1200Client(TestCase):
|
|
12
|
+
def test_set_led_on(self) -> None:
|
|
13
|
+
response_led_general_read = """
|
|
14
|
+
{
|
|
15
|
+
"enable": "off",
|
|
16
|
+
"time_set": "yes",
|
|
17
|
+
"ledpm_support": "yes"
|
|
18
|
+
}
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
response_led_general_write = """
|
|
22
|
+
{
|
|
23
|
+
"enable": "on",
|
|
24
|
+
"time_set": "yes",
|
|
25
|
+
"ledpm_support": "yes"
|
|
26
|
+
}
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
30
|
+
def request(
|
|
31
|
+
self,
|
|
32
|
+
path: str,
|
|
33
|
+
data: str,
|
|
34
|
+
ignore_response: bool = False,
|
|
35
|
+
ignore_errors: bool = False,
|
|
36
|
+
) -> dict | None:
|
|
37
|
+
if path == "admin/ledgeneral?form=setting&operation=read":
|
|
38
|
+
return loads(response_led_general_read)
|
|
39
|
+
if path == "admin/ledgeneral?form=setting&operation=write":
|
|
40
|
+
self.captured_path = path
|
|
41
|
+
return loads(response_led_general_write)
|
|
42
|
+
raise ClientException()
|
|
43
|
+
|
|
44
|
+
client = TPLinkRouterTest("", "")
|
|
45
|
+
|
|
46
|
+
client.set_led(True)
|
|
47
|
+
|
|
48
|
+
expected_path = "admin/ledgeneral?form=setting&operation=write"
|
|
49
|
+
|
|
50
|
+
self.assertEqual(client.captured_path, expected_path)
|
|
51
|
+
|
|
52
|
+
def test_set_led_off(self) -> None:
|
|
53
|
+
response_led_general_read = """
|
|
54
|
+
{
|
|
55
|
+
"enable": "on",
|
|
56
|
+
"time_set": "yes",
|
|
57
|
+
"ledpm_support": "yes"
|
|
58
|
+
}
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
response_led_general_write = """
|
|
62
|
+
{
|
|
63
|
+
"enable": "off",
|
|
64
|
+
"time_set": "yes",
|
|
65
|
+
"ledpm_support": "yes"
|
|
66
|
+
}
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
70
|
+
def request(
|
|
71
|
+
self,
|
|
72
|
+
path: str,
|
|
73
|
+
data: str,
|
|
74
|
+
ignore_response: bool = False,
|
|
75
|
+
ignore_errors: bool = False,
|
|
76
|
+
) -> dict | None:
|
|
77
|
+
if path == "admin/ledgeneral?form=setting&operation=read":
|
|
78
|
+
return loads(response_led_general_read)
|
|
79
|
+
if path == "admin/ledgeneral?form=setting&operation=write":
|
|
80
|
+
self.captured_path = path
|
|
81
|
+
return loads(response_led_general_write)
|
|
82
|
+
raise ClientException()
|
|
83
|
+
|
|
84
|
+
client = TPLinkRouterTest("", "")
|
|
85
|
+
|
|
86
|
+
client.set_led(False)
|
|
87
|
+
|
|
88
|
+
expected_path = "admin/ledgeneral?form=setting&operation=write"
|
|
89
|
+
|
|
90
|
+
self.assertEqual(client.captured_path, expected_path)
|
|
91
|
+
|
|
92
|
+
def test_led_status(self) -> None:
|
|
93
|
+
response_led_general_read = """
|
|
94
|
+
{
|
|
95
|
+
"enable": "on",
|
|
96
|
+
"time_set": "yes",
|
|
97
|
+
"ledpm_support": "yes"
|
|
98
|
+
}
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
102
|
+
def request(
|
|
103
|
+
self,
|
|
104
|
+
path: str,
|
|
105
|
+
data: str,
|
|
106
|
+
ignore_response: bool = False,
|
|
107
|
+
ignore_errors: bool = False,
|
|
108
|
+
) -> dict | None:
|
|
109
|
+
if path == "admin/ledgeneral?form=setting&operation=read":
|
|
110
|
+
return loads(response_led_general_read)
|
|
111
|
+
raise ClientException()
|
|
112
|
+
|
|
113
|
+
client = TPLinkRouterTest("", "")
|
|
114
|
+
|
|
115
|
+
led_status = client.get_led()
|
|
116
|
+
self.assertTrue(led_status)
|
|
117
|
+
|
|
118
|
+
def test_set_wifi(self) -> None:
|
|
119
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
120
|
+
def request(
|
|
121
|
+
self,
|
|
122
|
+
path: str,
|
|
123
|
+
data: str,
|
|
124
|
+
ignore_response: bool = False,
|
|
125
|
+
ignore_errors: bool = False,
|
|
126
|
+
) -> dict | None:
|
|
127
|
+
self.captured_path = path
|
|
128
|
+
self.captured_data = data
|
|
129
|
+
|
|
130
|
+
client = TPLinkRouterTest("", "")
|
|
131
|
+
client.set_wifi(
|
|
132
|
+
Connection.HOST_5G,
|
|
133
|
+
enable=True,
|
|
134
|
+
ssid="TestSSID",
|
|
135
|
+
hidden="no",
|
|
136
|
+
encryption="WPA3-PSK",
|
|
137
|
+
psk_version="2",
|
|
138
|
+
psk_cipher="AES",
|
|
139
|
+
psk_key="testkey123",
|
|
140
|
+
hwmode="11ac",
|
|
141
|
+
htmode="VHT20",
|
|
142
|
+
channel=36,
|
|
143
|
+
txpower="20",
|
|
144
|
+
disabled_all="no",
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
expected_data = (
|
|
148
|
+
"operation=write&enable=on&ssid=TestSSID&hidden=no&encryption=WPA3-PSK&"
|
|
149
|
+
"psk_version=2&psk_cipher=AES&psk_key=testkey123&hwmode=11ac&"
|
|
150
|
+
"htmode=VHT20&channel=36&txpower=20&disabled_all=no"
|
|
151
|
+
)
|
|
152
|
+
expected_path = f"admin/wireless?form=wireless_5g&{expected_data}"
|
|
153
|
+
|
|
154
|
+
self.assertEqual(client.captured_path, expected_path)
|
|
155
|
+
self.assertEqual(client.captured_data, expected_data)
|
|
156
|
+
|
|
157
|
+
def test_vpn_status(self) -> None:
|
|
158
|
+
response_openvpn_read = """
|
|
159
|
+
{
|
|
160
|
+
"enabled": "on",
|
|
161
|
+
"proto": "udp",
|
|
162
|
+
"access": "home",
|
|
163
|
+
"cert_exist": true,
|
|
164
|
+
"mask": "255.255.255.0",
|
|
165
|
+
"port": "1194",
|
|
166
|
+
"serverip": "10.8.0.0"
|
|
167
|
+
}
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
response_pptp_read = """
|
|
171
|
+
{
|
|
172
|
+
"enabled": "off",
|
|
173
|
+
"unencrypted_access": "on",
|
|
174
|
+
"samba_access": "on",
|
|
175
|
+
"netbios_pass": "on",
|
|
176
|
+
"remoteip": "10.0.0.11-20"
|
|
177
|
+
}
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
respone_vpnconn_openvpn = """[
|
|
181
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
182
|
+
"extra": "7450", "vpntype": "openvpn", "key": "7450"},
|
|
183
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
184
|
+
"extra": "7450", "vpntype": "openvpn", "key": "7450"}
|
|
185
|
+
]"""
|
|
186
|
+
|
|
187
|
+
respone_vpnconn_pptpvpn = """[
|
|
188
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
189
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"},
|
|
190
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
191
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"},
|
|
192
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
193
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"}
|
|
194
|
+
]"""
|
|
195
|
+
|
|
196
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
197
|
+
def request(
|
|
198
|
+
self,
|
|
199
|
+
path: str,
|
|
200
|
+
data: str,
|
|
201
|
+
ignore_response: bool = False,
|
|
202
|
+
ignore_errors: bool = False,
|
|
203
|
+
) -> dict | None:
|
|
204
|
+
if path == "/admin/openvpn?form=config&operation=read":
|
|
205
|
+
return loads(response_openvpn_read)
|
|
206
|
+
if path == "/admin/pptpd?form=config&operation=read":
|
|
207
|
+
return loads(response_pptp_read)
|
|
208
|
+
if path == "/admin/vpnconn?form=config&operation=list&vpntype=openvpn":
|
|
209
|
+
return loads(respone_vpnconn_openvpn)
|
|
210
|
+
if path == "/admin/vpnconn?form=config&operation=list&vpntype=pptp":
|
|
211
|
+
return loads(respone_vpnconn_pptpvpn)
|
|
212
|
+
raise ClientException()
|
|
213
|
+
|
|
214
|
+
client = TPLinkRouterTest("", "")
|
|
215
|
+
|
|
216
|
+
vpn_status = client.get_vpn_status()
|
|
217
|
+
self.assertTrue(vpn_status.openvpn_enable)
|
|
218
|
+
self.assertFalse(vpn_status.pptpvpn_enable)
|
|
219
|
+
self.assertEqual(vpn_status.openvpn_clients_total, 2)
|
|
220
|
+
self.assertEqual(vpn_status.pptpvpn_clients_total, 3)
|
|
221
|
+
|
|
222
|
+
def test_set_vpn(self) -> None:
|
|
223
|
+
response_openvpn_read = """
|
|
224
|
+
{
|
|
225
|
+
"enabled": "on",
|
|
226
|
+
"proto": "udp",
|
|
227
|
+
"access": "home",
|
|
228
|
+
"cert_exist": true,
|
|
229
|
+
"mask": "255.255.255.0",
|
|
230
|
+
"port": "1194",
|
|
231
|
+
"serverip": "10.8.0.0"
|
|
232
|
+
}
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
class TPLinkRouterTest(TplinkC1200Router):
|
|
236
|
+
def request(
|
|
237
|
+
self,
|
|
238
|
+
path: str,
|
|
239
|
+
data: str,
|
|
240
|
+
ignore_response: bool = False,
|
|
241
|
+
ignore_errors: bool = False,
|
|
242
|
+
) -> dict | None:
|
|
243
|
+
if path == "/admin/openvpn?form=config&operation=read":
|
|
244
|
+
return loads(response_openvpn_read)
|
|
245
|
+
self.captured_path = path
|
|
246
|
+
|
|
247
|
+
client = TPLinkRouterTest("", "")
|
|
248
|
+
client.set_vpn(VPN.OPEN_VPN, True)
|
|
249
|
+
|
|
250
|
+
expected_path = (
|
|
251
|
+
"/admin/openvpn?form=config&operation=write&enabled=on"
|
|
252
|
+
"&proto=udp&access=home&cert_exist=True"
|
|
253
|
+
"&mask=255.255.255.0&port=1194&serverip=10.8.0.0"
|
|
254
|
+
)
|
|
255
|
+
self.assertEqual(client.captured_path, expected_path)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
if __name__ == "__main__":
|
|
259
|
+
main()
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
from re import search
|
|
2
2
|
from requests import post, Response
|
|
3
|
+
from urllib.parse import urlencode
|
|
3
4
|
from tplinkrouterc6u.common.encryption import EncryptionWrapper
|
|
4
5
|
from tplinkrouterc6u.common.exception import ClientException, AuthorizeError
|
|
5
6
|
from tplinkrouterc6u.client.c5400x import TplinkC5400XRouter
|
|
7
|
+
from tplinkrouterc6u.common.dataclass import VPNStatus
|
|
8
|
+
from tplinkrouterc6u.common.package_enum import VPN
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class TplinkC1200Router(TplinkC5400XRouter):
|
|
@@ -100,3 +103,36 @@ class TplinkC1200Router(TplinkC5400XRouter):
|
|
|
100
103
|
@staticmethod
|
|
101
104
|
def _get_login_data(crypted_pwd: str) -> str:
|
|
102
105
|
return 'operation=login&password={}'.format(crypted_pwd)
|
|
106
|
+
|
|
107
|
+
def get_vpn_status(self) -> VPNStatus:
|
|
108
|
+
status = VPNStatus()
|
|
109
|
+
|
|
110
|
+
values = [
|
|
111
|
+
self.request("/admin/openvpn?form=config&operation=read", "operation=read"),
|
|
112
|
+
self.request("/admin/pptpd?form=config&operation=read", "operation=read"),
|
|
113
|
+
self.request("/admin/vpnconn?form=config&operation=list&vpntype=openvpn",
|
|
114
|
+
"operation=list&operation=list&vpntype=openvpn"),
|
|
115
|
+
self.request("/admin/vpnconn?form=config&operation=list&vpntype=pptp",
|
|
116
|
+
"operation=list&operation=list&vpntype=pptp"),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
status.openvpn_enable = values[0]['enabled'] == 'on'
|
|
120
|
+
status.pptpvpn_enable = values[1]['enabled'] == 'on'
|
|
121
|
+
|
|
122
|
+
if isinstance(values[2], list):
|
|
123
|
+
status.openvpn_clients_total = len(values[2])
|
|
124
|
+
status.pptpvpn_clients_total = len(values[3])
|
|
125
|
+
else:
|
|
126
|
+
status.openvpn_clients_total = 0
|
|
127
|
+
status.pptpvpn_clients_total = 0
|
|
128
|
+
|
|
129
|
+
return status
|
|
130
|
+
|
|
131
|
+
def set_vpn(self, vpn: VPN, enable: bool) -> None:
|
|
132
|
+
path = "/admin/{}?form=config&operation=read".format(vpn.lowercase)
|
|
133
|
+
current_config = self.request(path, "operation=read")
|
|
134
|
+
current_config['enabled'] = "on" if enable else "off"
|
|
135
|
+
data = urlencode(current_config)
|
|
136
|
+
data = "&operation=write&{}".format(data)
|
|
137
|
+
path = "/admin/{}?form=config{}".format(vpn.lowercase, data)
|
|
138
|
+
self.request(path, data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.4.0
|
|
4
4
|
Summary: TP-Link Router API
|
|
5
5
|
Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
|
|
6
6
|
Author: Alex Erohin
|
|
@@ -303,7 +303,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
303
303
|
- Archer C7 (v4.0, v5.0)
|
|
304
304
|
- Archer C5400X V1
|
|
305
305
|
- Archer GX90 v1.0
|
|
306
|
-
- Archer MR200 (v5, v5.3)
|
|
306
|
+
- Archer MR200 (v5, v5.3, v6.0)
|
|
307
307
|
- Archer MR550 v1
|
|
308
308
|
- Archer MR600 (v1, v2, v3)
|
|
309
309
|
- Archer VR600 v3
|
|
@@ -328,6 +328,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
328
328
|
- TL-MR6500v
|
|
329
329
|
- TL-XDR3010 V2
|
|
330
330
|
- TL-WA3001 v1.0
|
|
331
|
+
- NX510v v1.0
|
|
331
332
|
|
|
332
333
|
### Not fully tested Hardware Versions
|
|
333
334
|
- AD7200 V2
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
from unittest import main, TestCase
|
|
2
|
-
from json import loads
|
|
3
|
-
from tplinkrouterc6u import (
|
|
4
|
-
TplinkC1200Router,
|
|
5
|
-
Connection,
|
|
6
|
-
ClientException
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class TestTPLinkC1200Client(TestCase):
|
|
11
|
-
|
|
12
|
-
def test_set_led_on(self) -> None:
|
|
13
|
-
|
|
14
|
-
response_led_general_read = '''
|
|
15
|
-
{
|
|
16
|
-
"enable": "off",
|
|
17
|
-
"time_set": "yes",
|
|
18
|
-
"ledpm_support": "yes"
|
|
19
|
-
}
|
|
20
|
-
'''
|
|
21
|
-
|
|
22
|
-
response_led_general_write = '''
|
|
23
|
-
{
|
|
24
|
-
"enable": "on",
|
|
25
|
-
"time_set": "yes",
|
|
26
|
-
"ledpm_support": "yes"
|
|
27
|
-
}
|
|
28
|
-
'''
|
|
29
|
-
|
|
30
|
-
class TPLinkRouterTest(TplinkC1200Router):
|
|
31
|
-
def request(self, path: str, data: str,
|
|
32
|
-
ignore_response: bool = False, ignore_errors: bool = False) -> dict | None:
|
|
33
|
-
if path == 'admin/ledgeneral?form=setting&operation=read':
|
|
34
|
-
return loads(response_led_general_read)
|
|
35
|
-
if path == 'admin/ledgeneral?form=setting&operation=write':
|
|
36
|
-
self.captured_path = path
|
|
37
|
-
return loads(response_led_general_write)
|
|
38
|
-
raise ClientException()
|
|
39
|
-
|
|
40
|
-
client = TPLinkRouterTest('', '')
|
|
41
|
-
|
|
42
|
-
client.set_led(True)
|
|
43
|
-
|
|
44
|
-
expected_path = "admin/ledgeneral?form=setting&operation=write"
|
|
45
|
-
|
|
46
|
-
self.assertEqual(client.captured_path, expected_path)
|
|
47
|
-
|
|
48
|
-
def test_set_led_off(self) -> None:
|
|
49
|
-
|
|
50
|
-
response_led_general_read = '''
|
|
51
|
-
{
|
|
52
|
-
"enable": "on",
|
|
53
|
-
"time_set": "yes",
|
|
54
|
-
"ledpm_support": "yes"
|
|
55
|
-
}
|
|
56
|
-
'''
|
|
57
|
-
|
|
58
|
-
response_led_general_write = '''
|
|
59
|
-
{
|
|
60
|
-
"enable": "off",
|
|
61
|
-
"time_set": "yes",
|
|
62
|
-
"ledpm_support": "yes"
|
|
63
|
-
}
|
|
64
|
-
'''
|
|
65
|
-
|
|
66
|
-
class TPLinkRouterTest(TplinkC1200Router):
|
|
67
|
-
def request(self, path: str, data: str,
|
|
68
|
-
ignore_response: bool = False, ignore_errors: bool = False) -> dict | None:
|
|
69
|
-
if path == 'admin/ledgeneral?form=setting&operation=read':
|
|
70
|
-
return loads(response_led_general_read)
|
|
71
|
-
elif path == 'admin/ledgeneral?form=setting&operation=write':
|
|
72
|
-
self.captured_path = path
|
|
73
|
-
return loads(response_led_general_write)
|
|
74
|
-
raise ClientException()
|
|
75
|
-
|
|
76
|
-
client = TPLinkRouterTest('', '')
|
|
77
|
-
|
|
78
|
-
client.set_led(False)
|
|
79
|
-
|
|
80
|
-
expected_path = "admin/ledgeneral?form=setting&operation=write"
|
|
81
|
-
|
|
82
|
-
self.assertEqual(client.captured_path, expected_path)
|
|
83
|
-
|
|
84
|
-
def test_led_status(self) -> None:
|
|
85
|
-
|
|
86
|
-
response_led_general_read = '''
|
|
87
|
-
{
|
|
88
|
-
"enable": "on",
|
|
89
|
-
"time_set": "yes",
|
|
90
|
-
"ledpm_support": "yes"
|
|
91
|
-
}
|
|
92
|
-
'''
|
|
93
|
-
|
|
94
|
-
class TPLinkRouterTest(TplinkC1200Router):
|
|
95
|
-
def request(self, path: str, data: str,
|
|
96
|
-
ignore_response: bool = False, ignore_errors: bool = False) -> dict | None:
|
|
97
|
-
if path == 'admin/ledgeneral?form=setting&operation=read':
|
|
98
|
-
return loads(response_led_general_read)
|
|
99
|
-
raise ClientException()
|
|
100
|
-
|
|
101
|
-
client = TPLinkRouterTest('', '')
|
|
102
|
-
|
|
103
|
-
led_status = client.get_led()
|
|
104
|
-
self.assertTrue(led_status)
|
|
105
|
-
|
|
106
|
-
def test_set_wifi(self) -> None:
|
|
107
|
-
|
|
108
|
-
class TPLinkRouterTest(TplinkC1200Router):
|
|
109
|
-
def request(self, path: str, data: str,
|
|
110
|
-
ignore_response: bool = False, ignore_errors: bool = False) -> dict | None:
|
|
111
|
-
|
|
112
|
-
self.captured_path = path
|
|
113
|
-
self.captured_data = data
|
|
114
|
-
|
|
115
|
-
client = TPLinkRouterTest('', '')
|
|
116
|
-
client.set_wifi(
|
|
117
|
-
Connection.HOST_5G,
|
|
118
|
-
enable=True,
|
|
119
|
-
ssid="TestSSID",
|
|
120
|
-
hidden="no",
|
|
121
|
-
encryption="WPA3-PSK",
|
|
122
|
-
psk_version="2",
|
|
123
|
-
psk_cipher="AES",
|
|
124
|
-
psk_key="testkey123",
|
|
125
|
-
hwmode="11ac",
|
|
126
|
-
htmode="VHT20",
|
|
127
|
-
channel=36,
|
|
128
|
-
txpower="20",
|
|
129
|
-
disabled_all="no"
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
expected_data = ("operation=write&enable=on&ssid=TestSSID&hidden=no&encryption=WPA3-PSK&"
|
|
133
|
-
"psk_version=2&psk_cipher=AES&psk_key=testkey123&hwmode=11ac&"
|
|
134
|
-
"htmode=VHT20&channel=36&txpower=20&disabled_all=no")
|
|
135
|
-
expected_path = f"admin/wireless?form=wireless_5g&{expected_data}"
|
|
136
|
-
|
|
137
|
-
self.assertEqual(client.captured_path, expected_path)
|
|
138
|
-
self.assertEqual(client.captured_data, expected_data)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if __name__ == '__main__':
|
|
142
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tplinkrouterc6u-5.3.0 → tplinkrouterc6u-5.4.0}/tplinkrouterc6u.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|