Socket
Socket
Sign inDemoInstall

tl-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tl-api - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

14

package.json
{
"name": "tl-api",
"version": "0.0.4",
"version": "0.0.5",
"type": "module",

@@ -8,3 +8,3 @@ "description": "TPLink Router API",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node --test"
},

@@ -24,4 +24,10 @@ "files": [

"cgi_gdpr",
"archer",
"tl-archer",
"vr900v",
"mr6400",
"tl-mr6400",
"archer-vr900v",
"tl-archer-vr900v",
"tl-vr900v",
"tplink sms",

@@ -33,7 +39,7 @@ "sms"

"dependencies": {
"undici": "5.10.0"
"undici": "5.22.1"
},
"devDependencies": {
"prettier": "^2.7.1"
"prettier": "2.8.8"
}
}

@@ -62,2 +62,23 @@ # TP-Link Router API (EU GDPR versions)

You can login into your router and hook into data encrypt and decrypt methods with the following snippet.
```javascript
$.Iencryptor.AESDecrypt_backup = $.Iencryptor.AESDecrypt;
$.Iencryptor.AESEncrypt_backup = $.Iencryptor.AESEncrypt;
$.Iencryptor.AESDecrypt = function(data) {
let decrypted = $.Iencryptor.AESDecrypt_backup(data);
console.log("RECV:\n" + decrypted);
return decrypted;
}
$.Iencryptor.AESEncrypt = function(data) {
console.log("SEND:\n" + data);
return $.Iencryptor.AESEncrypt_backup(data);
}
```
This will log `RECV:` & `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 in `example.js`.
#### Format:

@@ -64,0 +85,0 @@

import { fetch } from "./fetch.js";
export const _extractVariables = (js) => {
return js
.split("\n")
.map((line) => line.trim())
.filter((line) => line.length)
.reduce(
(acc, line) => {
switch (true) {
case line.startsWith("var ee="):
acc.exponent = line.slice(8, -2);
break;
case line.startsWith("var nn="):
acc.modulus = line.slice(8, -2);
break;
case line.startsWith("var seq="):
acc.sequence = line.slice(9, -2);
break;
}
return acc;
},
{ exponent: "", modulus: "", sequence: "" }
);
};
export const fetchPublicKey = async (baseUrl) => {

@@ -10,9 +34,10 @@ const res = await fetch(new URL("cgi/getParm", baseUrl).href, {

const js = await res.text();
const [eeLine, nnLine, , seqLine] = js.split("\n").map((s) => s.trim());
const { exponent, modulus, sequence } = _extractVariables(js);
return {
exponent: Buffer.from(eeLine.slice(8, -2), "hex"),
modulus: Buffer.from(nnLine.slice(8, -2), "hex"),
sequence: Number(seqLine.slice(9, -2)),
exponent: Buffer.from(exponent, "hex"),
modulus: Buffer.from(modulus, "hex"),
sequence: Number(sequence),
};
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc