0% found this document useful (0 votes)
137 views1 page

Script Add Users Hotspot

The document outlines a system scheduler script that adds users to a hotspot every 3 seconds by reading from a specified text file. It processes user data including name, email, phone, and generates a password before adding the user to the hotspot. Additionally, it logs the user information and manages file content to ensure proper operation.

Uploaded by

Jose Claudio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views1 page

Script Add Users Hotspot

The document outlines a system scheduler script that adds users to a hotspot every 3 seconds by reading from a specified text file. It processes user data including name, email, phone, and generates a password before adding the user to the hotspot. Additionally, it logs the user information and manages file content to ensure proper operation.

Uploaded by

Jose Claudio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/system scheduler

add interval=3s name=ADD_USER_HOTSPOT on-event=":global userToAdd 1\r\


\n:global fileContent [/file get [find name=[Link]] contents
]\r\
\n\r\
\n:while (\$userToAdd != 0) do={\r\
\n\r\
\n:global beginString ([:find \$fileContent \"!==\"] + 3) \r\
\n:if (\$beginString = 3) do={/file set [find name=[Link]]
contents=\"\";:return \"\";} \r\
\n:global endString [:find \$fileContent \"==!\"]\r\
\n:global userToAdd [toarray [:pick \$fileContent \$beginString \$endString]]\
r\
\n:global fileContent [:pick \$fileContent (\$endString + 3) [:len \
$fileContent]]\r\
\n\r\
\n\r\
\n:global name [pick \$userToAdd 0]\r\
\n:global email [pick \$userToAdd 1]\r\
\n:global phone [pick \$userToAdd 2]\r\
\n:global password [pick \$phone ([:len \$phone] - 4) [:len \$phone]]\r\
\n\r\
\n:do {/ip hotspot user add password=\$password name=\$email comment=\"\$name -
\$phone\"} on-error={}\r\
\n\r\
\n:put \"Nome: \$name - Email: \$email - Telefone: \$phone\"\r\
\n/log warning message=\"Nome: \$name - Email: \$email - Telefone: \$phone\"\r\
\n\r\
\n\r\
\n\r\
\n\r\
\n\r\
\n\r\
\ndelay 500ms\r\
\n\r\
\n}\r\
\n\r\
\n\r\
\n\r\
\n\r\
\n" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon

/system logging action


add disk-file-count=1 disk-file-name=users-to-hotspot disk-lines-per-file=50
name=hotspot target=disk
/system logging
add action=hotspot topics=hotspot,info,debug

You might also like