tplinkrouterc6u 5.2.1__tar.gz → 5.3.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.2.1 → tplinkrouterc6u-5.3.0}/PKG-INFO +2 -1
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/README.md +1 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/setup.py +1 -1
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_ex.py +61 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/c5400x.py +1 -1
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/ex.py +39 -2
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/mr.py +3 -3
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u.egg-info/PKG-INFO +2 -1
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/LICENSE +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/setup.cfg +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/__init__.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_c1200.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_c6u.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_deco.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_mr.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/test/test_client_xdr.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/__init__.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/__init__.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/c1200.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/c6u.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/c6v4.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/deco.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client/xdr.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/client_abstract.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/__init__.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/dataclass.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/encryption.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/exception.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/helper.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/common/package_enum.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u/provider.py +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u.egg-info/SOURCES.txt +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u.egg-info/dependency_links.txt +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u.egg-info/requires.txt +0 -0
- {tplinkrouterc6u-5.2.1 → tplinkrouterc6u-5.3.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.3.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
|
|
@@ -304,6 +304,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
304
304
|
- Archer C5400X V1
|
|
305
305
|
- Archer GX90 v1.0
|
|
306
306
|
- Archer MR200 (v5, v5.3)
|
|
307
|
+
- Archer MR550 v1
|
|
307
308
|
- Archer MR600 (v1, v2, v3)
|
|
308
309
|
- Archer VR600 v3
|
|
309
310
|
- Archer VR900v
|
|
@@ -11,6 +11,8 @@ from tplinkrouterc6u import (
|
|
|
11
11
|
IPv4DHCPLease,
|
|
12
12
|
IPv4Status,
|
|
13
13
|
ClientException,
|
|
14
|
+
VPNStatus,
|
|
15
|
+
VPN,
|
|
14
16
|
)
|
|
15
17
|
|
|
16
18
|
|
|
@@ -334,6 +336,65 @@ class TestTPLinkEXClient(TestCase):
|
|
|
334
336
|
self.assertEqual(check_data, '{"data":{"stack":"1,0,0,0,0,0","pstack":"0,0,0,0,0,0",'
|
|
335
337
|
'"primaryEnable":"1"},"operation":"so","oid":"DEV2_ADT_WIFI_COMMON"}')
|
|
336
338
|
|
|
339
|
+
def test_get_vpn_status(self) -> None:
|
|
340
|
+
DEV2_OPENVPN = ('{"data":{"enable":"1","stack":"0,0,0,0,0,0"},'
|
|
341
|
+
'"operation":"go","oid":"DEV2_OPENVPN","success":true}')
|
|
342
|
+
DEV2_PPTPVPN = ('{"data":{"enable":"0","stack":"0,0,0,0,0,0"},'
|
|
343
|
+
'"operation":"go","oid":"DEV2_PPTPVPN","success":true}')
|
|
344
|
+
DEV2_OVPN_CLIENT = ('{"data":[{"connAct":"1","stack":"1,0,0,0,0,0"}, {"connAct":"1","stack":"2,0,0,0,0,0"},'
|
|
345
|
+
'{"connAct":"0","stack":"3,0,0,0,0,0"}, {"connAct":"0","stack":"4,0,0,0,0,0"},'
|
|
346
|
+
'{"connAct":"0","stack":"5,0,0,0,0,0"}, {"connAct":"0","stack":"6,0,0,0,0,0"},'
|
|
347
|
+
'{"connAct":"0","stack":"7,0,0,0,0,0"}, {"connAct":"0","stack":"8,0,0,0,0,0"},'
|
|
348
|
+
'{"connAct":"0","stack":"9,0,0,0,0,0"}, {"connAct":"0","stack":"10,0,0,0,0,0"}],'
|
|
349
|
+
'"operation":"gl","oid":"DEV2_OVPN_CLIENT","success":true}')
|
|
350
|
+
DEV2_PVPN_CLIENT = ('{"data":[{"connAct":"0","stack":"1,0,0,0,0,0"}, {"connAct":"0","stack":"2,0,0,0,0,0"},'
|
|
351
|
+
'{"connAct":"1","stack":"3,0,0,0,0,0"}, {"connAct":"0","stack":"4,0,0,0,0,0"},'
|
|
352
|
+
'{"connAct":"0","stack":"5,0,0,0,0,0"}, {"connAct":"0","stack":"6,0,0,0,0,0"},'
|
|
353
|
+
'{"connAct":"0","stack":"7,0,0,0,0,0"}, {"connAct":"0","stack":"8,0,0,0,0,0"},'
|
|
354
|
+
'{"connAct":"0","stack":"9,0,0,0,0,0"}, {"connAct":"0","stack":"10,0,0,0,0,0"}],'
|
|
355
|
+
'"operation":"gl","oid":"DEV2_PVPN_CLIENT","success":true}')
|
|
356
|
+
|
|
357
|
+
class TPLinkEXClientTest(TPLinkEXClient):
|
|
358
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
359
|
+
if 'DEV2_OPENVPN' in data_str:
|
|
360
|
+
return 200, DEV2_OPENVPN
|
|
361
|
+
elif 'DEV2_PPTPVPN' in data_str:
|
|
362
|
+
return 200, DEV2_PPTPVPN
|
|
363
|
+
elif 'DEV2_OVPN_CLIENT' in data_str:
|
|
364
|
+
return 200, DEV2_OVPN_CLIENT
|
|
365
|
+
elif 'DEV2_PVPN_CLIENT' in data_str:
|
|
366
|
+
return 200, DEV2_PVPN_CLIENT
|
|
367
|
+
raise ClientException()
|
|
368
|
+
|
|
369
|
+
client = TPLinkEXClientTest('', '')
|
|
370
|
+
status = client.get_vpn_status()
|
|
371
|
+
|
|
372
|
+
self.assertIsInstance(status, VPNStatus)
|
|
373
|
+
self.assertEqual(status.openvpn_enable, True)
|
|
374
|
+
self.assertEqual(status.pptpvpn_enable, False)
|
|
375
|
+
self.assertEqual(status.openvpn_clients_total, 2)
|
|
376
|
+
self.assertEqual(status.pptpvpn_clients_total, 1)
|
|
377
|
+
|
|
378
|
+
def test_set_vpn(self) -> None:
|
|
379
|
+
response = '{"success":true, "errorcode":0}'
|
|
380
|
+
|
|
381
|
+
check_url = ''
|
|
382
|
+
check_data = ''
|
|
383
|
+
|
|
384
|
+
class TPLinkEXClientTest(TPLinkEXClient):
|
|
385
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
386
|
+
nonlocal check_url, check_data
|
|
387
|
+
check_url = url
|
|
388
|
+
check_data = data_str
|
|
389
|
+
return 200, response
|
|
390
|
+
|
|
391
|
+
client = TPLinkEXClientTest('', '')
|
|
392
|
+
client.set_vpn(VPN.OPEN_VPN, True)
|
|
393
|
+
|
|
394
|
+
self.assertIn('http:///cgi_gdpr?9?_=', check_url)
|
|
395
|
+
self.assertEqual(check_data, '{"data":{"stack":"0,0,0,0,0,0","pstack":"0,0,0,0,0,0",'
|
|
396
|
+
'"enable":"1"},"operation":"so","oid":"DEV2_OPENVPN"}')
|
|
397
|
+
|
|
337
398
|
|
|
338
399
|
if __name__ == '__main__':
|
|
339
400
|
main()
|
|
@@ -42,7 +42,7 @@ class TplinkC5400XRouter(TplinkBaseRouter):
|
|
|
42
42
|
if current_state != enable:
|
|
43
43
|
self.request('admin/ledgeneral?form=setting&operation=write', 'operation=write')
|
|
44
44
|
|
|
45
|
-
def get_led(self) -> bool:
|
|
45
|
+
def get_led(self) -> bool | None:
|
|
46
46
|
|
|
47
47
|
data = self.request('admin/ledgeneral?form=setting&operation=read', 'operation=read')
|
|
48
48
|
led_status = data.get('enable') if 'enable' in data else None
|
|
@@ -4,8 +4,15 @@ from datetime import timedelta
|
|
|
4
4
|
from macaddress import EUI48
|
|
5
5
|
from ipaddress import IPv4Address
|
|
6
6
|
from logging import Logger
|
|
7
|
-
from tplinkrouterc6u.common.package_enum import Connection
|
|
8
|
-
from tplinkrouterc6u.common.dataclass import
|
|
7
|
+
from tplinkrouterc6u.common.package_enum import Connection, VPN
|
|
8
|
+
from tplinkrouterc6u.common.dataclass import (
|
|
9
|
+
Firmware,
|
|
10
|
+
Status,
|
|
11
|
+
Device,
|
|
12
|
+
IPv4Reservation,
|
|
13
|
+
IPv4DHCPLease,
|
|
14
|
+
IPv4Status,
|
|
15
|
+
VPNStatus)
|
|
9
16
|
from tplinkrouterc6u.common.exception import ClientException, ClientError
|
|
10
17
|
from tplinkrouterc6u.client.mr import TPLinkMRClientBase
|
|
11
18
|
|
|
@@ -293,3 +300,33 @@ class TPLinkEXClient(TPLinkMRClientBase):
|
|
|
293
300
|
if self._logger:
|
|
294
301
|
self._logger.debug(error)
|
|
295
302
|
raise ClientException(error)
|
|
303
|
+
|
|
304
|
+
def get_vpn_status(self) -> VPNStatus:
|
|
305
|
+
status = VPNStatus()
|
|
306
|
+
acts = [
|
|
307
|
+
self.ActItem(self.ActItem.GET, 'DEV2_OPENVPN', attrs=['enable']),
|
|
308
|
+
self.ActItem(self.ActItem.GET, 'DEV2_PPTPVPN', attrs=['enable']),
|
|
309
|
+
self.ActItem(self.ActItem.GL, 'DEV2_OVPN_CLIENT', attrs=['connAct']),
|
|
310
|
+
self.ActItem(self.ActItem.GL, 'DEV2_PVPN_CLIENT', attrs=['connAct']),
|
|
311
|
+
]
|
|
312
|
+
_, values = self.req_act(acts)
|
|
313
|
+
|
|
314
|
+
status.openvpn_enable = values[0]['enable'] == '1'
|
|
315
|
+
status.pptpvpn_enable = values[1]['enable'] == '1'
|
|
316
|
+
|
|
317
|
+
for item in values[2]:
|
|
318
|
+
if item['connAct'] == '1':
|
|
319
|
+
status.openvpn_clients_total += 1
|
|
320
|
+
|
|
321
|
+
for item in values[3]:
|
|
322
|
+
if item['connAct'] == '1':
|
|
323
|
+
status.pptpvpn_clients_total += 1
|
|
324
|
+
|
|
325
|
+
return status
|
|
326
|
+
|
|
327
|
+
def set_vpn(self, vpn: VPN, enable: bool) -> None:
|
|
328
|
+
acts = [
|
|
329
|
+
self.ActItem(self.ActItem.SET, "DEV2_" + vpn.value, attrs=[f'"enable":"{int(enable)}"'])
|
|
330
|
+
]
|
|
331
|
+
|
|
332
|
+
self.req_act(acts)
|
|
@@ -599,7 +599,7 @@ class TPLinkMRClient(TPLinkMRClientBase):
|
|
|
599
599
|
messages.append(
|
|
600
600
|
SMS(
|
|
601
601
|
i, item['from'], item['content'], datetime.fromisoformat(item['receivedTime']),
|
|
602
|
-
|
|
602
|
+
item['unread'] == '1'
|
|
603
603
|
)
|
|
604
604
|
)
|
|
605
605
|
i += 1
|
|
@@ -691,8 +691,8 @@ class TPLinkMRClient(TPLinkMRClientBase):
|
|
|
691
691
|
]
|
|
692
692
|
_, values = self.req_act(acts)
|
|
693
693
|
|
|
694
|
-
status.openvpn_enable =
|
|
695
|
-
status.pptpvpn_enable =
|
|
694
|
+
status.openvpn_enable = values['0']['enable'] == '1'
|
|
695
|
+
status.pptpvpn_enable = values['1']['enable'] == '1'
|
|
696
696
|
|
|
697
697
|
for item in values['2']:
|
|
698
698
|
if item['connAct'] == '1':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.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
|
|
@@ -304,6 +304,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
304
304
|
- Archer C5400X V1
|
|
305
305
|
- Archer GX90 v1.0
|
|
306
306
|
- Archer MR200 (v5, v5.3)
|
|
307
|
+
- Archer MR550 v1
|
|
307
308
|
- Archer MR600 (v1, v2, v3)
|
|
308
309
|
- Archer VR600 v3
|
|
309
310
|
- Archer VR900v
|
|
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.2.1 → tplinkrouterc6u-5.3.0}/tplinkrouterc6u.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|