Have Tasker accept Terms of Service on Free Wifi - Just "tapping" "Accept"

494 views
Skip to first unread message

Josh Burger

unread,
Aug 29, 2014, 2:04:47 AM8/29/14
to tas...@googlegroups.com
My work has a Free Wifi network setup. It's free to connect, and does not require anything special, other than pressing an "Accept" button.
The web address that loads is 1.1.1.1. I'm not sure exactly what the "Accept" button calls.

What would be the best option for me to have Tasker automatically accept the Terms of Service? I'm assuming a combination of HTTP Get and Post, but I am not familiar on how those actually work.

Jay M

unread,
Aug 29, 2014, 9:06:17 AM8/29/14
to tas...@googlegroups.com

If your rooted you could automate tapping on the button.

Jay M

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Josh Burger

unread,
Aug 29, 2014, 11:30:19 AM8/29/14
to tas...@googlegroups.com

I'm not rooted. I'd really like to make it all happen behind the scenes if possible.

You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/o8i2TK-6fxs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.

Matt R

unread,
Aug 29, 2014, 1:08:34 PM8/29/14
to tas...@googlegroups.com
You could try showing the site in a webview in a scene and simulating a tap (shouldn't require root).

Matt

Josh Burger

unread,
Aug 29, 2014, 1:10:28 PM8/29/14
to tas...@googlegroups.com

I could try that as a temp, but I really think some combination of HTTP GET and POST should be able to do it. I just don't understand how they work..

On Aug 29, 2014 1:08 PM, "Matt R" <matthew.r...@gmail.com> wrote:
You could try showing the site in a webview in a scene and simulating a tap (shouldn't require root).

Matt

keith twombley

unread,
Aug 29, 2014, 10:52:52 PM8/29/14
to tas...@googlegroups.com
To do this you have to have a bit of background on web development and/or some background info on the captive portal you're faced with.

Here's how I did it with the cisco wireless APs at work. It's a bit more complicated than you described, since I have to use a username/password. You might be able to get away with just sending in the POST to click the Accept button.

First, I installed curl on my rooted device, and I got the wifi connect plugin. I used tcpdump to record the traffic between my phone and the AP, but you could do the same thing with a laptop if you don't want to try running tcpdump on your phone.

A naive captive portal will let you just send in the POST to accept the conditions and off you go. Some captive portals are smarter than others. For the smart ones, like the one I deal with at work, the game plan is to fake as much as possible that you're using a real browser and interactively tapping on the page.

So first, I send a curl request off to http://slashdot.org. I know I'll never get there, it doesn't matter. I include the user agent string that my browser sent. Since the captive portal is going to issue a 302 or javascript redirect to the login/accept page, next I request that page. Finally, I post the username/password back and then am logged in.

I use variables to hold the command lines and stdout and stderr for curl. It makes it easier to dump it all into the log file to debug.

I hope this has helped; you will have to do a bit to get it to work for your situation.

Here's the XML of my task.

<TaskerData sr="" dvi="1" tv="4.4u3">
<Task sr="task57">
<cdate>1387306232289</cdate>
<edate>1409356411653</edate>
<id>57</id>
<nme>Wifi Logon</nme>
<pri>10</pri>
<stayawake>true</stayawake>
<Action sr="act0" ve="6">
<code>425</code>
<Int sr="arg0" val="1"/>
</Action>
<Action sr="act1" ve="6">
<code>7514</code>
<se>false</se>
<Bundle sr="arg0">
<Vals sr="val">
<com.twofortyfouram.locale.intent.extra.BLURB>"WorkWifi"</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>"WorkWifi"</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID>
<jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>java.lang.String</jp.meridiani.apps.wificonnect.extra.STRING_AP_SSID-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">jp.meridiani.apps.wificonnect</Str>
<Str sr="arg2" ve="3">WiFi Connect</Str>
<Int sr="arg3" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIFII</lhs>
<op>5</op>
<rhs>WorkWifi</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act10" ve="6">
<code>547</code>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Str sr="arg1" ve="3">cd /sdcard/logon ; curl -k -A "Mozilla/5.0 (Linux; Android 4.1.2; SCH-I535 Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36" https://1.1.1.1/login.html?redirect=slashdot.org/</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act11" ve="6">
<code>123</code>
<se>false</se>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3">%curlo</Str>
<Str sr="arg4" ve="3">%curle</Str>
<Str sr="arg5" ve="3">%curlr</Str>
</Action>
<Action sr="act12" ve="6">
<code>410</code>
<se>false</se>
<Str sr="arg0" ve="3">logon.log</Str>
<Str sr="arg1" ve="3">+++++++++++++++++++++
%TIME
cmd:[%curlcmd]
output:[%curlo]
res:[%curlr]
err:[%curle]</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
</Action>
<Action sr="act13" ve="6">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act14" ve="6">
<code>547</code>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Str sr="arg1" ve="3">cd /sdcard/logon ; curl -k -L -A "Mozilla/5.0 (Linux; Android 4.1.2; SCH-I535 Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36" -e "https://1.1.1.1/login.html?redirect=slashdot.org/" -d buttonClicked=4 -d err_flag=0 -d err_msg= -d info_flag=0 -d info_msg=  -d redirect_url=http%3A%2F%2Fslashdot.org%2F -d username=MyUserName -d password=password123 https://1.1.1.1/login.html</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act15" ve="6">
<code>123</code>
<se>false</se>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3">%curlo</Str>
<Str sr="arg4" ve="3">%curle</Str>
<Str sr="arg5" ve="3">%curlr</Str>
</Action>
<Action sr="act16" ve="6">
<code>410</code>
<se>false</se>
<Str sr="arg0" ve="3">logon.log</Str>
<Str sr="arg1" ve="3">+++++++++++++++++++++
%TIME
cmd:[%curlcmd]
output:[%curlo]
res:[%curlr]
err:[%curle]</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
</Action>
<Action sr="act17" ve="6">
<code>43</code>
</Action>
<Action sr="act18" ve="6">
<code>548</code>
<Str sr="arg0" ve="3">connected!</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act19" ve="6">
<code>410</code>
<se>false</se>
<Str sr="arg0" ve="3">logon.log</Str>
<Str sr="arg1" ve="3">+++++++++++++++++++++
%TIME
curlo: [%curlo]
Still connected</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
</Action>
<Action sr="act2" ve="6">
<code>426</code>
<Int sr="arg0" val="2"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIFII</lhs>
<op>5</op>
<rhs>WorkWifi</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act20" ve="6">
<code>38</code>
</Action>
<Action sr="act21" ve="6">
<code>20</code>
<on>false</on>
<App sr="arg0">
<appClass>org.sshtunnel.SSHTunnel</appClass>
<appPkg>org.sshtunnel</appPkg>
<label>SSHTunnel:SSHTunnel</label>
</App>
<Str sr="arg1" ve="3"/>
<Int sr="arg2" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%INETCONNECTED</lhs>
<op>8</op>
<rhs>0</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act22" ve="6">
<code>548</code>
<on>false</on>
<Str sr="arg0" ve="3">Done</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act3" ve="6">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act4" ve="6">
<code>547</code>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Str sr="arg1" ve="3">cd /sdcard/logon ; curl -k -A "Mozilla/5.0 (Linux; Android 4.1.2; SCH-I535 Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36" http://slashdot.org</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act5" ve="6">
<code>123</code>
<se>false</se>
<Str sr="arg0" ve="3">%curlcmd</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3">%curlo</Str>
<Str sr="arg4" ve="3">%curle</Str>
<Str sr="arg5" ve="3">%curlr</Str>
</Action>
<Action sr="act6" ve="6">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%curlo</lhs>
<op>4</op>
<rhs>Web Authentication Redirect</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act7" ve="6">
<code>548</code>
<Str sr="arg0" ve="3">Not connected!</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act8" ve="6">
<code>410</code>
<se>false</se>
<Str sr="arg0" ve="3">logon.log</Str>
<Str sr="arg1" ve="3">+++++++++++++++++++++
%TIME
cmd:[%curlcmd]
output:[%curlo]
res:[%curlr]
err:[%curle]</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
</Action>
<Action sr="act9" ve="6">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Img sr="icn" ve="2">
<nme>hl_device_access_network_wifi</nme>
</Img>
</Task>
</TaskerData>


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.



--
Keith W Twombley,
Philosopher
"If brute force doesn't solve your problem, you're not using enough of it."

Josh Burger

unread,
Aug 30, 2014, 1:00:34 AM8/30/14
to tas...@googlegroups.com
So, the URL of the captive portal (we also use Cisco) is essentially http://1.1.1.1/fs/customwebauth/login.html?switch_url=http://1.1.1.1/login.html&wlan=DSGguest&redirect=www.google.com/
Would I just use tasker to HTTP GET the URL, then perform HTTP POST on the action: "onclick="submitAction();" (without the quotes)?
Luckily, my captive portal is as simple as the Accept button.
I tried to tear apart your code to see how I could manipulate it to fit my needs, but it was pretty overwhelming for me - not having experience with HTTP commands..

I'm thinking something similar to:
HTTP Post: submitAction():
Would that work? (I left work for the weekend and can't test...

The entire form for the submit button is here:

<body onLoad="loadAction();"> 
<div style="width:960px;"> 
<div align="center"><img src="Header_FreeWiFi960.jpg" width="960" height="359" alt="Free Wi-Fi" /></div> 
<form method="post"> 
<input name="buttonClicked" size="16" maxlength="15" value="0" type="hidden"> 
<input name="redirect_url" size="255" maxlength="255" value="" type="hidden"> 
<input name="err_flag" size="16" maxlength="15" value="0" type="hidden"> 
<div align="center" style="margin:20px;"> 
<input name="Submit" type="image" class="button" onclick="submitAction();" value="Accept" src="Btn_Accept.png" alt="Accept" /> 
</div> 
</form> 

keith twombley

unread,
Sep 1, 2014, 10:18:27 PM9/1/14
to tas...@googlegroups.com

You're on the right track. However, the form's action is JavaScript. (That's the submitAction() thing).

Curl doesn't understand JavaScript, neither does the server. Only the browser does. Oops, we don't have a browser.

Check the source of your login page (if your browser makes it possible, you want the *rendered* source, since many JavaScript apps modify the Dom and scripts on the fly) to see what exactly the submitAction() function does. You need to emulate this and send the results on to the server.

keith twombley

unread,
Sep 1, 2014, 10:19:57 PM9/1/14
to tas...@googlegroups.com

Above I'm using curl rather than tasker's http functionality. It should work the same. I can't remember why I went with curl instead. I'll poke around.

Josh Burger

unread,
Sep 3, 2014, 9:18:14 PM9/3/14
to tas...@googlegroups.com
I'm just not sure where I'd actually put the code. The entire source code is attached. Think you could give me a hand? I'm usually good at taking apart other peoples' code and modifying it to fit my needs, but I've never seen this actually work before.
Captive Portal source.txt

Josh Burger

unread,
Apr 14, 2016, 10:32:56 AM4/14/16
to Tasker
Have you had any luck? I'm actually still struggling with this..

Will

unread,
Apr 16, 2016, 9:10:33 AM4/16/16
to Tasker
I have not worked with this Tasker add-on  myself but perhaps you could use AutoInput to "click" the button?

https://play.google.com/store/apps/details?id=com.joaomgcd.autoinput

Josh Burger

unread,
Apr 16, 2016, 10:50:08 AM4/16/16
to Tasker
Thanks for the idea, but I'm not rooted.. Even the apps like https://play.google.com/store/apps/details?id=co.uk.syslynx.wifiwebloginapp aren't working with 6.0.1. I'm suspecting because Android now loads captive portals inside a settings UI browser. Could be wrong, however.

Juergen Gruen

unread,
Apr 16, 2016, 11:42:21 AM4/16/16
to Tasker
Hi,

AutoInput should work without root.

Reply all
Reply to author
Forward
0 new messages