{"id":37164047,"url":"https://github.com/txn2/txwifi","last_synced_at":"2026-01-14T19:29:51.893Z","repository":{"id":57593267,"uuid":"135786161","full_name":"txn2/txwifi","owner":"txn2","description":"Raspberry Pi (arm) wifi configuration container. Configure and control wifi connectivity with a JSON based REST api.","archived":true,"fork":true,"pushed_at":"2020-08-28T05:58:13.000Z","size":1265,"stargazers_count":144,"open_issues_count":10,"forks_count":60,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-06-20T17:29:32.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://imti.co/iot-wifi/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"cjimti/iotwifi","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/txn2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-02T04:09:35.000Z","updated_at":"2024-03-10T00:49:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/txn2/txwifi","commit_stats":null,"previous_names":["txn2/iotwifi"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/txn2/txwifi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxwifi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxwifi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxwifi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxwifi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/txn2","download_url":"https://codeload.github.com/txn2/txwifi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxwifi/sbom","scorecard":{"id":904581,"data":{"date":"2025-08-11","repo":{"name":"github.com/txn2/txwifi","commit":"cb6f170adff6d3cadda488fdcf398249d855bb02"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":4,"reason":"Found 6/14 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:11: pin your Docker image by updating arm32v6/alpine to arm32v6/alpine@sha256:6a9fa0745740553f25ba0849ac37cbb501b17a445632b31ecf142c7aa112eaab","Warn: containerImage not pinned by hash: dev/Dockerfile:1: pin your Docker image by updating arm32v6/alpine to arm32v6/alpine@sha256:6a9fa0745740553f25ba0849ac37cbb501b17a445632b31ecf142c7aa112eaab","Warn: goCommand not pinned by hash: dev/Dockerfile:14","Warn: goCommand not pinned by hash: dev/Dockerfile:15","Warn: goCommand not pinned by hash: dev/Dockerfile:16","Info:   0 out of   3 containerImage dependencies pinned","Info:   0 out of   3 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T16:52:30.769Z","repository_id":57593267,"created_at":"2025-08-24T16:52:30.769Z","updated_at":"2025-08-24T16:52:30.769Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T19:29:51.167Z","updated_at":"2026-01-14T19:29:51.884Z","avatar_url":"https://github.com/txn2.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Update - 20180601**: Any future development will happen on this new fork. Hoping add stability as well as new SOCs. If you are interesrted in joining the [txn2](https://txn2.com) team please email human@txn2.com.\n\n**Update**: Tested and functioning on well on the [Raspberry Pi 3 B+](https://amzn.to/2jfXhCA) and [Raspberry Pi 3 B](https://amzn.to/2Kq9Doa). Looking to support additional SOCs in upcoming versions. (Disclosure: the Pi links to Amazon are affiliate links, why not?)\n\n**NOTICE**: This project is intended to aid in developing \"configure wifi over wifi\" solutions for IOT projects using the Raspberry Pi. The main use case for this project is to reproduce functionality common to devices like Nest or Echo, where the user turns on the device, connects to it and configures it for wifi. I have over 800 devices running this software in production and all have had their wifi configured using it. \n\n**This is not a captive portal project. While I have personaly used it for this, it requires additional networking and can be unstable. I don't support this use and so your millage may vary.**\n\n**txwifi** is only expected to run properly on stock Raspberry Pis and not tested on any other hardware configurations.\n\n# IOT Wifi (Raspberry Pi AP + Client)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/txn2/txwifi)](https://goreportcard.com/report/github.com/txn2/txwifi)\n[![GoDoc](https://godoc.org/github.com/txn2/txwifi/iotwifi?status.svg)](https://godoc.org/github.com/txn2/txwifi/iotwifi)\n[![Docker Container Image Size](https://shields.beevelop.com/docker/image/image-size/cjimti/iotwifi/latest.svg)](https://hub.docker.com/r/cjimti/iotwifi/)\n[![Docker Container Layers](https://shields.beevelop.com/docker/image/layers/cjimti/iotwifi/latest.svg)](https://hub.docker.com/r/cjimti/iotwifi/)\n[![Docker Container Pulls](https://img.shields.io/docker/pulls/cjimti/iotwifi.svg)](https://hub.docker.com/r/cjimti/iotwifi/)\n\n[![Waffle.io - Columns and their card count](https://badge.waffle.io/cjimti/iotwifi.svg?columns=all)](https://waffle.io/cjimti/iotwifi)\n\nIOT Wifi is very small/8MB Docker Container built for the [Raspberry Pi 3](https://amzn.to/2jfXhCA).\nIOT Wifi exposes a simple JSON based REST API for controlling the wireless network interface. This container allows the Raspberry Pi to accept wifi connections as an access point (aka AP) while at the same time connecting to an existing wifi network (station mode).\n\nGo (Golang) was used to develop the main application code, to produce a minimal docker image with great performance. The container runs [Alpine Linux](https://alpinelinux.org/) with small, optimized versions of [hostapd], [wpa_supplicant] and [dnsmasq], controlled by the container's API endpoints.\n\nIf you have a Raspberry Pi 3 and you want to provide wifi based configuration abilities, all you need is Docker installed and a little over 8MB of free drive space.\n\n[![Raspberry Pi AP + Client](/doc_assets/pi.jpg)](https://amzn.to/2jfXhCA)\n\nTable of Contents\n=================\n\n   * [IOT Wifi (Raspberry Pi AP   Client)](#iot-wifi-raspberry-pi-ap--client)\n      * [Background](#background)\n      * [Getting Started](#getting-started)\n         * [Disable wpa_supplicant on Raspberry Pi](#disable-wpa_supplicant-on-raspberry-pi)\n         * [Install Docker on Raspberry Pi](#install-docker-on-raspberry-pi)\n         * [Pull the IOT Wifi Docker Image](#pull-the-iot-wifi-docker-image)\n         * [IOT Wifi Configuration](#iot-wifi-configuration)\n         * [Run The IOT Wifi Docker Container](#run-the-iot-wifi-docker-container)\n         * [Connect to the Pi over Wifi](#connect-to-the-pi-over-wifi)\n         * [Connect the Pi to a Wifi Network](#connect-the-pi-to-a-wifi-network)\n         * [Check the network interface status](#check-the-network-interface-status)\n         * [Conclusion](#conclusion)\n\n\nTL;DR? If you are not interested in reading all this, you can skip ahead to\n[Getting Started](#getting-started).\n\nIOT Wifi is a [Raspberry Pi] wifi management REST service written in [Go] and\nintended to run in a [Docker container on a Raspberry Pi](https://hub.docker.com/r/cjimti/iotwifi/).\n\nIOT Wifi sets up network interfaces, runs [hostapd], [wpa_supplicant] and\n[dnsmasq] to run simultaneously,  allowing a user (or another service) to connect to the Raspberry Pi via [hostapd]/[dnsmasq] and issue commands that configure and connect [wpa_supplicant] to another [AP]. IOT Wifi then exposes a small web server on the Pi and offers a JSON based REST API to configure Wifi. The IOT Wifi container allows you to build a custom [Captive Portal] web page or even programmatically connect from another device and use the exposed API to configure the target device.\n\nUsing wifi to configure a wifi connection is often a standard requirement for [IOT]. As Raspberry Pis are becoming a popular choice as an [IOT] platform, this helps solve the frequent need to manage AP and Station modes.\n\n## Background\n\nOver a year ago I wrote a blog post called [RASPBERRY PI 3 - WIFI STATION+AP] with my notes on setting up a **Raspberry Pi 3** to run as a [Wifi Access Point][AP] (Hotspot) and a [Wifi Client (aka Wifi Station)][Station] simultaneously. This old blog post gets a considerable amount of traffic, so it seems there is quite a bit of interest in this. I have come to realize that some of the steps in my old post have changed since newer versions of [Raspian] (n00bs build) are released.\n\nSince writing the post, I have had a few personal and professional projects\nrequiring a Raspberry Pi to allow wifi setup **over wifi**. I decided to open\nsource this simple project to help others with similar requirements as well\nas gain some feedback on where and how I can improve it. I would welcome\nany contribution and credit any contributors.\n\n## Getting Started\n\nYou will need a Raspberry Pi 3, running Raspian Stretch. You\ncan use the [Noobs] release to install the latest version of Raspian.\n\n### Disable wpa_supplicant on Raspberry Pi\n\nYou do not want the default **[wpa_supplicant]** (the software that communicates\nwith the wifi driver and connects to Wifi networks,) running and competing\nwith the **IOT Wifi** container.\n\n```bash\n# prevent wpa_supplicant from starting on boot\n$ sudo systemctl mask wpa_supplicant.service\n\n# rename wpa_supplicant on the host to ensure that it is not\n# used.\nsudo mv /sbin/wpa_supplicant /sbin/no_wpa_supplicant\n\n# kill any running processes named wpa_supplicant\n$ sudo pkill wpa_supplicant\n```\n\n### Install Docker on Raspberry Pi\n\nSsh into the Pi or use the terminal application from the desktop on the Pi\nto get a Bash shell.\n\n```bash\n# Docker install script\n$ curl -sSL https://get.docker.com | sh\n```\n\n![Install Docker](/doc_assets/install_docker.gif)\n\n```bash\n# add pi user to Docker user group\n$ sudo usermod -aG docker pi\n```\n\n![Usermod Docker](/doc_assets/usermod.gif)\n\nReboot the Pi and test Docker.\n\n```bash\n$ sudo reboot\n```\n\nAfter reboot, ensure Docker is installed correctly by running a Hello World\nDocker container.\n\n```bash\n# run the Docker Hello World container and remove the container\n# when finished (the --rm flag)\n$ docker run --rm hello-world\n```\n\n![Docker Hello World on Raspberry Pi](/doc_assets/docker-hello-world.gif)\n\n### Pull the IOT Wifi Docker Image\n\nYou can optionally clone and build the entire project, however, to get\nstarted quickly I'll show you how to use a pre-built Docker Image. At\nonly 16MB this little image contains everything you need. The image\nis based on [Alpine Linux] and contains [hostapd], [wpa_supplicant] and\n[dnsmasq], along with a compiled wifi management utility written in go,\nthe source is found in this repository: https://github.com/txn2/txwifi.\n\n```bash\n# Pull the IOT Wifi Docker Image\n$ docker pull cjimti/iotwifi\n```\n\n![Docker IOT Wifi Image](/doc_assets/docker-pull-image.gif)\n\n### IOT Wifi Configuration\n\nYou will need a configuration JSON file. You can download a default as\na template or just it unmodified for testing. You can mount the\nconfiguration file into the container or specify a location with\nan environment variable.\n\nUse the default configuration file and location for testing:\n\n```bash\n# Download the default configuration file\n\n$ wget https://raw.githubusercontent.com/txn2/txwifi/master/cfg/wificfg.json\n\n```\n\n![Download Configuration](/doc_assets/download-config.gif)\n\nThe default configuration looks like this:\n\n```json\n{\n    \"dnsmasq_cfg\": {\n      \"address\": \"/#/192.168.27.1\",\n      \"dhcp_range\": \"192.168.27.100,192.168.27.150,1h\",\n      \"vendor_class\": \"set:device,IoT\"\n    },\n    \"host_apd_cfg\": {\n       \"ip\": \"192.168.27.1\",\n       \"ssid\": \"iot-wifi-cfg-3\",\n       \"wpa_passphrase\":\"iotwifipass\",\n       \"channel\": \"6\"\n    },\n      \"wpa_supplicant_cfg\": {\n        \"cfg_file\": \"/etc/wpa_supplicant/wpa_supplicant.conf\"\n    }\n}\n```\n\nYou may want to change the **ssid** (AP/Hotspot Name) and the **wpa_passphrase** to something more appropriate to your needs. However, the defaults are fine for testing.\n\n### Run The IOT Wifi Docker Container\n\nThe following `docker run` command will create a running Docker container from\nthe **[cjimti/iotwifi]** Docker image we pulled in the steps above. The container needs to run in a **privileged mode** and have access to the **host network** (the\nRaspberry Pi device) to configure and manage the network interfaces on\nthe Raspberry Pi. We will also need to mount the configuration file.\n\nWe will run it in the foreground to observe the startup process. If you want\nit to run the background, you need to remove the `--rm` and pass the `-d` flag. If you want to it restart on reboot or failure, you can pass the flag\n`--restart=unless-stopped`. \n\n[Read more on the `docker run` command.](https://docs.docker.com/engine/reference/run/)\n\n```bash\n$ docker run --rm --privileged --net host \\\n      -v $(pwd)/wificfg.json:/cfg/wificfg.json \\\n      cjimti/iotwifi\n```\nOptionally, you can also map a directory containing `wpa_supplicant.conf`, like so:\n\n```bash\n$ docker run --rm --privileged --net host \\\n      -v $(pwd)/wificfg.json:/cfg/wificfg.json \\\n      -v \u003cWPA_SUPPLICANT_HOST_PATH\u003e:\u003cWPA_SUPPLICANT_CONTAINER_PATH\u003e \\\n      cjimti/iotwifi\n```\n\nWhere `\u003cWPA_SUPPLICANT_CONTAINER_PATH\u003e` is the path containing `wpa_supplicant.conf` specified in `wificfg.json`.\n\nThe IOT Wifi container outputs logs in the JSON format. While this makes\nthem a bit more challenging to read, we can feed them directly (or indirectly)\ninto tools like Elastic Search or other databases for alerting or analytics.\n\nYou should see some initial JSON objects with messages like `Starting IoT Wifi...`:\n\n```json\n{\"hostname\":\"raspberrypi\",\"level\":30,\"msg\":\"Starting IoT Wifi...\",\"name\":\"iotwifi\",\"pid\":0,\"time\":\"2018-03-15T20:19:50.374Z\",\"v\":0}\n```\n\nKeeping the current terminal open, you can log in to another terminal and\ntake a look the network interfaces on the Raspberry Pi.\n\n```bash\n# use ifconfig to view the network interfaces\n$ ifconfig\n```\n\nYou should see a new interface called **uap0**:\n\n```plain\nuap0: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST\u003e  mtu 1500\n        inet 192.168.27.1  netmask 255.255.255.0  broadcast 192.168.27.255\n        inet6 fe80::6e13:d169:b00b:c946  prefixlen 64  scopeid 0x20\u003clink\u003e\n        ether b8:27:eb:fe:c8:ab  txqueuelen 1000  (Ethernet)\n        RX packets 111  bytes 8932 (8.7 KiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 182  bytes 24416 (23.8 KiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n```\n\nThe standard wifi interface **wlan0** should be available, yet unconfigured since we have not yet connected to an external wifi network (access point).\n\n```plain\nwlan0: flags=4099\u003cUP,BROADCAST,MULTICAST\u003e  mtu 1500\n        ether b8:27:eb:fe:c8:ab  txqueuelen 1000  (Ethernet)\n        RX packets 0  bytes 0 (0.0 B)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 0  bytes 0 (0.0 B)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n```\n\n### Connect to the Pi over Wifi\n\nOn your laptop or phone, you should now see a Wifi Network named **iot-wifi-cfg-3** assuming you did not change it from the default. The default password for this network is **iotwifipass**. Once connected to this network you should get an IP address assigned to the range specified in the config: `192.168.27.100,192.168.27.150,1h`.\n\n![Coeect Phone](/doc_assets/phone.jpg)\n\nOnce connected open a web browser and go to http://192.168.27.1:8080/status. You can access this API endpoint on the Raspberry Pi device itself from `localhost`*. On on Pi try the curl command `curl http://localhost:8080/status`.\n\nYou should receive a JSON message similar to the following:\n\n```json\n{\"status\":\"OK\",\"message\":\"status\",\"payload\":{\"address\":\"b8:27:eb:fe:c8:ab\",\"uuid\":\"a736659a-ae85-5e03-9754-dd808ea0d7f2\",\"wpa_state\":\"INACTIVE\"}}\n```\n\nFrom now on I'll demonstrate API calls to the new container with the [`curl` command](https://en.wikipedia.org/wiki/CURL) on the device. If you were developing a Captive Portal or configuration web page, you could translate these calls into Javascript and control the device Wifi with AJAX.\n\n\u003e You can use my simple static web server IOT Web container for hosting a Captive Portal or configuration web page. See https://github.com/cjimti/iotweb.\n\nTo get a list of Wifi Networks the device can see, issue a call to the **scan** endpoint:\n\n```bash\ncurl http://localhost:8080/scan\n```\n\n### Connect the Pi to a Wifi Network\n\nThe device can connect to any network it can see. After running a network scan  `curl http://localhost:8080/scan` you can choose a network and post the login credentials to IOT Web.\n\n```bash\n# post wifi credentials\n$ curl -w \"\\n\" -d '{\"ssid\":\"home-network\", \"psk\":\"mystrongpassword\"}' \\\n     -H \"Content-Type: application/json\" \\\n     -X POST localhost:8080/connect\n```\nYou should get a JSON response message after a few seconds. If everything went well you will see something like the following:\n\n```json\n{\"status\":\"OK\",\"message\":\"Connection\",\"payload\":{\"ssid\":\"straylight-g\",\"state\":\"COMPLETED\",\"ip\":\"\",\"message\":\"\"}}\n```\n\nYou can get the status at any time with the following call to the **status** endpoint. Here is an example:\n\n```bash\n# get the wifi status\n$ curl -w \"\\n\" http://localhost:8080/status\n```\n\nSample return JSON:\n\n```json\n{\"status\":\"OK\",\"message\":\"status\",\"payload\":{\"address\":\"b7:26:ab:fa:c9:a4\",\"bssid\":\"50:3b:cb:c8:d3:cd\",\"freq\":\"2437\",\"group_cipher\":\"CCMP\",\"id\":\"0\",\"ip_address\":\"192.168.86.116\",\"key_mgmt\":\"WPA2-PSK\",\"mode\":\"station\",\"p2p_device_address\":\"fa:27:eb:fe:c9:ab\",\"pairwise_cipher\":\"CCMP\",\"ssid\":\"straylight-g\",\"uuid\":\"a736659a-ae85-5e03-9754-dd808ea0d7f2\",\"wpa_state\":\"COMPLETED\"}}\n```\n\n### Check the network interface status\n\nThe **wlan0** is now a client on a wifi network. In this case, it received the IP address 192.168.86.116. We can check the status of **wlan0** with `ifconfig`*\n\n```bash\n# check the status of wlan0 (wireless interface)\n$ ifconfig wlan0\n```\n\nExample return.\n\n```plain\nwlan0: flags=4163\u003cUP,BROADCAST,RUNNING,MULTICAST\u003e  mtu 1500\n        inet 192.168.86.116  netmask 255.255.255.0  broadcast 192.168.86.255\n        inet6 fe80::9988:beab:290e:a6af  prefixlen 64  scopeid 0x20\u003clink\u003e\n        ether b8:27:eb:fe:c8:ab  txqueuelen 1000  (Ethernet)\n        RX packets 547  bytes 68641 (67.0 KiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 36  bytes 6025 (5.8 KiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n```\n\nWe can also check the connection by issuing a **ping** command from the\ndevice and specify the network interface to use:\n\n```bash\n# ping out from the wlan0 interface\n$ ping -I wlan0 8.8.8.8\n```\n\nHit Control-C to stop the ping and get calculations.\n\n```plain\nPING 8.8.8.8 (8.8.8.8) from 192.168.86.116 wlan0: 56(84) bytes of data.\n64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=20.9 ms\n64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=23.4 ms\n64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=16.0 ms\n^C\n--- 8.8.8.8 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 2002ms\nrtt min/avg/max/mdev = 16.075/20.138/23.422/3.049 ms\n```\n\n### Conclusion\n\nWrapping the all complexity of wifi management into a small Docker\ncontainer, accessible over a web-based REST API reduces the dependencies on the device to only require Docker.\n\nThere are many ways to handle security using middleware or IP tables. A separate container can also manage security.\n\nCheck out the project [IOT Web](https://github.com/cjimti/iotweb) to get\nstarted with tiny a static web container suitable for building user interfaces for wifi management or captive portals.\n\nSubmit a Github issue or pull request if there are features or bug fixes you would like added to the project.\n\n\n[RASPBERRY PI 3 - WIFI STATION+AP]: http://imti.co/post/145442415333/raspberry-pi-3-wifi-station-ap\n[Raspberry Pi]: https://amzn.to/2jfXhCA\n[Raspian]: https://www.raspberrypi.org/downloads/raspbian/\n[Noobs]: https://www.raspberrypi.org/downloads/noobs/\n[hostapd]: https://w1.fi/hostapd/\n[wpa_supplicant]: https://w1.fi/wpa_supplicant/\n[dnsmasq]: http://www.thekelleys.org.uk/dnsmasq/doc.html\n[Captive Portal]: https://en.wikipedia.org/wiki/Captive_portal\n[AP]: https://en.wikipedia.org/wiki/Wireless_access_point\n[Station]: https://en.wikipedia.org/wiki/Station_(networking)\n[Go]: https://golang.org/\n[IOT]: https://en.wikipedia.org/wiki/Internet_of_things\n[Docker]: https://www.docker.com/\n[Alpine Linux]: https://alpinelinux.org/\n[cjimti/iotwifi]: https://hub.docker.com/r/cjimti/iotwifi/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxn2%2Ftxwifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxn2%2Ftxwifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxn2%2Ftxwifi/lists"}