Coder Social home page Coder Social logo

freewifi's Introduction

Free Wifi

This short tutorial describes a few methods for gaining access to the Internet, a basic human right, from public wireless networks.

This tutorial has been tested on Mac and a Raspberry Pi. It should generally work on Linux, and hasn't been tested on Windows.

Preparation

Make sure you do this step before you are stuck without Internet access:

  1. Install Python pip
  2. On Linux, install Python Developer package, a dependency for the netifaces package.

Ubuntu:

$ sudo apt-get install python-dev

Fedora:

$ sudo dnf install python-devel

Note: For Centos, substitute dnf with yum

  1. Make a copy of this repository and install dependencies for the script:
$ git clone https://github.com/kylemcdonald/FreeWifi
$ cd FreeWifi && sudo pip install -r requirements.txt

How to get additional time

If you had free internet access but your time has run out, the first thing to try is open an incognito/private window. Here are instructions for a few browsers:

An incognito/private window will temporarily clear any cookies that may have been used for tracking how much time you spent online, making you look like a "new user" and allowing you to log into the wireless portal again.

Unfortunately, most systems track MAC addresses instead of cookies. A MAC address is a unique identifier assigned to every network interface. This means you need to get a new MAC address to get additional time. Fortunately, MAC addresses can be changed in software, without swapping the hardware. The spoof-mac command line utility makes this easy by entering sudo spoof-mac randomize Wi-Fi. If the command fails to run, try entering spoof-mac list --wifi to check what the name of your wireless device is first, and use that manually. After randomizing your MAC, try logging into the wireless portal again. When you're done using the Internet, run sudo spoof-mac reset Wi-Fi to reset your MAC address.

Note that MAC address spoofing may be interpreted as an illegal activity depending on why you do it. In some cases it is certainly not illegal: recent mobile operating systems like iOS 8+ and Android 6+ automatically randomize their MAC address when searching for wireless networks to avoid being tracked. But when Aaron Swartz liberated JSTOR, MAC address spoofing was claimed as a signal of intention to commit a crime.

How to get free access

If the network is open, but you can't get access for some reason, you can also try spoofing the MAC address of a device that is already using the network. To the router, your device and the other device will look like one device. This can cause some minor problems if they interrupt each other, but for light browsing it usually works out fine.

To find the MAC addresses of other devices using the network, first you need to connect to the network. You don't need to have Internet access, just a connection. First, on Mac OS run the command sudo chmod o+r /dev/bpf* once to make sure you can sniff wireless data (you need to do this again if you restart your computer). Then run the command python wifi-users.py. You should see a progress bar immediately:

Available interfaces: en0
Interface: en0
SSID: nonoinflight
Available gateways: en0
Gateway IP: 10.0.1.1
Gateway MAC: 00:e0:4b:22:96:d9
100%|██████████████████████████| 1000/1000 [00:46<00:00, 21.46it/s]
Total of 5 user(s):
27:35:96:a8:66:7f	6359 bytes
36:fe:83:9c:35:eb	9605 bytes
65:01:3c:cc:20:e8	17306 bytes
8c:6f:11:2c:f0:ee	20515 bytes
0a:4f:b2:b8:e8:56	71541 bytes

If there isn't much traffic on the network, it might take longer. If it's taking too long, type CTRL-C to cancel the sniffing and print whatever results are available. Finally, we want to spoof one of these MAC addresses. For example, in this case we would enter sudo spoof-mac set 0a:4f:b2:b8:e8:56 Wi-Fi to try spoofing the address with the most traffic (they probably have a connection). After running that command, try to access the Internet. If you don't have a connection, try the next MAC in the list. If your Internet connection drops out while using this MAC address, try disconnecting and reconnecting to the wireless network. Note that the original user of the MAC you copied may experience these same connection drop outs if you are both actively using the network.

How it works

wifi-users.py uses tcpdump to collect wireless packets. Then we look through these packets for any hints of the MAC address (BSSID) of our wireless network. Finally, we look for data packets that mention a user's MAC as well as the network BSSID (or the network gateway), and take note of that MAC using some amount of data. Then we sort the user's MACs by the total amount of data and print them out.

Instead of sniffing wireless traffic, in some situations you can also use the command arp -a to get a list of MAC addresses of devices on the wireless network. Then you can either use spoof-mac to copy the address, or use ifconfig directly on Linux and OSX. For the specifics of using ifconfig look at the implementations of set_interface_mac inside SpoofMac's interfaces.py.

This repository is dedicated to Lauren McCarthy, who has taught me the most about the art of getting a good deal.

freewifi's People

Contributors

kylemcdonald avatar puzza007 avatar quincylarson avatar stasfilin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freewifi's Issues

Some errors maybe myself problem

Error getting wireless interface.
Traceback (most recent call last):
File "wifi-users.py", line 161, in
main(argv)
File "wifi-users.py", line 58, in main
wireless = Wireless()
File "/usr/local/lib/python2.7/dist-packages/wireless/Wireless.py", line 27, in init
self._driver_name = self._detectDriver()
File "/usr/local/lib/python2.7/dist-packages/wireless/Wireless.py", line 51, in _detectDriver
response = cmd('nmcli --version')
File "/usr/local/lib/python2.7/dist-packages/wireless/Wireless.py", line 15, in cmd
stderr=subprocess.STDOUT
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 6: ordinal not in range(128)

Sniffing finished early.

Available interfaces: wlo1
Interface: wlo1
SSID: xxxxxx
Available gateways: wlo1
Gateway IP: xxxxx
Gateway MAC: xxxxxx
2/1000 ▎                                                                                                                                                           00:14
Sniffing finished early.
Total of 0 user(s)

when I run > python wifi-users.py I get sniffing finished early with zero users I am using linux mint 32bit Kde- i've hidden my SSID and IP.

install fails on Fedora 25

[sheepdestroyer@sheepivyra FreeWifi]$ sudo pip install -r requirements.txt
Collecting netifaces (from -r requirements.txt (line 1))
  Using cached netifaces-0.10.5.tar.gz
Collecting netaddr (from -r requirements.txt (line 2))
  Using cached netaddr-0.7.19-py2.py3-none-any.whl
Collecting wireless (from -r requirements.txt (line 3))
  Using cached wireless-0.3.2.tar.gz
Collecting SpoofMAC (from -r requirements.txt (line 4))
  Using cached SpoofMAC-2.1.1.tar.gz
Collecting tqdm (from -r requirements.txt (line 5))
  Using cached tqdm-4.11.2-py2.py3-none-any.whl
Collecting docopt (from SpoofMAC->-r requirements.txt (line 4))
  Using cached docopt-0.6.2.tar.gz
Installing collected packages: netifaces, netaddr, wireless, docopt, SpoofMAC, tqdm
  Running setup.py install for netifaces ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-afoMHF/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EMJGTf-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    checking for getifaddrs...not found.
    checking for getnameinfo...not found.
    checking for socket IOCTLs...not found.
    checking for optional header files...none found.
    checking whether struct sockaddr has a length field...no.
    checking which sockaddr_xxx structs are defined...none!
    checking for routing socket support...no.
    checking for sysctl(CTL_NET...) support...no.
    checking for netlink support...no.
    building 'netifaces' extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DNETIFACES_VERSION=0.10.5 -I/usr/include/python2.7 -c netifaces.c -o build/temp.linux-x86_64-2.7/netifaces.o
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-afoMHF/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EMJGTf-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-afoMHF/netifaces/
[sheepdestroyer@sheepivyra FreeWifi]$

Netifaces Error

I'm acquainted with phyton, but I'm trying to get things working here.
When I ran cd FreeWifi && sudo pip install -r requirements.txt some error happend with netifaces installation, can you help me to figure it out what's it?

jrvansuita$ cd FreeWifi && sudo pip install -r requirements.txt
Password:
The directory '/Users/jrvansuita/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/jrvansuita/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting netifaces (from -r requirements.txt (line 1))
  Downloading netifaces-0.10.5.tar.gz
Collecting netaddr (from -r requirements.txt (line 2))
  Downloading netaddr-0.7.19-py2.py3-none-any.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 272kB/s 
Collecting wireless (from -r requirements.txt (line 3))
  Downloading wireless-0.3.2.tar.gz
Collecting SpoofMAC (from -r requirements.txt (line 4))
  Downloading SpoofMAC-2.1.1.tar.gz
Collecting tqdm (from -r requirements.txt (line 5))
  Downloading tqdm-4.11.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 347kB/s 
Collecting docopt (from SpoofMAC->-r requirements.txt (line 4))
  Downloading docopt-0.6.2.tar.gz
Installing collected packages: netifaces, netaddr, wireless, docopt, SpoofMAC, tqdm
  Running setup.py install for netifaces ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-_c8xo6/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Z1MLLx-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    checking for getifaddrs...not found.
    checking for getnameinfo...not found.
    checking for socket IOCTLs...not found.
    checking for optional header files...none found.
    checking whether struct sockaddr has a length field...no.
    checking which sockaddr_xxx structs are defined...none!
    checking for routing socket support...no.
    checking for sysctl(CTL_NET...) support...no.
    checking for netlink support...no.
    building 'netifaces' extension
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DNETIFACES_VERSION=0.10.5 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c netifaces.c -o build/temp.macosx-10.6-intel-2.7/netifaces.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command '/usr/bin/clang' failed with exit status 1
    
    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-_c8xo6/netifaces/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-Z1MLLx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-_c8xo6/netifaces/
vansuita:FreeWifi jrvansuita$ 

Doesn't work on Archlinux

sudo python3 wifi-users.py

Error getting wireless interface.
Traceback (most recent call last):
  File "wifi-users.py", line 151, in <module>
    main(argv)
  File "wifi-users.py", line 51, in main
    wireless = Wireless()
  File "/usr/lib/python3.6/site-packages/wireless/Wireless.py", line 23, in __init__
    self._driver_name = self._detectDriver()
  File "/usr/lib/python3.6/site-packages/wireless/Wireless.py", line 50, in _detectDriver
    compare = self.vercmp(ver, "0.9.9.0")
  File "/usr/lib/python3.6/site-packages/wireless/Wireless.py", line 71, in vercmp
    return cmp(normalize(actual), normalize(test))
NameError: name 'cmp' is not defined

mac address

how to restore my original mac address. i have no clue about my original mac address . pls help me

On a mac, received this error

When I typed $ cd FreeWifi && sudo pip install -r requirements.txt

I got this error:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-eB0BuK/wireless/

Snifing finished early

I have output

_Available interfaces: wlo1
Interface: wlo1
SSID: VupsenVSPupsen
Available gateways: eth0, wlo1
Gateway IP: 192.168.251.2
Gateway MAC: 50:ff:20:01:f5:82
2/1000            00:15
Sniffing finished early._

I thing it tcpdump didn`t know options '-Ile' (wifi-users.py108).
without that its work but somthing wrong. need more time.

wifi-users.py : Error getting wireless interface

[sheepdestroyer@sheepivyra FreeWifi]$ sudo python wifi-users.py 
Error getting wireless interface.
Traceback (most recent call last):
  File "wifi-users.py", line 161, in <module>
    main(argv)
  File "wifi-users.py", line 58, in main
    wireless = Wireless()
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 23, in __init__
    self._driver_name = self._detectDriver()
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 50, in _detectDriver
    compare = self.vercmp(ver, "0.9.9.0")
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 71, in vercmp
    return cmp(normalize(actual), normalize(test))
  File "/usr/lib/python2.7/site-packages/wireless/Wireless.py", line 70, in normalize
    return [int(x) for x in re.sub(r'(\.0+)*$', '', v).split(".")]
ValueError: invalid literal for int() with base 10: '4-3'
[sheepdestroyer@sheepivyra FreeWifi]$ 

error getting gateway mac on macbook pro

Available interfaces: en1
Interface: en1
SSID: Wendy's Free
Available gateways: en1
Gateway IP: 192.168.150.254
Error getting gateway MAC address.
1429it [00:06, 229.50it/s]
Total of 6 user(s)
fc:2d:5e:15:b6:51 84 bytes
01:00:5e:7f:ff:fa 406 bytes
38:c9:86:e9:fe:ea 934 bytes
0c:72:d9:28:5b:f7 1211 bytes
c0:17:4d:97:93:7d 26638 bytes
00:ff:71:22:11:07 28461 bytes

This is the output i get after running your two step method.

Add Legal Warning

Spoofing the MAC of another client over 802.11 is likely illegal in the United States as you would be purposefully interfering with their connection. It may be prudent to add a warning to readme.md that performing the steps described could violate local laws.

Federal law prohibits the operation, marketing, or sale of any type of jamming equipment, including devices that interfere with cellular and Personal Communication Services (PCS), police radar, Global Positioning Systems (GPS), and wireless networking services (Wi-Fi).

Ubuntu: No `/dev/bpf*`

What would be the Linux equivalent of /dev/bpf*? At least on Ubuntu there are no such files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.