Mikrotik Mass Updater

Mikrotik Mass Updater

 


I converted an old perl backup utility written by Phillip Hutchison that was on the Mikrotik forums to make it a mass update utility for Mikrotik.

There are 2 versions (Link is at bottom)

version1 - "massupdater.pl" that uses only 1 username and password (UN and PW).

Version2 - "mkmassupdate-multi-login.pl" that tries 2 different logins.

 

The reason for the two different versions is that the multi login prints a "check" after it logs into the Mikrotik to verify that its logged in. After some testing i noticed that the "check" would fail if there is something in logging set to "echo" spamming the terminal it jacks with the output. this can be fixed by changing the check from "equals" to "includes" but then it may cause false positives with some scripts. Also the flooding of out put from the logging could still make the check miss.

the "massupdater.pl" version only waits for the login prompt then executes the script.

 

Here is how to use it.

This works on windows or linux if you have perl installed

For windows version I use activeperl found at http://www.activestate.com/activeperl and it includes the modules used so there isn't any additional setup to perl required.

On linux you need to install Net::Telnet after installing perl

 

Open the config file "massupdate.cfg" and change the username and passwords to match yours.

The email and backup directory is unused in these versions but you can put it in there incase it gets put back in.

 

Add the ip addresses for your routers to the "list.txt" file.

 

Add your script to the "script.rsc" file.

If you are unsure about how to write scripts in mikrotik you can just use and export as well and edit what is needed.

The included script file just adds 2 lines to the log of the router to help test that its working. you just need to make sure in "System->logging" that "info" is being logged, preferably to memory.

To build your own script from an existing setting just use the export command

eg: To get a script to update the DNS of all the routers you can open an existing router and open terminal and issue the command /ip dns export

and you will see

[kevin@TestRouter] /ip dns> export

  1. jun/11/2013 00:59:15 by RouterOS 6.0

/ip dns

set allow-remote-requests=yes max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4

 

You can also use the command "export file=dns" and in the files you will see "dns.rsc". it will have the same commands that are exported to terminal but is helpful if your export is lengthy.

 

 

 

Now your ready to run massupdater.pl

massupdater.pl will look like this.


Mikrotik_massupdater_screenshot.png


and the massupdater-muli-login.pl will look something like this.

 


Mikrotik_massupdater_multi_screenshot.png


The above screenshot shows the event of both passwords failing. If the first password succeeds it will move on to the next router.

Download here https://www.dropbox.com/s/4vtd2kz25k3w6on/Mikrotik%20massupdater.zip?dl=0

 
    • Related Articles

    • Using MikroTik LHG as a UE With a Baicells eNodeB

      If you want to use a MikroTik LHG CPE as a UE with your Baicells eNodeB, this blog post explains how.  Also shown is the tricky nature of inserting the SIM Card in the LHG. LEARN MORE
    • Mikrotik Background Scan for Wireless

      Beginning with Mikrotik version 6.35, the availability of Background Scan on the wireless interface.  From the wiki: "The scan command allows you to see available AP's in the frequency range defined in the scan-list. Using the scan command the ...
    • How to Upgrade MikroTik Software

        It is suggested to always keep your RouterOS installation up to date, MikroTik always keeps adding new functionality and improving performance and stability by releasing updates. RouterOS versions are numbered sequentially, when a period is used to ...
    • MikroTik UserManager Automatic Rate Limits

        Usermanager is MikroTik?s version of radius and is a great way to centralize AAA on your network. In addition, it also has facility to allow users to buy credits on your network through hotspot, however, the only limitation it can automatically ...
    • MikroTik RouterOS Default Wireless WPA2 Key

        Here is one that caught me by surprise and several of our customers as well. MikroTik's default configuration for devices with wireless has changed. There is now WPA/WPA2 security on the wireless connection. You will need to enter the serial number ...