Get the App
SLTechnology News&Howtos  ›  Network Security  › 

MikroTik RouterOS automatically changes WIFI password

Shulou Source: shulou.com Published: 2022-06-01 05:34:01 09月20日 Update

Some time ago, I went to a friend's company to see their GuestWIF password according to the company name plus the year, month and day. I thought it was interesting to change it automatically, so as to prevent the WIFI password of the company from being leaked out.

Specific steps:

1: add the script as follows

# months array:local months ("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec") # get Date:local ds [/ system clock get date] # convert name of month to number:local month [: pick $ds 0 3]; local mm ([: find $months $month-1] + 1); if ($mm < 10) do= {: set mm ("0". $mm);} # set $ds to format YYYY-MM-DD:set ds ([: pick $ds 7 11]. $mm. [: pick $ds 4 6]): log info "date format: $ds sss" # so the final password is in the format XXX20161010 / interface wireless security-profilesset 1 wpa2-pre-shared-key= "XXX$ds" # where 1 is the configuration file serial number of guest

2: add scheduled tasks

/ system scheduler add interval=1d name= "update wifi pass" on-event= "/ system script run AutoUpdateGuestPasswd" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api start-date=oct/20/2016 start-time=01:00:00

The most important thing is how to get the formatted date. Nothing else. Scripts are different from normal shell.

Tags: Password company format script nothing task name year month day serial number meaning file method date time friend step office configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei MariaDB macOS MySQL