tplinkrouterc6u 5.8.0__tar.gz → 5.9.1__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.8.0 → tplinkrouterc6u-5.9.1}/PKG-INFO +8 -2
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/README.md +7 -1
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/setup.py +1 -1
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_c1200.py +4 -40
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_c6u.py +102 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/c1200.py +0 -36
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/c6u.py +49 -2
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/PKG-INFO +8 -2
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/LICENSE +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/setup.cfg +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/__init__.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_c80.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_deco.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_ex.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_mr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_wdr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/test/test_client_xdr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/__init__.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/__init__.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/c5400x.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/c80.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/deco.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/ex.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/mr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/vr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/wdr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client/xdr.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/client_abstract.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/__init__.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/dataclass.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/encryption.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/exception.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/helper.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/common/package_enum.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u/provider.py +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/SOURCES.txt +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/dependency_links.txt +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/requires.txt +0 -0
- {tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.9.1
|
|
4
4
|
Summary: TP-Link Router API (supports also Mercusys Router)
|
|
5
5
|
Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
|
|
6
6
|
Author: Alex Erohin
|
|
@@ -59,6 +59,7 @@ from tplinkrouterc6u import (
|
|
|
59
59
|
TPLinkXDRClient,
|
|
60
60
|
TPLinkDecoClient,
|
|
61
61
|
TplinkC80Router,
|
|
62
|
+
TplinkWDRRouter,
|
|
62
63
|
Connection
|
|
63
64
|
)
|
|
64
65
|
from logging import Logger
|
|
@@ -307,18 +308,20 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
307
308
|
- Archer AX75 V1
|
|
308
309
|
- Archer AX90 V1.20
|
|
309
310
|
- Archer AXE75 V1
|
|
311
|
+
- Archer AXE5400 v1.0
|
|
310
312
|
- Archer AXE16000
|
|
311
313
|
- Archer AX1800
|
|
312
314
|
- Archer AX3000 V1
|
|
313
315
|
- Archer AX6000 V1
|
|
314
316
|
- Archer AX11000 V1
|
|
317
|
+
- Archer BE400 v1.0
|
|
315
318
|
- Archer BE550 v1.0
|
|
316
319
|
- Archer BE800 v1.0
|
|
317
320
|
- Archer BE805 v1.0
|
|
318
321
|
- Archer BE3600 1.6
|
|
319
322
|
- Archer C1200 (v1.0, v2.0)
|
|
320
323
|
- Archer C2300 (v1.0, v2.0)
|
|
321
|
-
- Archer C6 (v2.0, v3.0, 4.0)
|
|
324
|
+
- Archer C6 (v2.0, v3.0, v3.20, 4.0)
|
|
322
325
|
- Archer C6U v1.0
|
|
323
326
|
- Archer C7 (v4.0, v5.0)
|
|
324
327
|
- Archer C24 (1.0, 2.0)
|
|
@@ -329,11 +332,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
329
332
|
- Archer MR200 (v5, v5.3, v6.0)
|
|
330
333
|
- Archer MR550 v1
|
|
331
334
|
- Archer MR600 (v1, v2, v3)
|
|
335
|
+
- Archer VR400 v3
|
|
332
336
|
- Archer VR600 v3
|
|
333
337
|
- Archer VR900v
|
|
334
338
|
- Archer VR1200v v1
|
|
335
339
|
- Archer VR2100v v1
|
|
336
340
|
- Archer VX1800v v1.0
|
|
341
|
+
- BE11000 2.0
|
|
337
342
|
- Deco M4 2.0
|
|
338
343
|
- Deco M4R 2.0
|
|
339
344
|
- Deco M5 v3
|
|
@@ -359,6 +364,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
359
364
|
- TL-WA3001 v1.0
|
|
360
365
|
- TL-XDR3010 V2
|
|
361
366
|
- TL-WDR3600 V1
|
|
367
|
+
- VX420-G2h v1.1
|
|
362
368
|
- XC220-G3v v2.30
|
|
363
369
|
### <a id="mercusys">MERCUSYS routers</a>
|
|
364
370
|
- MR47BE v1.0
|
|
@@ -27,6 +27,7 @@ from tplinkrouterc6u import (
|
|
|
27
27
|
TPLinkXDRClient,
|
|
28
28
|
TPLinkDecoClient,
|
|
29
29
|
TplinkC80Router,
|
|
30
|
+
TplinkWDRRouter,
|
|
30
31
|
Connection
|
|
31
32
|
)
|
|
32
33
|
from logging import Logger
|
|
@@ -275,18 +276,20 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
275
276
|
- Archer AX75 V1
|
|
276
277
|
- Archer AX90 V1.20
|
|
277
278
|
- Archer AXE75 V1
|
|
279
|
+
- Archer AXE5400 v1.0
|
|
278
280
|
- Archer AXE16000
|
|
279
281
|
- Archer AX1800
|
|
280
282
|
- Archer AX3000 V1
|
|
281
283
|
- Archer AX6000 V1
|
|
282
284
|
- Archer AX11000 V1
|
|
285
|
+
- Archer BE400 v1.0
|
|
283
286
|
- Archer BE550 v1.0
|
|
284
287
|
- Archer BE800 v1.0
|
|
285
288
|
- Archer BE805 v1.0
|
|
286
289
|
- Archer BE3600 1.6
|
|
287
290
|
- Archer C1200 (v1.0, v2.0)
|
|
288
291
|
- Archer C2300 (v1.0, v2.0)
|
|
289
|
-
- Archer C6 (v2.0, v3.0, 4.0)
|
|
292
|
+
- Archer C6 (v2.0, v3.0, v3.20, 4.0)
|
|
290
293
|
- Archer C6U v1.0
|
|
291
294
|
- Archer C7 (v4.0, v5.0)
|
|
292
295
|
- Archer C24 (1.0, 2.0)
|
|
@@ -297,11 +300,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
297
300
|
- Archer MR200 (v5, v5.3, v6.0)
|
|
298
301
|
- Archer MR550 v1
|
|
299
302
|
- Archer MR600 (v1, v2, v3)
|
|
303
|
+
- Archer VR400 v3
|
|
300
304
|
- Archer VR600 v3
|
|
301
305
|
- Archer VR900v
|
|
302
306
|
- Archer VR1200v v1
|
|
303
307
|
- Archer VR2100v v1
|
|
304
308
|
- Archer VX1800v v1.0
|
|
309
|
+
- BE11000 2.0
|
|
305
310
|
- Deco M4 2.0
|
|
306
311
|
- Deco M4R 2.0
|
|
307
312
|
- Deco M5 v3
|
|
@@ -327,6 +332,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
327
332
|
- TL-WA3001 v1.0
|
|
328
333
|
- TL-XDR3010 V2
|
|
329
334
|
- TL-WDR3600 V1
|
|
335
|
+
- VX420-G2h v1.1
|
|
330
336
|
- XC220-G3v v2.30
|
|
331
337
|
### <a id="mercusys">MERCUSYS routers</a>
|
|
332
338
|
- MR47BE v1.0
|
|
@@ -5,7 +5,6 @@ from tplinkrouterc6u import (
|
|
|
5
5
|
Connection,
|
|
6
6
|
ClientException,
|
|
7
7
|
)
|
|
8
|
-
from tplinkrouterc6u.common.package_enum import VPN
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
class TestTPLinkC1200Client(TestCase):
|
|
@@ -201,13 +200,13 @@ class TestTPLinkC1200Client(TestCase):
|
|
|
201
200
|
ignore_response: bool = False,
|
|
202
201
|
ignore_errors: bool = False,
|
|
203
202
|
) -> dict | None:
|
|
204
|
-
if path == "
|
|
203
|
+
if path == "admin/openvpn?form=config&operation=read":
|
|
205
204
|
return loads(response_openvpn_read)
|
|
206
|
-
if path == "
|
|
205
|
+
if path == "admin/pptpd?form=config&operation=read":
|
|
207
206
|
return loads(response_pptp_read)
|
|
208
|
-
if path == "
|
|
207
|
+
if path == "admin/vpnconn?form=config&operation=list&vpntype=openvpn":
|
|
209
208
|
return loads(respone_vpnconn_openvpn)
|
|
210
|
-
if path == "
|
|
209
|
+
if path == "admin/vpnconn?form=config&operation=list&vpntype=pptp":
|
|
211
210
|
return loads(respone_vpnconn_pptpvpn)
|
|
212
211
|
raise ClientException()
|
|
213
212
|
|
|
@@ -219,41 +218,6 @@ class TestTPLinkC1200Client(TestCase):
|
|
|
219
218
|
self.assertEqual(vpn_status.openvpn_clients_total, 2)
|
|
220
219
|
self.assertEqual(vpn_status.pptpvpn_clients_total, 3)
|
|
221
220
|
|
|
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
221
|
|
|
258
222
|
if __name__ == "__main__":
|
|
259
223
|
main()
|
|
@@ -9,6 +9,7 @@ from tplinkrouterc6u import (
|
|
|
9
9
|
IPv4Status,
|
|
10
10
|
Device,
|
|
11
11
|
ClientException,
|
|
12
|
+
VPN,
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
|
|
@@ -768,6 +769,107 @@ class TestTPLinkClient(TestCase):
|
|
|
768
769
|
self.assertEqual(result.wan_ipv4_gateway, '0.0.0.0')
|
|
769
770
|
self.assertEqual(result.lan_macaddr, '06-E6-97-9E-23-F5')
|
|
770
771
|
|
|
772
|
+
def test_vpn_status(self) -> None:
|
|
773
|
+
response_openvpn_read = """
|
|
774
|
+
{
|
|
775
|
+
"enabled": "on",
|
|
776
|
+
"proto": "udp",
|
|
777
|
+
"access": "home",
|
|
778
|
+
"cert_exist": true,
|
|
779
|
+
"mask": "255.255.255.0",
|
|
780
|
+
"port": "1194",
|
|
781
|
+
"serverip": "10.8.0.0"
|
|
782
|
+
}
|
|
783
|
+
"""
|
|
784
|
+
|
|
785
|
+
response_pptp_read = """
|
|
786
|
+
{
|
|
787
|
+
"enabled": "off",
|
|
788
|
+
"unencrypted_access": "on",
|
|
789
|
+
"samba_access": "on",
|
|
790
|
+
"netbios_pass": "on",
|
|
791
|
+
"remoteip": "10.0.0.11-20"
|
|
792
|
+
}
|
|
793
|
+
"""
|
|
794
|
+
|
|
795
|
+
respone_vpnconn_openvpn = """[
|
|
796
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
797
|
+
"extra": "7450", "vpntype": "openvpn", "key": "7450"},
|
|
798
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
799
|
+
"extra": "7450", "vpntype": "openvpn", "key": "7450"}
|
|
800
|
+
]"""
|
|
801
|
+
|
|
802
|
+
respone_vpnconn_pptpvpn = """[
|
|
803
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
804
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"},
|
|
805
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
806
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"},
|
|
807
|
+
{"username": "admin", "remote_ip": "192.168.0.200", "ipaddr": "10.0.0.11",
|
|
808
|
+
"extra": "7450", "vpntype": "pptp", "key": "7450"}
|
|
809
|
+
]"""
|
|
810
|
+
|
|
811
|
+
class TPLinkRouterTest(TplinkRouter):
|
|
812
|
+
def request(
|
|
813
|
+
self,
|
|
814
|
+
path: str,
|
|
815
|
+
data: str,
|
|
816
|
+
ignore_response: bool = False,
|
|
817
|
+
ignore_errors: bool = False,
|
|
818
|
+
) -> dict | None:
|
|
819
|
+
if path == "admin/openvpn?form=config":
|
|
820
|
+
return loads(response_openvpn_read)
|
|
821
|
+
if path == "admin/pptpd?form=config":
|
|
822
|
+
return loads(response_pptp_read)
|
|
823
|
+
if path == "admin/vpnconn?form=config" and data == "operation=list&vpntype=openvpn":
|
|
824
|
+
return loads(respone_vpnconn_openvpn)
|
|
825
|
+
if path == "admin/vpnconn?form=config" and data == "operation=list&vpntype=pptp":
|
|
826
|
+
return loads(respone_vpnconn_pptpvpn)
|
|
827
|
+
raise ClientException()
|
|
828
|
+
|
|
829
|
+
client = TPLinkRouterTest("", "")
|
|
830
|
+
|
|
831
|
+
vpn_status = client.get_vpn_status()
|
|
832
|
+
self.assertTrue(vpn_status.openvpn_enable)
|
|
833
|
+
self.assertFalse(vpn_status.pptpvpn_enable)
|
|
834
|
+
self.assertEqual(vpn_status.openvpn_clients_total, 2)
|
|
835
|
+
self.assertEqual(vpn_status.pptpvpn_clients_total, 3)
|
|
836
|
+
|
|
837
|
+
def test_set_vpn(self) -> None:
|
|
838
|
+
response_openvpn_read = """
|
|
839
|
+
{
|
|
840
|
+
"enabled": "on",
|
|
841
|
+
"proto": "udp",
|
|
842
|
+
"access": "home",
|
|
843
|
+
"cert_exist": true,
|
|
844
|
+
"mask": "255.255.255.0",
|
|
845
|
+
"port": "1194",
|
|
846
|
+
"serverip": "10.8.0.0"
|
|
847
|
+
}
|
|
848
|
+
"""
|
|
849
|
+
|
|
850
|
+
class TPLinkRouterTest(TplinkRouter):
|
|
851
|
+
def request(
|
|
852
|
+
self,
|
|
853
|
+
path: str,
|
|
854
|
+
data: str,
|
|
855
|
+
ignore_response: bool = False,
|
|
856
|
+
ignore_errors: bool = False,
|
|
857
|
+
) -> dict | None:
|
|
858
|
+
if path == "admin/openvpn?form=config" and data == "operation=read":
|
|
859
|
+
return loads(response_openvpn_read)
|
|
860
|
+
self.captured_path = path
|
|
861
|
+
self.captured_data = data
|
|
862
|
+
|
|
863
|
+
client = TPLinkRouterTest("", "")
|
|
864
|
+
client.set_vpn(VPN.OPEN_VPN, True)
|
|
865
|
+
|
|
866
|
+
expected_data = (
|
|
867
|
+
"operation=write&enabled=on"
|
|
868
|
+
"&proto=udp&access=home&cert_exist=True&mask=255.255.255.0&port=1194&serverip=10.8.0.0"
|
|
869
|
+
)
|
|
870
|
+
self.assertEqual(client.captured_path, 'admin/openvpn?form=config')
|
|
871
|
+
self.assertEqual(client.captured_data, expected_data)
|
|
872
|
+
|
|
771
873
|
|
|
772
874
|
if __name__ == '__main__':
|
|
773
875
|
main()
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
from re import search
|
|
2
2
|
from requests import post, Response
|
|
3
|
-
from urllib.parse import urlencode
|
|
4
3
|
from tplinkrouterc6u.common.encryption import EncryptionWrapper
|
|
5
4
|
from tplinkrouterc6u.common.exception import ClientException, AuthorizeError
|
|
6
5
|
from tplinkrouterc6u.client.c5400x import TplinkC5400XRouter
|
|
7
|
-
from tplinkrouterc6u.common.dataclass import VPNStatus
|
|
8
|
-
from tplinkrouterc6u.common.package_enum import VPN
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
class TplinkC1200Router(TplinkC5400XRouter):
|
|
@@ -103,36 +100,3 @@ class TplinkC1200Router(TplinkC5400XRouter):
|
|
|
103
100
|
@staticmethod
|
|
104
101
|
def _get_login_data(crypted_pwd: str) -> str:
|
|
105
102
|
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,14 +1,23 @@
|
|
|
1
1
|
from hashlib import md5
|
|
2
2
|
from re import search
|
|
3
3
|
from json import loads
|
|
4
|
+
from urllib.parse import urlencode
|
|
4
5
|
from requests import post, Response
|
|
5
6
|
from macaddress import EUI48
|
|
6
7
|
from ipaddress import IPv4Address
|
|
7
8
|
from logging import Logger
|
|
8
9
|
from tplinkrouterc6u.common.helper import get_ip, get_mac
|
|
9
10
|
from tplinkrouterc6u.common.encryption import EncryptionWrapper
|
|
10
|
-
from tplinkrouterc6u.common.package_enum import Connection
|
|
11
|
-
from tplinkrouterc6u.common.dataclass import
|
|
11
|
+
from tplinkrouterc6u.common.package_enum import Connection, VPN
|
|
12
|
+
from tplinkrouterc6u.common.dataclass import (
|
|
13
|
+
Firmware,
|
|
14
|
+
Status,
|
|
15
|
+
Device,
|
|
16
|
+
IPv4Reservation,
|
|
17
|
+
IPv4DHCPLease,
|
|
18
|
+
IPv4Status,
|
|
19
|
+
VPNStatus,
|
|
20
|
+
)
|
|
12
21
|
from tplinkrouterc6u.common.exception import ClientException, ClientError
|
|
13
22
|
from tplinkrouterc6u.client_abstract import AbstractRouter
|
|
14
23
|
from abc import abstractmethod
|
|
@@ -231,6 +240,10 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
|
|
|
231
240
|
self._url_firmware = 'admin/firmware?form=upgrade&operation=read'
|
|
232
241
|
self._url_ipv4_reservations = 'admin/dhcps?form=reservation&operation=load'
|
|
233
242
|
self._url_ipv4_dhcp_leases = 'admin/dhcps?form=client&operation=load'
|
|
243
|
+
self._url_openvpn = 'admin/openvpn?form=config&operation=read'
|
|
244
|
+
self._url_pptpd = 'admin/pptpd?form=config&operation=read'
|
|
245
|
+
self._url_vpnconn_openvpn = 'admin/vpnconn?form=config&operation=list&vpntype=openvpn'
|
|
246
|
+
self._url_vpnconn_pptpd = 'admin/vpnconn?form=config&operation=list&vpntype=pptp'
|
|
234
247
|
referer = '{}/webpages/index.html'.format(self.host)
|
|
235
248
|
self._headers_request = {'Referer': referer}
|
|
236
249
|
self._headers_login = {'Referer': referer, 'Content-Type': 'application/x-www-form-urlencoded'}
|
|
@@ -401,6 +414,36 @@ class TplinkBaseRouter(AbstractRouter, TplinkRequest):
|
|
|
401
414
|
|
|
402
415
|
return dhcp_leases
|
|
403
416
|
|
|
417
|
+
def get_vpn_status(self) -> VPNStatus:
|
|
418
|
+
status = VPNStatus()
|
|
419
|
+
|
|
420
|
+
values = [
|
|
421
|
+
self.request(self._url_openvpn, "operation=read"),
|
|
422
|
+
self.request(self._url_pptpd, "operation=read"),
|
|
423
|
+
self.request(self._url_vpnconn_openvpn, "operation=list&vpntype=openvpn"),
|
|
424
|
+
self.request(self._url_vpnconn_pptpd, "operation=list&vpntype=pptp"),
|
|
425
|
+
]
|
|
426
|
+
|
|
427
|
+
status.openvpn_enable = values[0]['enabled'] == 'on'
|
|
428
|
+
status.pptpvpn_enable = values[1]['enabled'] == 'on'
|
|
429
|
+
|
|
430
|
+
if isinstance(values[2], list):
|
|
431
|
+
status.openvpn_clients_total = len(values[2])
|
|
432
|
+
status.pptpvpn_clients_total = len(values[3])
|
|
433
|
+
else:
|
|
434
|
+
status.openvpn_clients_total = 0
|
|
435
|
+
status.pptpvpn_clients_total = 0
|
|
436
|
+
|
|
437
|
+
return status
|
|
438
|
+
|
|
439
|
+
def set_vpn(self, vpn: VPN, enable: bool) -> None:
|
|
440
|
+
path = self._url_openvpn if VPN.OPEN_VPN == vpn else self._url_pptpd
|
|
441
|
+
current_config = self.request(path, "operation=read")
|
|
442
|
+
current_config['enabled'] = "on" if enable else "off"
|
|
443
|
+
data = urlencode(current_config)
|
|
444
|
+
data = "operation=write&{}".format(data)
|
|
445
|
+
self.request(path, data)
|
|
446
|
+
|
|
404
447
|
@staticmethod
|
|
405
448
|
def _str2bool(v) -> bool | None:
|
|
406
449
|
return str(v).lower() in ("yes", "true", "on") if v is not None else None
|
|
@@ -435,3 +478,7 @@ class TplinkRouter(TplinkEncryption, TplinkBaseRouter):
|
|
|
435
478
|
self._url_firmware = 'admin/firmware?form=upgrade'
|
|
436
479
|
self._url_ipv4_reservations = 'admin/dhcps?form=reservation'
|
|
437
480
|
self._url_ipv4_dhcp_leases = 'admin/dhcps?form=client'
|
|
481
|
+
self._url_openvpn = 'admin/openvpn?form=config'
|
|
482
|
+
self._url_pptpd = 'admin/pptpd?form=config'
|
|
483
|
+
self._url_vpnconn_openvpn = 'admin/vpnconn?form=config'
|
|
484
|
+
self._url_vpnconn_pptpd = 'admin/vpnconn?form=config'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.9.1
|
|
4
4
|
Summary: TP-Link Router API (supports also Mercusys Router)
|
|
5
5
|
Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
|
|
6
6
|
Author: Alex Erohin
|
|
@@ -59,6 +59,7 @@ from tplinkrouterc6u import (
|
|
|
59
59
|
TPLinkXDRClient,
|
|
60
60
|
TPLinkDecoClient,
|
|
61
61
|
TplinkC80Router,
|
|
62
|
+
TplinkWDRRouter,
|
|
62
63
|
Connection
|
|
63
64
|
)
|
|
64
65
|
from logging import Logger
|
|
@@ -307,18 +308,20 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
307
308
|
- Archer AX75 V1
|
|
308
309
|
- Archer AX90 V1.20
|
|
309
310
|
- Archer AXE75 V1
|
|
311
|
+
- Archer AXE5400 v1.0
|
|
310
312
|
- Archer AXE16000
|
|
311
313
|
- Archer AX1800
|
|
312
314
|
- Archer AX3000 V1
|
|
313
315
|
- Archer AX6000 V1
|
|
314
316
|
- Archer AX11000 V1
|
|
317
|
+
- Archer BE400 v1.0
|
|
315
318
|
- Archer BE550 v1.0
|
|
316
319
|
- Archer BE800 v1.0
|
|
317
320
|
- Archer BE805 v1.0
|
|
318
321
|
- Archer BE3600 1.6
|
|
319
322
|
- Archer C1200 (v1.0, v2.0)
|
|
320
323
|
- Archer C2300 (v1.0, v2.0)
|
|
321
|
-
- Archer C6 (v2.0, v3.0, 4.0)
|
|
324
|
+
- Archer C6 (v2.0, v3.0, v3.20, 4.0)
|
|
322
325
|
- Archer C6U v1.0
|
|
323
326
|
- Archer C7 (v4.0, v5.0)
|
|
324
327
|
- Archer C24 (1.0, 2.0)
|
|
@@ -329,11 +332,13 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
329
332
|
- Archer MR200 (v5, v5.3, v6.0)
|
|
330
333
|
- Archer MR550 v1
|
|
331
334
|
- Archer MR600 (v1, v2, v3)
|
|
335
|
+
- Archer VR400 v3
|
|
332
336
|
- Archer VR600 v3
|
|
333
337
|
- Archer VR900v
|
|
334
338
|
- Archer VR1200v v1
|
|
335
339
|
- Archer VR2100v v1
|
|
336
340
|
- Archer VX1800v v1.0
|
|
341
|
+
- BE11000 2.0
|
|
337
342
|
- Deco M4 2.0
|
|
338
343
|
- Deco M4R 2.0
|
|
339
344
|
- Deco M5 v3
|
|
@@ -359,6 +364,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
359
364
|
- TL-WA3001 v1.0
|
|
360
365
|
- TL-XDR3010 V2
|
|
361
366
|
- TL-WDR3600 V1
|
|
367
|
+
- VX420-G2h v1.1
|
|
362
368
|
- XC220-G3v v2.30
|
|
363
369
|
### <a id="mercusys">MERCUSYS routers</a>
|
|
364
370
|
- MR47BE v1.0
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tplinkrouterc6u-5.8.0 → tplinkrouterc6u-5.9.1}/tplinkrouterc6u.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|