Community discussions

 
eagle1610
just joined
Topic Author
Posts: 1
Joined: Fri Feb 13, 2015 11:48 am

Generating hotspot passwords and sending them via sms

Fri Feb 13, 2015 12:06 pm

Hello to all

I have wireless network in my company where is guest network using Mikrotik hotspot. Now we try to build User friendly password generation
and we thought abaut sms sending passwords to our costumers.
Is there any chance to do it with user manager in mikrotik?


thank you
 
User avatar
samir494
Member Candidate
Member Candidate
Posts: 236
Joined: Thu Aug 06, 2009 11:27 am
Location: India

Re: Generating hotspot passwords and sending them via sms

Thu Feb 26, 2015 1:14 pm

here is the sample of working code

/tool sms set receive-enabled=yes

:local smsPhone
:local smsMessage

delay 2;

:foreach i in=[/tool sms inbox find] do={

#Password generation
:local date [/system clock get time]

:local hour [:pick $date 0 2]
:local min [:pick $date 3 5]
:local sec [:pick $date 6 8]

:local pass 27394

:set pass ($hour * $min * $sec)

:if ($pass = 0) do {
:set pass 6524
}

:log info $pass
:log info $date
#End password generation

:set smsPhone [/tool sms inbox get $i phone];

:log info $smsPhone

#Create voucher
/tool user-manager user remove [/tool user-manager user find username=$smsPhone]

:log info "2"

/tool user-manager user add customer=admin disabled=no name=$smsPhone password=$pass shared-users=1 phone=$smsPhone

:log info "3"

#TODO set profile!!!!
/tool user-manager user create-and-activate-profile user=$smsPhone customer=admin profile=hour

:log info "4"

#End create voucher

:set smsMessage "Login: $smsPhone Password: $pass"

:log info $smsMessage

:if ([:len $smsPhone]>10) do {
/tool sms send usb3 $smsPhone message="$smsMessage"
}

:log info "5"

/tool sms inbox remove $i

:log info "6"

delay 10

}
Mistry Samir
Unique and Different
India
9920670022

Give me more Karma
 
kpc
just joined
Posts: 1
Joined: Tue Mar 31, 2015 10:46 pm

Re: Generating hotspot passwords and sending them via sms

Tue Mar 31, 2015 11:33 pm

hi mr samir
can i have your email address?
my email is amirreza.keshvari@gmail.com.

i have hotspot on my network,i want guest insert mobile number in text box and click submit buttom and system auto send username and password to that mobile number,
please help me
 
User avatar
cardlinux
just joined
Posts: 6
Joined: Sat Sep 27, 2014 7:14 pm

Re: Generating hotspot passwords and sending them via sms

Mon Apr 20, 2015 12:12 am

here is the sample of working code

/tool sms set receive-enabled=yes

:local smsPhone
:local smsMessage

delay 2;

:foreach i in=[/tool sms inbox find] do={

#Password generation
:local date [/system clock get time]

:local hour [:pick $date 0 2]
:local min [:pick $date 3 5]
:local sec [:pick $date 6 8]

:local pass 27394

:set pass ($hour * $min * $sec)

:if ($pass = 0) do {
:set pass 6524
}

:log info $pass
:log info $date
#End password generation

:set smsPhone [/tool sms inbox get $i phone];

:log info $smsPhone

#Create voucher
/tool user-manager user remove [/tool user-manager user find username=$smsPhone]

:log info "2"

/tool user-manager user add customer=admin disabled=no name=$smsPhone password=$pass shared-users=1 phone=$smsPhone

:log info "3"

#TODO set profile!!!!
/tool user-manager user create-and-activate-profile user=$smsPhone customer=admin profile=hour

:log info "4"

#End create voucher

:set smsMessage "Login: $smsPhone Password: $pass"

:log info $smsMessage

:if ([:len $smsPhone]>10) do {
/tool sms send usb3 $smsPhone message="$smsMessage"
}

:log info "5"

/tool sms inbox remove $i

:log info "6"

delay 10

}
Thats ok script. But ruter has SMS option only for one "allowed number". Does have some another option in this script for generate usernames?
 
meateron
just joined
Posts: 2
Joined: Wed Jun 17, 2015 11:28 am

Re: Generating hotspot passwords and sending them via sms

Wed Jun 17, 2015 11:31 am

any ideas how to make:

1. HotSpot welcome page telling you to enter your phone number
2. You enter your phone number, press "submit"
3. You recieve sms and enter a password to a field "access code"?
 
videolab
newbie
Posts: 47
Joined: Mon Feb 25, 2008 12:41 am

Re: Generating hotspot passwords and sending them via sms

Wed Nov 25, 2015 8:36 pm

To save the cost of SMS to the user, you may have corresponding phone number to login and the message text to be chosen as a password.
Auto activation!
 
Nagobi
just joined
Posts: 2
Joined: Tue Dec 01, 2015 6:01 pm
Location: Vladivostok City, Russia
Contact:

Re: Generating hotspot passwords and sending them via sms

Wed Dec 02, 2015 3:59 am

Have a nice day Samir!

I see your script and i think this what i want, can you help me? i want authorization via sms (generated and send voucher via usb modem).

1 - User connect to Hotspot
2 - See login page
3 - Write his number in to login page and press submit button
4 - Receive password via sms and login with him
5 - Phone number write in log to disk with date&time authorization

Sorry for my English, i study now)

my email: nagobi@icloud.com
my Skype: posians
 
rajeshrouthu
newbie
Posts: 40
Joined: Sun Jun 22, 2008 10:30 am

Re: Generating hotspot passwords and sending them via sms

Fri Jan 29, 2016 5:22 pm

Recently We done the SMS Solutions for Mikrotik Hotspot using the radius

1. User Connected to FREE-WIFI AP
2. When he trying to browse automatically redirected to Login Page
3. He Registered himself entering their mobile Number and name
4. He will get OTP for Authorization after success
5. He will Get the SMS of Username and Password with 30 Min Free usage
6. After that he need to refill using Recharge Coupon or Payment Gateway.
You do not have the required permissions to view the files attached to this post.
Regards,
Raj
 
Nagobi
just joined
Posts: 2
Joined: Tue Dec 01, 2015 6:01 pm
Location: Vladivostok City, Russia
Contact:

Re: Generating hotspot passwords and sending them via sms

Fri Jan 29, 2016 7:18 pm

Good news!

How you can do it? sms send via usb stick in mikrotik or another service? captive portal hosting on mikrotik or another place?
 
rajeshrouthu
newbie
Posts: 40
Joined: Sun Jun 22, 2008 10:30 am

Re: Generating hotspot passwords and sending them via sms

Tue Feb 02, 2016 11:40 am

Good news!

How you can do it? sms send via usb stick in mikrotik or another service? captive portal hosting on mikrotik or another place?

Developed using with freeradius Server, captive portal & SMS Every thing work from the same server
Regards,
Raj
 
User avatar
bax
Member Candidate
Member Candidate
Posts: 269
Joined: Mon Dec 20, 2004 8:45 pm
Location: Croatia

Re: Generating hotspot passwords and sending them via sms

Tue Feb 02, 2016 1:39 pm

Good news!

How you can do it? sms send via usb stick in mikrotik or another service? captive portal hosting on mikrotik or another place?

Developed using with freeradius Server, captive portal & SMS Every thing work from the same server
It will be very nice if you make some tutorial ... maybe on wiki :D
 
sopcwmkt
just joined
Posts: 1
Joined: Fri Feb 05, 2016 1:49 pm

Re: Generating hotspot passwords and sending them via sms

Fri Feb 05, 2016 1:52 pm

How do you run the script? by the scheduler?
Thanks.
 
imagica
newbie
Posts: 26
Joined: Sun Sep 09, 2012 10:17 pm

Re: Generating hotspot passwords and sending them via sms

Sun Feb 07, 2016 7:09 am

Yes am also interested in this solution. For SMS sending i want to use SMS gateway api.
 
mosesjohann
just joined
Posts: 5
Joined: Mon May 30, 2016 9:50 am

Re: Generating hotspot passwords and sending them via sms

Mon May 30, 2016 9:54 am

something new on this thing? Would be interested too
 
para2ox
just joined
Posts: 8
Joined: Sat Jun 13, 2009 1:17 pm

Re: Generating hotspot passwords and sending them via sms

Wed Jun 08, 2016 5:14 pm

could you please give me this script ?
i need the users enter their mobile No. and get their generated password through SMS,
i know that the GSM modem is needed.
how can i do that ?
 
eevee147
just joined
Posts: 6
Joined: Fri Sep 16, 2016 3:47 am

Re: Generating hotspot passwords and sending them via sms

Fri Sep 16, 2016 3:53 am

Recently We done the SMS Solutions for Mikrotik Hotspot using the radius

1. User Connected to FREE-WIFI AP
2. When he trying to browse automatically redirected to Login Page
3. He Registered himself entering their mobile Number and name
4. He will get OTP for Authorization after success
5. He will Get the SMS of Username and Password with 30 Min Free usage
6. After that he need to refill using Recharge Coupon or Payment Gateway.
Hello, i´m interested, can you tell me more about it and cost please?.
 
Too001
just joined
Posts: 2
Joined: Sun Oct 09, 2016 7:51 pm

Re: Generating hotspot passwords and sending them via sms

Sun Oct 09, 2016 7:59 pm

Hi,
How can one get the code(cost). Can you also integrate other forms of payment to the system. Thanks
 
User avatar
czolo
Member
Member
Posts: 418
Joined: Fri Mar 04, 2005 9:49 am
Location: Poland (Warsaw)
Contact:

Re: Generating hotspot passwords and sending them via sms

Tue Oct 11, 2016 9:20 pm

We have something similiar. We are sending a link in SMS. User click on the link, and a web browser autheticate him into the system. Of course there is possibility to collect phone numbers and use it for operators data retention.
| --= Czo|_o =--
| http://wifi4eu.pl
| Innovation in WiFi
 
rajeev0047
just joined
Posts: 2
Joined: Mon Nov 28, 2016 8:02 am

Re: Generating hotspot passwords and sending them via sms

Tue Dec 13, 2016 11:47 am

It seems #rajeshrouthu just showing up to us what he did. didn't come for help. I am looking for this solution too. Any guys can help??
 
elitebb
just joined
Posts: 11
Joined: Fri Sep 16, 2016 8:00 pm

Re: Generating hotspot passwords and sending them via sms

Tue Jan 31, 2017 4:53 pm

It seems #rajeshrouthu just showing up to us what he did. didn't come for help. I am looking for this solution too. Any guys can help??
Yes , I think he did great research for what he did or paid someone who know how to do that . You can find some solution on internet or find someone .
 
dante
just joined
Posts: 2
Joined: Mon Feb 13, 2017 5:39 am
Location: Novosibirsk

Re: Generating hotspot passwords and sending them via sms

Mon Feb 13, 2017 6:15 am

I started to solve this problem too. And I have an idea how to solve it without Radius.
1 the user enters a number and clicks a button (submit)
2 the system does not find that user. writes in the log error "login failed" to mention user not authenticated.
3 script parses the log file or memory for an error of this type, and as soon as sees it, generates a password and sends an sms and adds the user to the hotspot
4 at this time the user opens the field to enter your code and come sms. The following authorization is successful!

Now the question guru. as a means mikrotik script to extract a substring of specified length from the file or memory knowing the context?
If this is not possible, you can write syslog server to another. Then, analyze it and send commands to mikrotik
 
OKNET
Member Candidate
Member Candidate
Posts: 237
Joined: Mon Jun 22, 2015 9:22 am

Re: Generating hotspot passwords and sending them via sms

Fri Mar 10, 2017 5:25 pm

Any progress in this topic ???

Very interested in self-authentication by SMS
 
dante
just joined
Posts: 2
Joined: Mon Feb 13, 2017 5:39 am
Location: Novosibirsk

Re: Generating hotspot passwords and sending them via sms

Tue Apr 25, 2017 12:56 pm

Oh sure. At the moment the script is working in test mode and is being finalized in accordance with the needs for a particular solution. At the moment the script has this view:
#Phone number detekt
:global marker "script started";
:global content [/file get [/file find name=loghotspot.0.txt] contents];
/file remove loghotspot;
:set marker "loghotspot deleted";
:global pos [:find $content "login failed" 0];
:set marker "search position finished";
:if ($pos != "") do={
#####################################
:global uname "";
:global phone "";
:if ([:pick $content ($pos-29)] = " ") do={
:set uname [:pick $content ($pos-28) ($pos-18)];
:set phone "8$uname";
}
:if ([:pick $content ($pos-29)] = "7") do={
:if ([:pick $content ($pos-30)] = "+") do={
:set uname [:pick $content ($pos-30) ($pos-18)];
:set phone "$uname";
} else={
:set uname [:pick $content ($pos-29) ($pos-18)];
:set phone "+$uname";
}
}
:if ([:pick $content ($pos-29)] = "8") do={
:set uname [:pick $content ($pos-29) ($pos-18)];
:set phone "$uname";
}
#####################################
:global ipaddr [:pick $content ($pos-16) ($pos-3)];
:set marker "position fined and variables set";
:if ([ip hotspot user find name=$uname]="") do={
:if ([ip hotspot user find address=$ipaddr]!="") do={
/ip hotspot user remove [find address=$ipaddr];
:set marker "clean ipaddr";
}
#Password generation
:local date [/system clock get time]
:local hour [:pick $date 0 2]
:local min [:pick $date 3 5]
:local sec [:pick $date 6 8]
:global pass 27394
:set pass ($hour * $min * $sec)
:set marker "password generated";
:if ($pass = 0) do {
:set pass 6524
}
#Add user
:global ts [/system clock get time]
:global ds [/system clock get date]
:global dt "$ds-$ts"
:set marker "before add user";
/ip hotspot user add name=$uname address=$ipaddr password=$pass comment=$ipaddr;
:set marker "after add user";
/tool sms send usb2 "$phone" message="$pass"
:set marker "added user and send sms";
}
:if ([ip hotspot user get [find name=$uname] address]!=$ipaddr) do={
/ip hotspot user set address=$ipaddr [find name=$uname];
}
:set $pos "";
:set marker "reset position";
}
Note that the ip address must have a fixed length. Otherwise, there will be difficulties in retrieving the phone number from the logs.
 
ydfkensai
just joined
Posts: 1
Joined: Fri Jun 30, 2017 8:26 am

Re: Generating hotspot passwords and sending them via sms

Sat Jul 01, 2017 6:13 pm

@Dante

Did u get the final solution?
Need some help.

Thx
 
waeel
just joined
Posts: 2
Joined: Tue Dec 26, 2017 8:25 am

Re: Generating hotspot passwords and sending them via sms

Sun Jul 08, 2018 3:51 pm

Did u get the final solution?
 
reyvilla93
just joined
Posts: 1
Joined: Tue Apr 30, 2019 5:02 am

Re: Generating hotspot passwords and sending them via sms

Wed Sep 18, 2019 5:00 am

any ideas how to make:

1. HotSpot welcome page telling you to enter your phone number
2. You enter your phone number, press "submit"
3. You recieve sms and enter a password to a field "access code"?
Do you have any solution for that yet?

Who is online

Users browsing this forum: No registered users and 17 guests