Community discussions

MikroTik App

Search found 21 matches

by ovdeathiam
Mon May 22, 2023 12:30 am
Forum: Scripting
Topic: Yet Another DNS from DHCP Script
Replies: 8
Views: 4094

Re: Yet Another DNS from DHCP Script

I really appreciate your pointers. I was able to simplify that lease script and add your dns validation regex and OP's GetDomain function. :local ttl 600s :local GetDomain do={ :local ipaddr [:toip $1] /ip dhcp-server network :foreach network in [find] do={ :local netblock [get value-name=address $n...
by ovdeathiam
Sun May 21, 2023 2:53 pm
Forum: Scripting
Topic: Yet Another DNS from DHCP Script
Replies: 8
Views: 4094

Re: Yet Another DNS from DHCP Script

I see that all the scripts posted here are super complicated and designed to be run on a schedule. Why not just use something simple as a lease script in the dhcp server to have instantaneous changes? https://i.imgur.com/um1orUP.gif :local ttl 600s :local debug 0 :if ($leaseBound = 1) do={ :local Ho...
by ovdeathiam
Fri Aug 11, 2017 10:17 pm
Forum: Scripting
Topic: Netwatch logging and send log daily by email
Replies: 9
Views: 7929

Re: Netwatch logging and send log daily by email

I have something simmilar already configured. Zrzut ekranu z 2017-08-11 21.19.07.png Logs are saved to _GoogleDNS.txt untill it's full then it is renamed to have a timestamp and a new clear file is created. You could change it to what you need. Netwatch settings: Host: 8.8.8.8 Interval: 00:00:02 Tim...
by ovdeathiam
Mon Aug 07, 2017 9:00 am
Forum: Scripting
Topic: Help with arrays for shortening scripts?
Replies: 3
Views: 4594

Re: Help with arrays for shortening scripts?

Arrays are comma separated. Here is an example how you can use them: :local myarray [:toarray value="abc,def,ghi"]; :put $myarray; :put ($myarray->0); :put ($myarray->1); :put ($myarray->2); :foreach element in=$myarray do={ :put $element } :for counter from=0 step=1 to=2 do={ :put ($myarr...
by ovdeathiam
Sun Aug 06, 2017 3:04 pm
Forum: Announcements
Topic: Winbox 3.11 released!
Replies: 94
Views: 368253

Re: Winbox 3.11 released!

I've noticed that Winbox doesn't use UTF-8 for comments, although these work well when using SSH , Telnet or even Tik-App on Android. I use an external API to identify IPs for incoming connections (country, city, company it's registered to) and some of these look unreadable in Winbox. http://i.imgur...
by ovdeathiam
Wed Aug 02, 2017 4:56 pm
Forum: Scripting
Topic: [bug] Address-list address stored as string
Replies: 4
Views: 1247

Re: [bug] Address-list address stored as string

No I don't want to convert ip prefix to ip. I want IPs to be identified as variable type "ip" if they are in address-list just when they are elsewhere.
Right now since a few paches ago both ip prefixes and ips are identified as strings.
by ovdeathiam
Wed Aug 02, 2017 4:02 pm
Forum: Scripting
Topic: [bug] Address-list address stored as string
Replies: 4
Views: 1247

Re: [bug] Address-list address stored as string

I understand that strings are acceptable, but I need to test each entry in the address-list and check if it's an actual ip or not. I used to be able to do this: :foreach address in=[/ip firewall address-list find comment~"^\$"] do={ :if ([:typeof [:toip [/ip firewall address-list get $addr...
by ovdeathiam
Wed Aug 02, 2017 3:56 pm
Forum: Scripting
Topic: [bug] Address-list address stored as string
Replies: 4
Views: 1247

[bug] Address-list address stored as string

I believe I've found a bug in one of the recent versions of ROS as one of my scripts stopped working properly. After some investigation I've found out that addresses in address lists are stored as srings. This variable type used to be ip for ips [127.0.0.1] and str for subnets [127.0.0.1/24]. > :put...
by ovdeathiam
Wed Oct 29, 2014 1:45 pm
Forum: Scripting
Topic: Script dhcp2dns
Replies: 3
Views: 2072

Re: Script dhcp2dns

Is your netmask value set? I forgot that netmask value is optional since we can just set the network address with netmask all in one value (i.e. 192.168.0.0/24). I'll add getting the netmask value from network addr soon and repost the changed code. For now both netmask and domain values are obligato...
by ovdeathiam
Sat Oct 25, 2014 6:26 pm
Forum: Scripting
Topic: Script dhcp2dns
Replies: 3
Views: 2072

Script dhcp2dns

[/code2]Recently I had to configure dns entries for all hostnames in dhcp leases however scripts that I found usually recycle all static dns entries in a period of time, they need to manually set some parameters and dont take the advantage of the dhcp-server lease script feature. I wrote this script...
by ovdeathiam
Sat Oct 25, 2014 12:24 pm
Forum: Scripting
Topic: Syntax Issue (Scheduling)
Replies: 2
Views: 1314

Re: Syntax Issue (Scheduling)

Try
/log info "Starting...";
/interface wireless set wlan1 tx-power=22;
/interface wireless enable wlan1;
/log info "Wireless Enabled";
by ovdeathiam
Fri Aug 01, 2014 5:39 pm
Forum: Scripting
Topic: Hotspot automated pw change weekly based on month and day
Replies: 3
Views: 1741

Re: Hotspot automated pw change weekly based on month and da

Can you try this? :local date [/system clock get date]; :local months {jan="JAN";feb="FEB";mar="MAR";apr="APR";may="MAY";jun="JUN";jul="JUL";aug="AUG";sep="SEP";oct="OCT";nov="NOV";dec="...
by ovdeathiam
Fri Aug 01, 2014 5:12 pm
Forum: Scripting
Topic: script to enable/disable an ip address with an IF
Replies: 2
Views: 2060

Re: script to enable/disable an ip address with an IF

It is not pretty but it works on my test environment: Oneliner style :if ([/ip arp print as-value where address="10.70.3.5"] = "") do={/ip address enable numbers=[/ip address find where address="10.70.1.1/30"]} else={/ip address disable numbers=[/ip address find where a...
by ovdeathiam
Fri Jul 18, 2014 9:51 am
Forum: Scripting
Topic: Getting wireless interface rx signal-strength
Replies: 14
Views: 10851

Re: Getting wireless interface rx signal-strength

You mean like /interface wireless registration-table get value-name=signal-strength?
by ovdeathiam
Thu Jul 17, 2014 12:23 pm
Forum: Scripting
Topic: Netwatch - log to file
Replies: 8
Views: 6423

Re: Netwatch - log to file

Yes, but my other scripts use script,info for their output. I don't want to mix them around.
by ovdeathiam
Wed Jul 16, 2014 3:43 pm
Forum: Scripting
Topic: Netwatch - log to file
Replies: 8
Views: 6423

Re: Netwatch - log to file

Thanks.
by ovdeathiam
Wed Jul 16, 2014 3:12 pm
Forum: Scripting
Topic: Netwatch - log to file
Replies: 8
Views: 6423

Re: Netwatch - log to file

The idea was to have an array with all address information and then point to values in that array. I just wonder if this is possible to use arrays in this way.
by ovdeathiam
Wed Jul 16, 2014 2:24 pm
Forum: Scripting
Topic: Netwatch - log to file
Replies: 8
Views: 6423

Re: Netwatch - log to file

I could've swear jan="01" was not working properly on one old ROS version, but it works now, thanks for that fix. BTW. Can I somehow use the below script to :put only the comment which is from .id=*2? :local test [/ip address print as-value]; :put $test; :put ($test->"comment") O...
by ovdeathiam
Wed Jul 16, 2014 1:34 pm
Forum: Scripting
Topic: DDNS script for no-ip dyndns ipchange
Replies: 14
Views: 14529

Re: DDNS script for no-ip dyndns ipchange

Any chances that there will be a feature implemented to use :local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip keep-file=no;] instead of :local CURRip [/tool fetch url="http://myip.dnsomatic.com/index.html" mode=http dst-path=CURRip; :...
by ovdeathiam
Wed Jul 16, 2014 1:18 pm
Forum: Scripting
Topic: Netwatch - log to file
Replies: 8
Views: 6423

Netwatch - log to file

I've had problem with my local provider a year back and I had to proove that their service is malfunctioning. At first it seemed random but to verify it i used this netwatch script to log each DOWN and UP event to a file. Since the logging date format (jul/16/2014) did not meet my requirements i mad...
by ovdeathiam
Wed Jul 16, 2014 12:13 pm
Forum: Scripting
Topic: DDNS script for no-ip dyndns ipchange
Replies: 14
Views: 14529

DDNS script for no-ip dyndns ipchange

I've seen some ddns scripts around here but usually these were having some compatibility issues on on newer RouterOS. I'd like to share what I use. It works even if you're behind 2nd nat since it relies on an external service to get your ip. DynDNS :local DDNSuser "login" :local DDNSpass &...