Coder Social home page Coder Social logo

jasbur / raspiwifi Goto Github PK

View Code? Open in Web Editor NEW
607.0 607.0 276.0 533 KB

Headless WiFi configuration for the Raspberry Pi (or most other devices running Linux) by using a temporary WiFi access point and web interface

License: Other

CSS 12.44% HTML 17.14% Shell 1.16% Python 69.27%

raspiwifi's People

Contributors

alranel avatar jasbur avatar tiito78 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

raspiwifi's Issues

Trigger script start-up in a more friendly way

I'm currently starting all scripts (Both in Configuration and Client mode) by copying over the system's /etc/rc.local file. The existing rc.local is being overwritten completely in this process.

That means that any other modifications, outside the scope of RaspiWiFi will be lost. So that RaspiWiFi can peacefully co-exist with other projects a more sane way to do this needs to be implimented. My current thought is maybe to append a line using the @reboot trigger in the /etc/crontab.

Change ip address to domain

Is there a way to change the ip:port address to a "domain"?

For instance, on ASUS routers, you can type in router.asus.com in a browser and it will point to the setup page. Just makes it easier to remember if it dosen't auto start then a long ip:port string.

  • Update - Just found this, see bottom comment, not sure if this would be possible and/or a good idea, may introduce other issues.

https://superuser.com/questions/1041180/how-does-my-router-resolve-a-url-like-http-router-asus-com-to-its-ip-address

Stops working after sudo pip3 install flask

Steps to reproduce:

  1. Use the latest RaspiWiFi image
  2. Connect to your Wifi using RaspiWiFi
  3. sudo apt-get install python3-pip
  4. sudo pip3 install flask
  5. sudo rm /etc/wpa_supplicant/wpa_supplicant.conf
  6. Reboot

After deleting wpa_supplicant.conf and rebooting, I don't see the RaspiWiFi access point anymore.

I have a python script that runs in sudo on startup, so it's easier for me to sudo pip3 install flask, but as a workaround, I'll try to use virtualenv to isolate the python3 flask.

Application misconfigures a WPA2 access point as WPA

Hello, first off much thanks for putting this project together.

I've been trying to get this working for my home wifi, but just couldn't get it going right. I tried it at friend's houses though, and discovered it worked there, so I set about figuring out what was wrong with mine.

I eventually discovered that it had configured wpa_supplicant.conf file for WPA instead of WPA2. By removing the lines below, the Pi would connect (after a restart).

pairwise=CCMP PSK
group=CCMP TKIP

I'm stilling working on why exactly it did this. Unfortunately my knowledge of Linux networking is rather limited, so I haven't been able to ascertain why yet. I wanted to get this bug report in while I investigate it further. I'll report back when I know more.

Not redireting to save_credentials.html

After entering credentials, it does not redirect to save_credentials.html.

It does however correctly save the credentials and reboot. Tested on Firefox 62 with newest img version on Pi Zero W.

It looks like this is happening because in app.py on line 27 is the set_ap_client_mode function which runs a reboot before it gets to line 29 for redirecting to the save_credentials.html page.

Unrelated question, but in /etc/raspiwifi/raspiwifi.conf does Auto-Config mode check for an "active connection" to the internet via ping or to the local router? It's not clear how iwconfig works in your code for checking.

Use a base wpa_supplicant.conf template

It would be handy to create a /etc/wpa_supplicant/wpa_supplicant.conf.base file that gets copied to /etc/wpa_supplicant/wpa_supplicant.conf before the new network is written to it. This way a few known hard-coded networks can be stored anyway, along with any other custom configuration option.

Connect to a hidden network

Hi! I would like to know how can I connect to a hidden wifi network or how can i change the code to help me to do so. Thanks!

manual_reset erroring out

Hi trying to run manual reset and getting following error:

SyntaxError: invalid syntax *** ), end**=**'') ***
marked in bold

SyntaxError: invalid syntax
pi@raspberrypi:/usr/lib/raspiwifi/reset_device $ sudo python manual_reset.py
Traceback (most recent call last):
File "manual_reset.py", line 1, in
import reset_lib
File "/usr/lib/raspiwifi/reset_device/reset_lib.py", line 31
print(line.replace("temp-ssid", ssid_prefix + serial_last_four), end='')

Gpio reset not working on Pi Zero W

Love the program and it works great on my Pi Zero W with the exception of the gpio reset. I modified reset.py to use gpiozero instead of RPi.GPIO and it solved my issue.

.IMG?

where do I find the .IMG? thanks,

dhcpcd.service fails to start in AP Host mode

On a fresh install of (at least) these two versions of Raspbian Stretch 2017-11-29 and 2018-04-18 the dhcpcd service fails to start. Meaning the RPI doesn't turn into ap host mode.

Looking at the status of the dhcpcd service:

image

After deleting /etc/network/interfaces and rebooting the RPI, the dhcpcd service starts and the RPI turns into ap host mode. But deleting the interfaces file removes the static IP which is very useful for ap host mode. I'm able to access the WiFi setup portal page on http://169.254.22.70:9191 . So, a static IP will need to be setup somewhere else?

In main.rb you have checking for Raspbian Stretch, to delete the interfaces file. So, checking for Raspbian Stretch will need to be added into the initial_setup, reset, and manual_reset?

INstalalation failed

Hey I had followed the installation instructions as-is but nothing happens.
During installation it said that there is error here
import RPi.GPIO as GPIO that the package is missing.

But if I re-edit my wpa_supplicant file, it wont connect back to wifi. So, it became a dead end. How to resolve this.

Captive portal does not trigger automatically on IOS or Android

Although all addresses manually typed into the browser seem to lead correctly to the Flask server at 10.0.0.1:9191, the auto-triggered page display on Android and IOS do not seem to find the page automatically.

IOS doesn't pull up anything automatically and Android pulls up a Page Not Found error. It does trigger and render the page correctly on Ubuntu Linux 18.04 though. I have not tested in Windows yet.

Branch: captive_portal

Not working for me

I tried using the script to install, and I was not able to see an AP. Then I started fresh with your IMG file, still no luck, am I missing something?
This is on a RPI B+ and with a Realtek 8188EUS Wifi dongle

Thanks for your help, this is a great solution (when it works for me :) )

A reset while in AP host mode overwrites needed original files

The reset.py is active during AP Host.
If the main logic loop waiting for a button is triggered during AP Host then the function reset_to_host_mode() is triggered

This results in a bug where the orginal files are over written by the reset_to_host_mode() function.

os.system('mv /etc/dhcpcd.conf /etc/dhcpcd.conf.original')
os.system('mv /etc/dnsmasq.conf /etc/dnsmasq.conf.original')

After connecting to a Wi-Fi (The original files are now incorrect) an issue arrises where DHCP is set to local and although connected to Wi-FI you cant access the internet due to nameserver resolving locally.

To resolve this, I created an entirely separate file (dhcpcd & dnsmasq) and am copying these files during the set_ap_client_mode() in rather than depending on the flow to save the original files & replace them.

Dynamic Access point name

Hey
Is it possible to have a dynamic SSID name from RaspiWiFi Setup to RaspiWiFi [email protected], or whatever the ip-address is?

This will make it easier for a person to know exactly where to navigate.

After Install and Reboot, I Enter My Password and it Reboots Again Without Being Connected to the WiFi That I Just Put The Password In For

So I am running Raspbian Stretch with Desktop (Latest Version) with my RPi 3 model B+. I installed everything and it seems to work. Once it finishes its first reboot I see the device under my phones Wifi selections and I select it. Then I navigate to 10.0.0.1 and enter the password. The Pi then reboots. Once it is back on, its not connected to the internet? What could it be? Its almost working lol.

Only see nginx

Upon installation and reboot on a Raspberry Pi 3, only the default nginx index.html page is visible when connecting to 10.0.0.1. In terms of process, I re-installed several times...the program stopped with errors so I explicitly installed the requisite pages as instructed:

sudo gem install jason -v '1.8.2'
sudo gem install binding_of_caller -v '0.7.2'

The last run of initial.setup.py ran without a hitch. On a related note, since the configuration page is not appearing, how might I reconfigure the Rpi to connect to WiFi, short of re-imaging it, should the RaspiWifi page not appear. Thanks.

HTML layout no longer re-sizing properly on mobile devices

Since I ported the Configuration App over to Flask the HTML layout doesn't seem to be responsive like it was under the old Ruby on Rails implementation.

@tiito78 Since you were the contributor for this portion of the project I was wondering if you could take a look at it. I tried, but I can't seem to spot the cause.

Invalid DNS from DHCP Client when on client mode

My DNS is defaulting to 127.0.0.1, instead of using the DNS provided by the DHCP client on my network. I tried different routers and getting the same results. I'm using the latest img release.

cat /etc/resolv.conf

# Generated by resolvconf
nameserver 127.0.0.1

If the password is entered incorrectly, pi will continue to restart when re-opening the previous web setup page

The password was entered incorrectly at the first time. I have to reset the pi by pressing PIN 18 to HIGH for 10 seconds.
But as soon as I open up the setup webpage, the pi reboots and load with the previous incorrect password.
I think it is something to do with the web server cache (POST/GET?)
I could solve the problem by closing the previous web server, and open a new page (10.0.0.1), then reset the pi to reboot.

AP SSID not showing after Reset

I did a Manual_reset.py but now the AP doesnt show.
I manually edited /etc/default/hostapd to point to the conf file but I shouldn't have to do that. What could be wrong?

Multiple Wifi networks.

I haven't tried it out yet but this is exactly the program I am looking for, I was wondering if you have looked into making it capable of learning multiple wifi networks, so if it can't find a wifi network it knows within a certain time it switches to config mode to learn a new one or remove old ones if needed.

Changing network

Ya I know, this guy is back again Lol. So I've come across an issue.

So lets say you are at house 1. You start the pi and everything works perfect. But now lets say you go to house 2. You power on the pi expecting the pi to give off wifi so you can enter the password credentials. Well, the pi does give off wifi, however not under the 10.0.0.1 server.

So I thought of maybe a quick fix to this. What if the pi on startup asked itself, do I have wifi? If no then run the sudo python3 initial_setup.py command. If yes than do nothing. Thoughts?

To try this for yourself just unplug your wifi instead of going to another house. Since your wifi is unplugged then it should make the 10.0.0.1 server. But if it does then we know it is working.

loose ethernet Connection

Hi
i have installed RaspiWiFi install ok and access pint created.problem is i dont want to connect wifi now i want to choose ethernet till i require ,but in this case my existing DHCP ip loose .
is it poosbil;e keep DHCP on till user connect to AP.
please let us know.
thanks

uninstalling this tool

I am using a raspberry pi 3 with ubuntu mate installed and it seems like this tool doesn't work because there is no AP created, so I was wondering if there is a way of make a clean uninstall for trying to configure my wifi manually. Thanks!

Breaks networking entirely

Hi.
I'm having an issue using this. On fully stock Raspbian Stretch install, this completely breaks the networking. I see it's modifying /etc/network/interfaces. I understand Raspbian has moved away from using this method of configuration. I suspect this might be the cause?

I've also noticed that initial_setup.py doesn't install RPi.GPIO.
That's all I got for now. Trying to figure it all out...

Error when SSID ends in a '+'

I was testing out RaspiWiFi with a mobile hotspot that was created from my phone. The default SSID for my phone was "Zachs Galaxy S8+". The error is that the '+' sign gets ignored since the save_credentials controller thinks the '+' sign is seperating the SSID and the encryption type.

In my situation, the value of the in the dropdown list was something like "Zachs Galaxy S8++open". So, when the server side function processes that value, it determines that the SSID is "Zachs Galaxy S8", when in actuality it's missing the '+' sign.

ssid = params[:ap_info].split('+')[0]
encryption_type = params[:ap_info].split('+')[1]

Any delimiter that you chose to stick between the SSID & the encryption type in the value would cause interference, so a different solution for handling SSID & encryption type would need to be implemented. Something like this solution would work. I don't know how Ruby so I can't implement the server side handling of this, but something like this would work for the HTML side of things with the answer from that StackOverflow answer.

<option value='<%=ap[:ssid]%>' encryption_type='<%=ap[:encryption_type]%>'><%=ap[:ssid]%></option>

Error when installing on Ubuntu Mate

Bundle complete! 11 Gemfile dependencies, 53 gems now installed.
Use bundle show [gemname] to see where a bundled gem is installed.

cp: cannot stat 'Reset Device/static_files/apclient_bootstrapper.template': No such file or directory
cp: cannot stat 'Reset Device/static_files/aphost_bootstrapper.template': No such file or directory
cp: cannot stat 'Reset Device/reset.py.template': No such file or directory
cp: cannot stat 'Reset Device/manual_reset.py.template': No such file or directory
Traceback (most recent call last):
File "/home/zabatt/RaspiWiFi-master/initial_setup.py", line 64, in
update_config_paths()
File "/home/zabatt/RaspiWiFi-master/initial_setup.py", line 29, in update_config_paths
for line in file:
File "/usr/lib/python3.5/fileinput.py", line 248, in next
line = self._readline()
File "/usr/lib/python3.5/fileinput.py", line 335, in _readline
os.rename(self._filename, self._backupfilename)
FileNotFoundError: [Errno 2] No such file or directory: 'Reset Device/static_files/aphost_bootstrapper' -> 'Reset Device/static_files/aphost_bootstrapper.bak'

Any suggestions?

Update

I installed it on a fresh install of Ubuntu Mate and I no longer get the error above. However, I does not appear to be broadcasting the network.

RaspiWifi Setup found by device, but cannot connect to AP.

Hi there,

Your project is very interesting. I installed the application on my Raspbian Stretch OS, but can't seem to connect to the AP. The AP is found on several of my devices (phone/laptops), however once I try to establish connection it fails. Any idea how to solve this? The log file is also completely empty.

Kind regards,

Sidney

Wifi Country

Thank you for this tool - its awesome. I had typed in my PSK wrong so i in Pi world - bricked my device. Had to actually work and put a console cable on. lol ;) - Of course you handled this with a reset button too - (do you have some instructions on how to wire the button up?)

During this time of resetting - i noticed an warning on login that Wifi was disabled due to wifi country was not selected.

I added this to mine but maybe cool to get a country selection during install of the tool. Right now I edited ./app/models/main.rb

temp_conf_file.puts 'country=US'

Added that to my setup to prevent the message (it may be nothing to worry about at all - i know it only shows when we are resetting configuration and wpa_supplicant gets deleted.

Thank you

Running initial_setup.py

find: ‘/run/user/1000/gvfs’: Permission denied
Traceback (most recent call last):
File "initial_setup.py", line 47, in
update_config_paths()
File "initial_setup.py", line 9, in update_config_paths
project_path = subprocess.check_output(['find', '/', '-name', 'GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD'])[:-42].decode('utf-8')
File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['find', '/', '-name', 'GSbSFZwWV1mig4vFSmbLW9iP8TfGfMYCPfHTqGcD']' returned non-zero exit status 1

DHCP Issue - 169.x.x.x address

Been having an issue (seen on Pi Zero W and Pi B+) where the pi fails to assign itself an ip address. It broadcasts the RaspiWifi network, but it lists the ip address as a 169.x.x.x address instead of the desired 10.0.0.1. The Pi B+ eventually seemed to get an ip address (after many reboots), but my Pi Zero seems stuck in this state. Any thoughts or items to check?

Change Setup Port

This is a great project! Thank you for making this!

I would like to point a hosts file address for 10.0.0.1:9191 to an easier to type address for setup. So that when someone visits setup.local it pulls up the setup page. However hosts files can't include a port in the address. So ideally I need to remove the port.

In aphost_bootstrapper.template was the only reference I found to 9191 in the code, however if I remove 9191 it breaks.

Is it possible to run setup without a port number?

DNS issues with latest released image

I don't understand dnsmasq enough to pinpoint the problem. If I try any dns resolution I get the following error:

$ ping google.com

ping: google.com: Temporary failure in name resolution

$ sudo service dnsmasq status

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-11-05 19:04:07 -02; 4min 2s ago
  Process: 510 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 496 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 484 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 509 (dnsmasq)
      CPU: 302ms
   CGroup: /system.slice/dnsmasq.service
           └─509 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /et

Nov 05 19:04:06 twobros-hub systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Nov 05 19:04:07 twobros-hub dnsmasq[484]: dnsmasq: syntax check OK.
Nov 05 19:04:07 twobros-hub dnsmasq[509]: started, version 2.76 cachesize 150
Nov 05 19:04:07 twobros-hub dnsmasq[509]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no
Nov 05 19:04:07 twobros-hub dnsmasq-dhcp[509]: DHCP, IP range 10.0.0.10 -- 10.0.0.15, lease time 12h
Nov 05 19:04:07 twobros-hub dnsmasq[509]: read /etc/hosts - 5 addresses
Nov 05 19:04:07 twobros-hub dnsmasq[509]: no servers found in /run/dnsmasq/resolv.conf, will retry
Nov 05 19:04:07 twobros-hub dnsmasq[510]: Too few arguments.
Nov 05 19:04:07 twobros-hub systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

In order to fix it, I have to run "sudo dhclient wlan0". Then my /run/dnsmasq/resolv.conf gets updated and name resolution works again.

Any thoughts on what is causing this?

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.