Community discussions

MikroTik App

Search found 25 matches

by DenSyo77
Mon Jun 03, 2024 9:26 am
Forum: Useful user articles
Topic: Browser extension for managing routes
Replies: 0
Views: 3890

Browser extension for managing routes

Browser extension for managing routes to external networks when multiple gateways are present. Not everyone will be able to understand why it is needed at all, but it may be useful as an example of working with REST API. Install as unpacked extension and pin to tools panel. Not fully functional in M...
by DenSyo77
Sun Feb 04, 2024 7:34 am
Forum: Scripting
Topic: amazon address list import
Replies: 5
Views: 1704

Re: amazon address list import

Perhaps didn’t quite understand the question, I’ll try to describe options for using address lists. Register and download ASN database from https://lite.ip2location.com/database-download Go to page http://syo.su expand the section "Create subnets from CSV files with network addresses in any for...
by DenSyo77
Sat Feb 03, 2024 4:52 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Thank you very much, Amm0! Very interesting ideas that may be useful to me.
by DenSyo77
Sat Feb 03, 2024 1:25 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Amm0, title of the post has taken on a different meaning, now this is an expanded version of your previous instructions. Block that uses indexes pushes the result to the top of stack, clearing the entire stack - all expressions unused before this step will be lost. Operations & and | can be appl...
by DenSyo77
Fri Feb 02, 2024 2:41 pm
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Indexes can be used in an expression, but the logic is not always clear and there are no advantages over a regular chain, except perhaps to do obfuscation. {".query": ["disabled=true","list=a","list=b","list=c","#|","#|","com...
by DenSyo77
Fri Feb 02, 2024 7:07 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Since already dealt with the query, did it as needed. {".query": ["disabled=false","list=a","list=b","#|","list=c","#|","comment=d","address=d","#|","timeout","#!","dynamic=tr...
by DenSyo77
Fri Feb 02, 2024 6:13 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Yes, works without last and {".query": ["list=a","list=b","#|","list=c","#|","comment=d","address=d","#|"]} {".query": ["list=a","list=b","list=c","#|","#|...
by DenSyo77
Fri Feb 02, 2024 5:53 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

Yes! I'm still testing it, but it's already working: {".query": ["list=a","list=b","#|","list=c","#|","comment=d","address=d","#|","#&"]} equal to: (list=a or list=b or list=c) and (address=d or c...
by DenSyo77
Fri Feb 02, 2024 5:30 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

Re: How using .query stack in REST API?

This query expression: {".query": ["list=a","list=b","#|","list=c","#|","address=d","#&"]} is works, yes, and I using your example for write this. I'm interested in how to construct an expression similar to this: whe...
by DenSyo77
Fri Feb 02, 2024 4:11 am
Forum: Scripting
Topic: How using .query stack in REST API?
Replies: 14
Views: 1859

How using .query stack in REST API?

How to work with query stack in REST API? For example, print address lists with condition: /ip firewall address-list print where (list=a or list=b or list=c) and address=d in REST API like this POST request /rest/ip/firewall/address-list/print {".query": ["list=a","list=b&qu...
by DenSyo77
Tue Jan 30, 2024 1:15 pm
Forum: Scripting
Topic: Script for LTE1 reset in access the LTE access technology is Evolved 3G (LTE)
Replies: 2
Views: 1266

Re: Script for LTE1 reset in access the LTE access technology is Evolved 3G (LTE)

What ever if in the modem properties the network mode is left only LTE? If it doesn’t help, I recommend going to the hardware section - perhaps the guys there will tell you what to do with the modem so that it switches to the desired mode. Also can try cell lock https://wiki.mikrotik.com/wiki/Manual...
by DenSyo77
Tue Jan 30, 2024 11:31 am
Forum: Scripting
Topic: Reading Modbus coils and registers
Replies: 1
Views: 1040

Re: Reading Modbus coils and registers

Forgot about as-value :local modbus ([/iot modbus transceive address=1 function=3 data=00090010 as-value]->"values") When the RS485 device is unavailable, the script will throw error, so make a modbus request with error handling :local modbus :local message :do { :set modbus [/iot modbus t...
by DenSyo77
Tue Jan 23, 2024 4:43 am
Forum: Scripting
Topic: Useful scripts
Replies: 116
Views: 313124

Re: Useful scripts

Method of working with regional ip address databases without using a firewall address list - does not take away the performance of executing rules using lists. :global ipLocation { "1.0.0.0"={24;"US"}; "1.0.1.0"={24;"CN"}; "1.0.2.0"={23;"CN"...
by DenSyo77
Mon Jan 15, 2024 2:42 am
Forum: Scripting
Topic: add succesfully connected rdp to whitelist
Replies: 6
Views: 1679

Re: add succesfully connected rdp to whitelist

Yes, in normal conditions there are always two sessions from one address - tcp and udp. But I wouldn’t rely on this, what if everyone from one RDP server sits on another RDP server and they are happy with it?.. The idea is to ban exactly those who generate many sessions with zero orig-rate. If there...
by DenSyo77
Sun Jan 14, 2024 1:57 pm
Forum: Scripting
Topic: add succesfully connected rdp to whitelist
Replies: 6
Views: 1679

Re: add succesfully connected rdp to whitelist

Sorry, Damago1, shouldn't have gotten carried away with theories. When overcame laziness and looked at what was happening with rdp-connections in real, found an idea, suggest check it and create a script based on it. Replace the dst-address and port with yours and run this script when you are under ...
by DenSyo77
Fri Jan 12, 2024 2:15 pm
Forum: Scripting
Topic: Useful scripts
Replies: 116
Views: 313124

Re: Useful scripts

The function of obtaining an array of subnets between two ip4 addresses. May be useful for organizing addresses database. The order of the transmitted addresses does not matter. And function for obtaining an array of subnets included in a given one (warning, do not call this function with a large pr...
by DenSyo77
Fri Jan 12, 2024 1:58 pm
Forum: Scripting
Topic: add succesfully connected rdp to whitelist
Replies: 6
Views: 1679

Re: add succesfully connected rdp to whitelist

Theoretically, it is possible to try to analyze the ratio of input and forward packets to the RDP port for each address, but there is no certainty that this will give anything. Such a task will greatly load the gateway, so it’s better to think about using a script on Windows, this will guarantee the...
by DenSyo77
Thu Jan 11, 2024 2:03 pm
Forum: General
Topic: KNOT Modbus Meanwell
Replies: 6
Views: 2677

Re: KNOT Modbus Meanwell

ecdc, iot/modbus/transceive address=0x83 function=0x04 values=0,0x50,0,1 - will also work, values=0,0x50,0,1 and data=00500001 is equal
by DenSyo77
Thu Jan 11, 2024 11:46 am
Forum: General
Topic: KNOT Modbus Meanwell
Replies: 6
Views: 2677

Re: KNOT Modbus Meanwell

Thanks, brambo123 ! I'm tired of guessing :D With my device (maybe it makes a difference), if pass (a) as non-zero value, then the function (passed function number + 128) will be called, this is probably the behavior of the device when accessing non-existent registers. Now it became clear to me why ...
by DenSyo77
Thu Jan 11, 2024 9:24 am
Forum: Scripting
Topic: Useful scripts
Replies: 116
Views: 313124

Re: Useful scripts

Function cyrb53a (c) 2023 bryc (github.com/bryc) to calculate 53-bit hash from string https://github.com/bryc/code/blob/master/jshash/experimental/cyrb53.js :local cyrb53a do={ :local h1 (0xdeadbeef ^ [:tonum $2]) :local h2 (0x41c6ce57 ^ [:tonum $2]) :local imul do={ :local ah (([:tonum $1] >> 16) &...
by DenSyo77
Thu Jan 11, 2024 5:30 am
Forum: Scripting
Topic: add succesfully connected rdp to whitelist
Replies: 6
Views: 1679

Re: add succesfully connected rdp to whitelist

You can start writing a script with the following command on the server, executed when the user login the session, replace 3389 with your port number netstat -aon | findstr ESTAB | findstr 3389 >>\\ShareFolder\connections.txt https://www.howtonetworking.com/RemoteAccess/ts19.htm Check if the file is...
by DenSyo77
Wed Jan 10, 2024 2:17 pm
Forum: General
Topic: KNOT Modbus Meanwell
Replies: 6
Views: 2677

Re: KNOT Modbus Meanwell

Try this command
iot/modbus/transceive address=0x83 function=0x04 values=0,0x50,0,1

values=a,b,c,d
a - will be called function with number as sum (function + 128)
b - start register address
c - don't understand yet
d - number of registers
by DenSyo77
Wed Jan 10, 2024 3:21 am
Forum: Scripting
Topic: Function iot modbus read-holding-registers is not processed in on-error
Replies: 0
Views: 1335

Function iot modbus read-holding-registers is not processed in on-error

I don't know if this is a bug or how it should be. When the device is turned on, the script works correctly, displays the state of the registers and a message "finish". :local sensorData :local sensorError :do { :set sensorData [/iot modbus read-holding-registers slave-id=3 num-regs=2 reg-...
by DenSyo77
Tue Jan 09, 2024 2:52 pm
Forum: Scripting
Topic: Collecting telemetry from Bluetooth and RS485 sensors
Replies: 0
Views: 1610

Collecting telemetry from Bluetooth and RS485 sensors

Concept of collecting telemetry from multiple sensors. The script builds a global array of sensor states in the system and an arrays of reading history. Polling rules are currently implemented for Bluetooth Tags MikroTik TG-BT5-OUT and Teltonika Eye Sensor BTSMP1, and for Modbus temperature sensor w...