Community discussions

MikroTik App
 
gbelyakov
just joined
Topic Author
Posts: 3
Joined: Fri Mar 16, 2018 4:10 pm

Script for generation and sending a passwords in SMS

Fri Mar 16, 2018 4:31 pm

Hello, guys!

I have a problem with my script. Can you help me to find mistake? I try to deploy a hotspot with sms-authorization on my RB951Ui-2HnD (RouterOS 6.41.3).
I can receive SMS and i can send SMS. I have chosen this script for generation and sending a passwords in SMS:

:local smsSecret "Internet"
:foreach i in=[/tool sms inbox find] do={
:local smsMessage [/tool sms inbox get $i message];
if ($smsMessage = $smsSecret) do={
#Password generation
:local time [/system clock get time]
:local hour [:pick $time 0 2]
:local min [:pick $time 3 5]
:local sec [:pick $time 6 8]
:local pass [($hour * $min * $sec)]
:if ($pass = 0) do={ :set pass 6524 }
#End password generation

:local smsPhone [/tool sms inbox get $i phone];
:if ([:len $smsPhone]>11) do={
:local login [:pick $smsPhone 1 12]
/tool user-manager user add customer=admin disabled=no username=$login password=$pass shared-users=1 phone=$smsPhone
/tool user-manager user create-and-activate-profile "$login" customer=admin profile=Default
/tool sms inbox remove $i
:local smsAnswer [("Login: ".$login."\nPassword: " . $pass)]
/tool sms send usb1 $smsPhone message=$smsAnswer
}
}
}



Logically, then user sends SMS-secret(Internet) to router he should receive sms with password, but it doesn't work. I added this script on sheduler, it runs
every minute, but user doesn't receive sms.

Thanks!
 
zivtal
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Sun Feb 05, 2017 6:22 pm

Re: Script for generation and sending a passwords in SMS

Thu Mar 22, 2018 2:49 am

your modem support sending and receiving sms via mikrotik?
 
gbelyakov
just joined
Topic Author
Posts: 3
Joined: Fri Mar 16, 2018 4:10 pm

Re: Script for generation and sending a passwords in SMS

Mon Mar 26, 2018 11:36 am

your modem support sending and receiving sms via mikrotik?
Good day! My modem is Huaweu E352. I can receive SMS and i can send SMS via Mikrotik, but this modem is absent here https://wiki.mikrotik.com/wiki/Manual:Peripherals/
 
gbelyakov
just joined
Topic Author
Posts: 3
Joined: Fri Mar 16, 2018 4:10 pm

Re: Script for generation and sending a passwords in SMS

Thu Apr 12, 2018 2:32 pm

your modem support sending and receiving sms via mikrotik?
Good day! My modem is Huaweu E352. I can receive SMS and i can send SMS via Mikrotik, but this modem is absent here https://wiki.mikrotik.com/wiki/Manual:Peripherals/
No idea?
 
wgjhonathan
just joined
Posts: 3
Joined: Sat Jul 21, 2018 12:03 am

Re: Script for generation and sending a passwords in SMS

Thu Jan 24, 2019 2:13 am

Hi gbelyakov ,
did you solve the problem ?
I have an idea for that .
 
Jimmy
Member Candidate
Member Candidate
Posts: 109
Joined: Thu Sep 29, 2011 11:42 pm
Location: Denmark
Contact:

Re: Script for generation and sending a passwords in SMS

Mon Oct 21, 2019 8:34 pm

UP?
 
User avatar
qatar2022
Member Candidate
Member Candidate
Posts: 147
Joined: Mon Aug 24, 2020 11:12 am

Re: Script for generation and sending a passwords in SMS

Wed Nov 10, 2021 8:57 am

up
i need this method

Who is online

Users browsing this forum: Jonty and 20 guests