New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-mikrotik

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-mikrotik - npm Package Compare versions

Comparing version 0.2.2 to 0.3.1

43

mikrotik.js
/**
* Created by Bladerunner on 11/03/16.
*/
var mikrotik = require('mikronode-ng');
var mikrotik = require('mikronode-ng2');

@@ -11,8 +11,18 @@ module.exports = function(RED) {

this.port = n.port;
this.username = n.username;
this.password = n.password;
if ((!this.credentials) || (!this.credentials.secusername)) {
// take care the even non "converted" credentials that
// are still unsafe stored, can be used.
this.credentials = {
secusername: n.username,
secpassword: n.password
}
}
}
RED.nodes.registerType("mikrotik-device", NodeMikrotikDevice);
RED.nodes.registerType("mikrotik-device", NodeMikrotikDevice,{
credentials: {
secusername: { type: "text" },
secpassword: { type: "password" }
}
});
function NodeMikrotik(config) {

@@ -29,3 +39,7 @@ RED.nodes.createNode(this,config);

var password = this.device.password;
if (!!this.device.credentials) {
username= this.device.credentials.secusername;
password = this.device.credentials.secpassword;
}
var command;

@@ -54,14 +68,10 @@

this.on('input', function(msg) {
var cmd = command;
if (command == '') cmd = msg.payload;
if (cmd == '') return false;
if (cmd.command) cmd = cmd.command;
if (command == '') command = msg.payload;
if(command == '') return false;
connection = mikrotik.getConnection(host, username, password, {closeOnDone : true, port: port});
connection.getConnectPromise().then(function(conn) {
conn.getCommandPromise(cmd).then(function resolved(values) {
conn.getCommandPromise(command).then(function resolved(values) {
var parsed = mikrotik.parseItems(values);

@@ -74,7 +84,8 @@ var pl = [];

msg.command = cmd;
msg.command = command;
msg.success = true;
node.send(msg);
}, function rejected(reason) {
node.error('Error executing cmd['+cmd+']: ' + JSON.stringify(reason));
node.error('Error executing cmd['+command+']: ' + JSON.stringify(reason));
});

@@ -81,0 +92,0 @@ },

{
"name": "node-red-contrib-mikrotik",
"version": "0.2.2",
"version": "0.3.1",
"description": "Node based on node-red-contrib-mikrotik to work with Mikrotik devices which fixes device configuration problem",

@@ -14,2 +14,11 @@ "scripts": {

"url": "https://www.freevision.sk"
},
{
"name": "Nikola 0nikola1",
"email": "n@bobetic.com",
"url": "https://github.com/0nikola1"
},
{
"name": "Konrad Mattheis",
"url": "https://github.com/konne"
}

@@ -23,7 +32,8 @@ ],

"keywords": [
"node-red"
"node-red",
"mikrotik"
],
"license": "ISC",
"dependencies": {
"mikronode-ng": "^1.0.5"
"mikronode-ng2": "^1.0.12"
},

@@ -34,8 +44,8 @@ "main": "mikrotik.js",

"type": "git",
"url": "git+https://github.com/alhafoudh/node-red-contrib-mikrotik.git"
"url": "git+https://github.com/node-red-contrib/node-red-contrib-mikrotik.git"
},
"bugs": {
"url": "https://github.com/alhafoudh/node-red-contrib-mikrotik/issues"
"url": "https://github.com/node-red-contrib/node-red-contrib-mikrotik/issues"
},
"homepage": "https://github.com/alhafoudh/node-red-contrib-mikrotik#readme"
"homepage": "https://github.com/node-red-contrib/node-red-contrib-mikrotik#readme"
}

@@ -1,18 +0,42 @@

node-red-contrib-mikrotik
==========================
Node based on node-red-contrib-mikrotik to work with Mikrotik devices which fixes device configuration problem.
[![CLA assistant](https://cla-assistant.io/readme/badge/node-red-contrib/node-red-contrib-mikrotik)](https://cla-assistant.io/node-red-contrib/node-red-contrib-mikrotik)
![compile](https://github.com/node-red-contrib/node-red-contrib-mikrotik/workflows/compile/badge.svg)
[![CodeFactor](https://www.codefactor.io/repository/github/node-red-contrib/node-red-contrib-mikrotik/badge)](https://www.codefactor.io/repository/github/node-red-contrib/node-red-contrib-mikrotik)
[![npm version](https://badge.fury.io/js/node-red-contrib-mikrotik.svg)](https://badge.fury.io/js/node-red-contrib-mikrotik)
# node-red-contrib-mikrotik a mikrotik node for Node-RED
Install
-------
Run command on Node-RED installation directory
## Install
[![NPM](https://nodei.co/npm/node-red-contrib-mikrotik.png?downloads=true)](https://nodei.co/npm/node-red-contrib-mikrotik/)
npm install node-red-contrib-mikrotik
Config
-------
Install via the palette manage in the Node-RED admin ui (no restart needed).
<p>A <a href="http://nodered.org" target="_new">Node-RED</a> node that provides API for Mikrotik WiFi routers.</p>
This is an alfa verion. Available actions: log, resources, wifi, connections, reboot, raw.
Alternatively run the following command in your Node-RED user directory (typically `~/.node-red`):
```sh
npm install node-red-contrib-mikrotik
```
then restart Node-RED and add an instance of the mikrotik node.
# Config
Available actions:
- ***log***
- ***resources***
- ***wifi***
- ***connections***
- ***reboot***
- ***raw***
## Usage
### Basic
TBD
-----
### RAW
For the usage of the RAW mode there are [here](docs/example-flows.md) some examples.

Sorry, the diff of this file is not supported yet

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