
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mikro-client
Advanced tools
Simple library using socket API to connect and control Mikrotik devices in JavaScript or TypeScript. Allows for easy automation of Mikrotik device management and configuration tasks.
This library, written in TypeScript and also compatible with JavaScript, provides a simple connection via TCP sockets to send and receive command-line commands from MikroTik. With this library, you can easily and quickly control and get information from a MikroTik device.
version documentation in:
npm install mikro-client
or
yarn add mikro-client
To use the class, you must first import it into your project:
import { MikroClient } from 'mikro-client'
Then, you can create a new instance of the class by providing the necessary configuration options:
const options = {
host: 'XXX.XXX.XXX.XXX',
port: XXXX,
username: 'xxxxx',
password: 'xxxxx',
timeout: 5000,
}
const mikro = new MikroClient(options)
Once you have an instance of the class, you can use the "talk" method to send MikroTik commands to the device and receive the response:
const response = await mikro
.talk(['/interface/print'])
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
You can also specify the type of response you want to receive using the optional "type" argument:
const response = await mikro
.talk(['/interface/print'], 'object')
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
Here are some examples of MikroTik commands that you can send using the "talk" method:
const response = await mikro
.talk(['/interface/print'])
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
mikro
.talk([
'/ip/firewall/filter/add',
'=chain=forward',
'=protocol=tcp',
'=dst-port=80',
'=action=accept',
])
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
mikro
.talk(['/ip/hotspot/active/print'])
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
mikro
.talk([
'/ip/hotspot/user/add',
'=name=example',
'=password=example',
'=profile=default',
])
.then((response) => {
console.log(response)
})
.catch((error) => {
console.error(error)
})
For more information on the MikroTik commands that you can send using the MikroApi class, we recommend consulting the MikroTik documentation, which is available at the following link:
On this page, you will find a complete list of available MikroTik commands and their respective parameters. You will also find examples of how to use these commands in the MikroTik command line and API.
I hope this helps you get more information on MikroTik commands and how to use them with the MikroApi class. If you have any additional questions, don't hesitate to ask.
Created by jjjjose - 2022
FAQs
Simple library using socket API to connect and control Mikrotik devices in JavaScript or TypeScript. Allows for easy automation of Mikrotik device management and configuration tasks.
The npm package mikro-client receives a total of 57 weekly downloads. As such, mikro-client popularity was classified as not popular.
We found that mikro-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.