Community discussions

MikroTik App
 
centralpawisp
just joined
Topic Author
Posts: 1
Joined: Sat Mar 12, 2022 7:59 pm

Scripting with MAC Address/Serial Number Variables

Sat Mar 12, 2022 8:03 pm

Hello all,
I'm hoping it is possible to automatically populate some information into SSID's and security passphrases using a script or text in an RSC config file. We typically use the last 6 digits of the ETH5 MAC address in the SSID, and then the last 6 digits of the serial number in the security passphrase. We will be deploying 100's of devices so is there an easy way to script this into an rsc config file or a script to get these variables into the routerboard that does not involve manual input?

Thanks!
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Scripting with MAC Address/Serial Number Variables

Mon Mar 14, 2022 3:38 pm

This should do:
{
/interface ethernet
:local mac5 [get [find name=ether5] orig-mac-address]
:local serial [/system routerboard get serial-number]
:local SSID ("ssid_".[:pic $mac5 9 11].[:pic $mac5 12 14].[:pic $mac5 15 17])
:local Pass [:pic $serial 6 12]
:put "SSID=$SSID"
:put "Password=$Pass"
}
SSID=ssid_883442
Password=E0A160
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Scripting with MAC Address/Serial Number Variables

Sat Mar 19, 2022 2:19 pm

...We typically use the last 6 digits of the ETH5 MAC address in the SSID, and then the last 6 digits of the serial number in the security passphrase...
You have done the worst request ever: reveal how security passphrases are generated...
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3292
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Scripting with MAC Address/Serial Number Variables

Sat Mar 19, 2022 9:10 pm

ohh, this was the heavily guarded secret that all ISP uses ;)
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Scripting with MAC Address/Serial Number Variables

Sat Mar 19, 2022 11:39 pm

8)

I use 4 call to my random number generator :lol:
viewtopic.php?f=9&t=175453&p=858629

Who is online

Users browsing this forum: No registered users and 15 guests