Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

TP-Link Router API (EU version) for NodeJs to control the router directly.

NotificationsYou must be signed in to change notification settings

hertzg/node-tplink-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tested on the following units should work on others as well

  • ✔️TL-MR6400
  • ✔️Archer VR900v (#2)
  • Archer MR600 (#5)
  • ✔️TL-MR6500v (#7)

If this works on your device but is not listed here please create an issue or a pr updating the list

Example

$ npm i tl-api# or$ yarn add tl-api
import{ACT,authenticate,execute}from"tl-api";constbaseUrl="http://192.168.1.1";const{ info, ...context}=awaitauthenticate(baseUrl,{password:"admin",});console.log("info: %j",info);console.log("sess: %j",context.sessionId);console.log("tokn: %j",context.tokenId);constresult=awaitexecute(baseUrl,[[ACT.GL,"LAN_WLAN",["name","Standard","SSID","BSSID","X_TP_Band","PossibleChannels","AutoChannelEnable","Channel","X_TP_Bandwidth","Enable","BasicEncryptionModes","BeaconType",],],],context);console.dir(result,{depth:4});

Usage

Once authenticated you will need to use theexecute function and pass it an array of actions.

Actions

Actions is an array of operations you want to perform. Each operation is defined as an array in the following format

You can login into your router and hook into data encrypt and decrypt methods with the following snippet.

$.Iencryptor.AESDecrypt_backup=$.Iencryptor.AESDecrypt;$.Iencryptor.AESEncrypt_backup=$.Iencryptor.AESEncrypt;$.Iencryptor.AESDecrypt=function(data){letdecrypted=$.Iencryptor.AESDecrypt_backup(data);console.log("RECV:\n"+decrypted);returndecrypted;}$.Iencryptor.AESEncrypt=function(data){console.log("SEND:\n"+data);return$.Iencryptor.AESEncrypt_backup(data);}

This will logRECV: &SEND: message before encrypting and decrypting payload, and you can take a note of<actionType>,<actionOperationId>,<actionAttributesOrFields>,<stack>,<pStack> values after you perform specific actions in the UI.

You can see some values described in this document in the Example section and also inexample.js.

Format:

[  [<actionType>, <actionOperationId>, <actionAttributesOrFields>, <stack>, <pStack>],]
FieldRequiredDefaultTypeDescriptionExample
<actionType>Yes-numberAction type, can be any ofACT.*ACT.GET
<actionOperationId>Yes-stringString representing the operation"LTE_BANDINFO"
<actionAttributesOrFields>No[]string[] orRecord<string, any>Optional list or a key value map of attributes. Writes usually need a map and reads, specifically reading lists requires fields as array. Not all operations require attributes, for such cases you can skip or use an empty array[] or object{}.{pageNumber: 12} or['index', 'from', 'content', 'unread']
<stack>No"0,0,0,0,0,0"stringNot really sure what this does but some<actionOperationId>s require specific "stacks". If ommited the default all zeros are used."2,1,0,0,0,0"
<pStack>No"0,0,0,0,0,0"stringNot sure if this is used by the device at all, almost always this stays as default all zeros."0,0,0,0,0,0"

Examples:

constgetLteBandInfo=[[ACT.GET,"LTE_BANDINFO"]];constgetTotalUnreadSmsMessages=[[ACT.GET,"LTE_SMS_UNREADMSGBOX",["totalNumber"]],];constgetUnreadSmsMessageBoxPage=[[ACT.SET,"LTE_SMS_UNREADMSGBOX",{pageNumber:1}],[ACT.GS,"LTE_SMS_UNREADMSGENTRY",["index","from","content","receivedTime","unread"],],];constperformLogout=[[ACT.CGI,"cgi/logout"]];

Response

{error:0,// error code or 0 if successactions:[// actions array is in the same order as the actions to be performed{req:[1,"LTE_BANDINFO"],// original actions that got executedres:{// resulting object or an array if the request was ACT.GS or ACT.GLstack:"0,0,0,0,0,0",attributes:{// Attributes related to this particular requestLTE_RadioInterface:"8",LTE_ActiveBand:"122",LTE_ActiveChannel:"1699",},},},],}

[8]ページ先頭

©2009-2025 Movatter.jp