DrayTek UK Users' Community Forum

Help, Advice and Solutions from DrayTek Users

Draytek 2380n Automated Login

  • iandrews
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
20 Aug 2014 10:38 #81030 by iandrews
Draytek 2380n Automated Login was created by iandrews
Wanted to set up my sons iPad so that he could only use it on the internet for a limited amount (Quota) of time per day. I wanted it to be “seamless” (i.e he could just pick it up and start using it (assuming he had time left)), but though my Draytek (2830n) provides time quota on “user” authentication, it doesn’t for device (IP) authentication.

So I was left with setting up user authentication. I set up a user account, set a time quota, and then set up a firewall rule attached to his iPad IP address, and applied it to the user I had just set up.

All worked fine. Internet access didn’t work unless a web page to http://router-IP/weblogin.htm was brought up, and username & password entered.

That was fine, but as mentioned above, I wanted it to be a bit more seamless, so went about seeing if I could “automate” the logon process. (Note, some browsers “remember” username / logins so you don’t have to enter them again, and only need to press the Login button (so that may have been a bit better) but Safari on the iPads doesn’t for the Draytek login page.

When you fill in a web form (like the Draytek login page), data entered into the boxes is passed as parameters to another web page. I looked around to see if there was anything on the internet already for the Darytek login parameter names and web page but couldn’t find anything, so set about seeing what I could find.

There is a program called Fiddler http://www.telerik.com/fiddler/web-traffic-recording , that allows you to look at the data going to web sites. So I loaded it up, and logged into the router. The entry for the login showed the following:

POST http://router-IP/cgi-bin/wlogin.cgi HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: http:// router-IP /weblogin.htm
Accept-Language: en-GB
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: router-IP
Content-Length: 65
Proxy-Connection: Keep-Alive
Pragma: no-cache

aa=********&ab=********obj2=&obj3=&obj4=&sslgroup=-1&obj6=&obj7=


NOTE: ******** replace my username and password info


So, the web page was:

http://router-IP/cgi-bin/wlogin.cgi

and the following parameters were used:

aa
bb
sslgroup

aa was the username, bb the password, and as I have SSL VPN set up sslgroup was for that.


So the “web address URL” to type into the Address bar was:

http://router-IP/cgi-bin/wlogin.cgi?aa=******&ab=******&sslgroup=-1

This logs you in, and if a user account (rather than the admin one), will direct you to the “landing page” (if one is set up for that user).

To Cont.....

Please Log in or Create an account to join the conversation.

  • iandrews
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
20 Aug 2014 10:40 #81031 by iandrews
Replied by iandrews on topic Re: Draytek 2380n Automated Login
...Cont.

Now if you want to try this yourself then unfortunately it’s not just a case of entering you username / password in place of the ******** as it turns out that these are encrypted. For me, the info from Fiddler above showed my encrypted values, but if you want to know yours you can either run Fiddler, or it turns out that the encryption used is a standard called Base64, and this web site: http://www.base64encode.org/ gave the same encrypted values for username and password when I entered my details, so you may be able to use that.

As well as entering the URL into a web browser you can also use CURL (or I also assume WGET) if you say wanted to script this. In my case the CURL command was:

curl -d aa="******" -d ab="******" -d sslgroup="-1" http://router-IP/cgi-bin/wlogin.cgi

Hope this helps somebody, but try at your own rick, I can’t guarantee that it will work for your router, or that if you try it the router will fall over in a big heap, or even stop working, or start smouldering!?!?!.

Please Log in or Create an account to join the conversation.

Moderators: Sami