
Free Hotel Wifi with Python and Selenium - janvdberg
https://gkbrk.com/2018/12/free-hotel-wifi-with-python-and-selenium/
======
danilocesar
There might be an easier workaround for this:

Some hotspots only blocks new TCP connections when that time expires. So I
used this workaround a few times in the past:

You open an SSH connection with -D 1337 so it creates a local SOCKS proxy. You
need to keep that connection opened.

Then you go to gnome/kde/chrome/whatever and define a global SOCKS proxy to
localhost:1337. By doing this, all your new TCP/UDP requests will go through
that connection, and the router won't see them as new TCP/UDP connection.

It used to work for some airports and those 20-minutes-free wifi hotspots. But
honestly I don't remember last time I had to use it. Nowadays I use mainly 3G
on Brazilians airports and, when traveling abroad, I don't remember last time
the airport didn't provide a unlimited free wifi.

~~~
VBprogrammer
Another fun one I discovered that on Virgin trains (UK train company) first
class get free WiFi. By sitting in the nearest standard class carriage I could
manually associate with the access point in first class.

Some hotels have weird setups like free WiFi in the lobby but you have to pay
in the room. That trick probably works there, at least for some of the rooms.

~~~
datanut
It's also worth trying to login to the free wifi in the lobby and roam to the
guest room. Often works a treat!

------
wdroz
With a DNS tunnel, you can achieve "free Wifi" almost everywhere. Iodine[0] is
easy to setup.

[0] [https://github.com/yarrick/iodine](https://github.com/yarrick/iodine)

~~~
IncRnd
Shades of Kaminsky!

How usable is the speed on this?

~~~
cyberpunk
I just did a little test with iperf:

Over my 4g connection to the 'server' box I get this:

    
    
        [  3]  0.0-12.4 sec  1.00 MBytes   676 Kbits/sec
    

Via an iodine tunnel:

    
    
        [  3]  0.0-10.1 sec   178 KBytes   144 Kbits/sec
    

I did try and hit up fast.com from a ssh -D proxy over the tunnel, but it
didn't seem to like that very much.

~~~
IncRnd
Thank you!

------
driverdan
If you encounter paid WiFi that requires a credit card try the Visa test card
number 4111111111111111, cvv 123, and any future exp date. I've seen it work
at multiple hotels.

------
brunoTbear
I thought this was going to be a cool kit for brute-forcing room number/last
name pairs which seems to be an increasingly common hotel wifi auth method.

My guess is most hotel wifi access pages lack anti-automation (I've seen
CAPTCHA on airplane wifi, but never hotel wifi) and there are enough
Smiths/Lopezes/Kims/Lis out there that if you try each of those against every
room number (100-1000) you could reasonably get free wifi in minutes. An
optimization could include changing MAC address between each attempt to defeat
rate limiting on the part of the access point.

~~~
StavrosK
> there are enough Smiths/Lopezes/Kims/Lis out there that if you try each of
> those against every room number (100-1000) you could reasonably get free
> wifi in minutes

 _Stolen_ wifi, since someone will end up getting charged for it.

~~~
scrollaway
These gateways almost always let you pay for wifi inline. The name/room guards
are for people who get complimentary wifi.

Honestly though I stopped going to hotels that don't offer complimentary wifi
and breakfast. That means no Hilton or Marriott. All Holiday inn hotels I've
dealt with have been scores nicer than the "high end" crap Hilton pretends to
be.

~~~
moftz
Right, you always get nickeled and dimed more at the higher end places because
they just assume you can afford it. However not all Hilton places suck. Hilton
Garden Inn is pretty good, free breakfast, free wifi, and the rooms are nice.
I've been staying in Courtyard Mariotts for work lately. No free breakfast but
the rooms are nice.

~~~
scrollaway
Thanks for the heads up on garden inn. I will give them a chance next time I
see them.

Courtyard was a bit better but I got a similar experience as the Hilton. 5
dollar water bottles in the room, nickel and diming all over the place.

My understanding is that it's not just that you can afford it, it's that these
places cater heavily towards corporate stays, so the guest is usually not the
one paying.

Holiday inn breakfasts are a bit worse quality but I've always been treated
with utmost respect as a guest there, so they get my business. Room size is
something I don't usually care about as long as there's a desk.

~~~
dahdum
I’m in a Garden Inn now, never been in a bad one but always seem overpriced to
me.

I was pretty impressed with Home2 suites, usually just a bit more than
Hampton. No omelette bar but otherwise nice breakfasts with microwaveable
sandwiches, and the snacks are pretty cheap instead of $5/water.

------
kkarpkkarp
Most of hotels TVs are connected to ethernet cables. Travel always with your
own router, disconnect cable from TV and connect to router. You have free
internet

~~~
Pawka
Wow never thought about that. Have you tried that? Just curious if it is
possible reach servers outside hotel's network?

~~~
Havoc
Yup. The eth often has even less security on it than wifi

------
qwerty456127
The whole idea of non-free hotel WiFi is ridiculous. It's like charging extra
for tap water you use. It can only make sense if the hotel is really really
cheap.

~~~
celticninja
I have found that the more expensive the hotel is to stay at, the greater the
chance they charge for wifi/internet access. At cheap hotels they use it to
attract customers, at expensive hotels they use it to gouge the customer for a
little more. It is usually because expensive hotels know that people staying
there for work will expense it, so there is little cost for the user in those
situations but the hotel gets some extra income.

~~~
qwerty456127
> I have found that the more expensive the hotel is to stay at, the greater
> the chance they charge for wifi/internet access.

A curious observation. Thanks. I'm not really informed about expensive hotels,
almost everything I know is about the middle segment.

> At cheap hotels they use it to attract customers

At the hotel market of the region I know guests wouldn't even consider booking
a hotel that doesn't list free WiFi (unless it's really fantastic in other
aspects and/or unbelievably cheap) and they would put submit a negative review
if they came and there was no free WiFi (even if it wasn't advertised and
they've just didn't notice), it's like if there was no free water in the WC.

> but the hotel gets some extra income.

And the guest gets some extra headache with authentication and billing instead
of just turning WiFi on and using it.

~~~
tertius
Upsell is real.

------
yakshaving_jgt
You can achieve the same thing (minus the Selenium part) on MacOS with this:
[https://jezenthomas.com/free-internet-on-
trains/](https://jezenthomas.com/free-internet-on-trains/)

I would paste the code snippet, but it doesn't format nicely on HN.

~~~
omaranto
Indent with four spaces:

    
    
        function remac {
          sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
          sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
          sudo networksetup -detectnewhardware
          echo $(ifconfig en0 | grep ether)
        }
    

EDIT: Two spaces is enough.

~~~
majewsky
Two spaces indentation is enough afair.

~~~
omaranto
Let me check:

    
    
      function remac {
        sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
        sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
        sudo networksetup -detectnewhardware
        echo $(ifconfig en0 | grep ether)
      }
    

EDIT: Yep! Two is enough. Thanks!

------
peterburkimsher
I did the same when visiting Taizé in France, whose free WiFi only lasted for
15 minutes at a time! The Terminal command on a Mac, for WiFi, is:

sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx

At CERN in Geneva I had a different problem: MAC addresses are registered to
staff. My dad retired, and his Thunderbolt Ethernet adaptor was still
registered. When I plugged it into my laptop, I not only got his MAC address,
but also his device name! My shell started calling my computer a different
name!

If you're afraid to use Terminal, you can also install the MacSpoofer
preference pane:

[http://www.macspoofer.com](http://www.macspoofer.com)

~~~
darkarmani
That's because your mac is configured to accept the hostname given to it via
DHCP. You can change that setting if you don't like it.

------
nobody271
Isn't this a felony? No seriously. I believe the law is phrased like "if you
use a network in a way that it was not intended to be used". It's one of those
laws that everyone is guilty of, and people even write blog posts bragging
about doing it, but it will be used to bring someone down when they have no
other charges that will stick.

~~~
tkel
CFAA wording is unauthorized access of a _computer_, not a network.

~~~
wwweston
What network equipment these days might not reasonably be described as a
computer, even a pretty powerful one by the standards of the time the CFAA was
written?

And even if _you_ don't think that's reasonable, how confident are you that a
prosecutor couldn't convince a judge and/or jury it is?

------
pvtmert
if you use linux and network-manager, check "random mac" box for that
connection,

add post-connection-hook to `curl` with post data; use $RANDOM for mail
address, even use root.$RANDOM@localhost.localdomain probably it will
authenticate you.

------
deanclatworthy
If you want to go a step further, you can also use some more nefarious tools
to gather mac addresses of clients on the paid network, spoof them and steal
their connection. Not that I've ever done that.

~~~
bronco21016
I’ve always been curious about this. What happens when that other authorized
MAC is also attempting to connect?

------
conqrr
Cant wait to try this on an international flight of 14 hrs. Emirates only
gives 2hrs of connectivity/20mb, so will have to do a lot of resets and on an
android phone as well.

~~~
sleepyhead
Please don't. Data on the connections that a flight uses is not cheap and
speed is slow. Other passengers would have a worse experience if someone
exploits data usage.

~~~
conqrr
I wasn't thinking about the narrow bandwidth available and actual costs. You
are right, i am changing my mind since it doesn't seem ethical.

~~~
pnutjam
You'll probably run out of it's in the DHCP scope anyway.

------
trishmapow2
Expected something a bit more than a basic MAC change. But I guess simple
things work best sometimes - I used to do this on Wi-Fi trains that had a 20MB
limit.

------
sytelus
This is even more useful on international airports many of which only allow
1hr of free wifi. Are there any macchanger equivalents for Windows as well?

~~~
pizza
You can use Powershell on Windows I think: [https://docs.microsoft.com/en-
us/powershell/module/netadapte...](https://docs.microsoft.com/en-
us/powershell/module/netadapter/set-netadapter?view=win10-ps)

You could just call a process from within python that sets it that way

------
pizza
One time I was stuck in Jomo Kenyatta International Airport for 9 hours for a
layover and wrote a similar script, macchanger and all :)

~~~
mosselman
Writing such a script was probably more fun than what you did with the
internet connection afterwards :).

------
pbhjpbhj
The article links
[https://wiki.archlinux.org/index.php/MAC_address_spoofing](https://wiki.archlinux.org/index.php/MAC_address_spoofing)

Which says that systemd-networkd can be set to spoof MAC but "needs a reboot",
does it really need a reboot or is restarting (or ifdown, reload, ifup)
enough?

~~~
Pawka
ifdown and ifup is enough.

------
cybernoodles
XFinity does the same MAC address-based validation, and it can be changed
relatively easily on Linux or Windows. As for Mac, a simple script like this:
[https://github.com/chrislgarry/XFinityHotspotSpoofer](https://github.com/chrislgarry/XFinityHotspotSpoofer)

------
scarface74
With all of the major carriers offering “unlimited data” in the US, I don’t
even bother with WiFi anymore.

~~~
na85
Question from a non-American. Why did you put "unlimited data" in scare
quotes? Is it not actually unlimited?

~~~
scarface74
It is unlimited but the carriers either throttle the data after you use over a
certain number of gigabytes, meaning they slow your data down after $x
gigabytes or they “deprioritize” your data. Meaning that if you use over $y
gigs and your local tower is congested, your data may be slowed down to
prioritize other users.

For T-mobile, they deprioritize your data at 55GB. I’ve never seen it in
practice. My older son who doesn’t live with us uses his phone as his only
internet connection and easily uses 80GB+ a month. We were at an extended stay
for 6 months while we were waiting for our house to be built, and we were
going through 70GB each between my younger son using tethering for his PS4 and
us using our phones as hotspots for an AppleTV.

~~~
slfnflctd
YMMV. I had one of the old grandfathered AT&T 'unlimited' plans. Within a
short time after they stopped offering this plan to new customers, we started
hitting a _hard_ throttle at around 10 GB or something ridiculous like that.
Once we hit it (after about two weeks at that time), it made the internet
practically unusable for the rest of the billing cycle. Forget about streaming
music or games - let alone video - there was a long wait even for text sites
to load.

We have since changed plans and I have been leery of the u-word ever since.

------
s_luis
Almost 2019 and we still have to fight these abusive charges. Nice, elegant
way to work around it!

------
otobrglez
I built this little script a few years ago if someone finds it useful. Works
for MAC and it changes your MAC address. ~>

[https://github.com/otobrglez/mac_changer](https://github.com/otobrglez/mac_changer)

------
Cenk
For OS X there’s a nice little menubar app called LinkLiar:
[https://halo.github.io/LinkLiar/](https://halo.github.io/LinkLiar/)

------
Spacemolte
I think i expected something more advanced, but in reality I really love how
simple/few lines of code such a task can be accomplished. It's a great
reminder to keep things simple.

------
mettamage
Simple, effective, I'm surprised this works in this day and age.

------
crstin
Under macOS, you can do as follows:

[https://www.crstin.com/en/mac-spoofing/](https://www.crstin.com/en/mac-
spoofing/)

------
imglorp
The macchanger idea also works at other free-ish wifi places like Panera
Bread: your session is limited to about a half hour. New MAC, new session...

------
rootsudo
You don't even need Python or Selenium anymore, Windows 10 includes a built in
MAC changer from Device manager.

------
Beefin
My question is how did he/she know that it was the MAC address that the WiFi
used ?

~~~
Illniyar
"And a router tells devices apart is by their MAC addresses"

There is no other identifiable information a router can get out of a device
without authentication

~~~
pbhjpbhj
That sounded wrong to me (I like a challenge), and of course some clever guys
have already been and got at least 94% success at remote device
fingerprinting.

See p.1702 and use of carrier frequency offset (CFO) for fingerprinting, this
paper discusses other methods and auth of AP/devices too;
[https://www.cs.ucr.edu/~zhiyunq/pub/infocom18_wireless_finge...](https://www.cs.ucr.edu/~zhiyunq/pub/infocom18_wireless_fingerprinting.pdf)
.

------
dpx
Will changing MAC work if there is a password for login for internet for 2
hours?

~~~
LadyCailin
Not if the password is unique for you, and they key it off of use of that
password. Then they just deny ANY mac address using that password.

------
avaika
It's 2000 + 18 and people are still using ifconfig :)

~~~
xfitm3
If it’s still available - why not use it?

------
iMart1n_FR
When I need to access free wifi behind a paywall (get more time, more speed,
more features...), I usually go `arp -a` and try to change my MAC address with
one already present on the network, no reset needed. Works with hotels,
airports, etc... Not very ethical though...

------
suvelx
What is it with Hotels and shitty, restricted wifi in the west?

I can't say I've stayed in a lot of hotels, but of the ones I have stayed in,
it's only ever been an issue in the West.

Perhaps that's a part of the reason I enjoy holidays in East Asia. I get the
feeling wifi there is a just a thing, you get access to it, it works. And
nearly all the hotels I've stayed in also offer a free phone that you can take
with you if you need data outside of the hotel.

Yet, in the west, you're lucky if you get some paltry free allowance. For a
business who's aim is "make your stay enjoyable" they're doing a pretty shit
job of it.

~~~
andimm
My experience is, the more business traveler oriented the hotel, the more
likely you'll be charged for WiFi.

My theory is, often companies have a limit for room prices for their
employees, but WiFi fees count additional other expenses so they won't matter
for the selection of the hotel.

So as a business traveler you don't care to be charged 20$/day for WiFi, your
employer will pay for it. Hotels make nice extra money. Only "normal" guests
who care, will be annoyed.

In medium tier Hotels and especially Hostels all around the world I never
experienced any WiFi restrictions.

~~~
morganvachon
> My experience is, the more business traveler oriented the hotel, the more
> likely you'll be charged for WiFi.

I've had the opposite experience. My wife and I usually stay at Hampton Inn or
Hilton properties on vacation, two star "business traveler oriented" locations
with free breakfast and free low-speed WiFi. It's fast enough for everything
except streaming video in HD, and we always bring a Raspberry Pi with a thumb
drive full of TV shows and/or movies we want to see while on vacation. Most of
the places we've stayed even had free HBO/Showtime for when we want to watch
something random.

Conversely, for our fifth anniversary we stayed at a luxury suite for the
weekend, and we had to pay for any WiFi whatsoever, and for breakfast
(admittedly a much nicer breakfast experience than other hotels).

~~~
flavor8
You are saying the same thing.

It boils down to: Mid-price hotels often have free wifi. Expensive hotels
charge much more often. Cheap hotels are a tossup.

