Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wifipasswords

PyPI GitHub release (latest by date including pre-releases) GitHub PyPI - Python Version Downloads

Retrieve and save all WiFi networks and passwords on the device.
On windows uses the netsh subprocess.
On linux reads the NetworkManager files or wpa_supplicant.conf.

Cross platform:

  • Windows
  • Linux
  • macOS (working - however see below note)

there is also a GUI version of this tool that can be found here - WifiPasswords-GUI

NOTE: requires sudo privileges on linux only if NetworkManager is not used.

NOTE: Macos requires admin authentication for each password read, this can result in a lot of prompts for the get_passwords() function. I am currently looking for a solution for this.

Features

  • Importable as a package or able to be run directly on the command line
  • Tested in Python 3.6 - 3.10
  • Tested on Windows 10, Ubuntu 18 - 20.04, Debian Buster, macOS 10.13 (High Sierra) and macOS 10.14 (Mojave)
  • Returns WiFi passwords as a dictionary
  • Able to show visible wifi networks
  • Able to show currently connected SSID
  • Able to show current DNS config
  • Able to show known SSIDs and find single network passwords
  • Can save networks as JSON or wpa_supplicant.conf file

Installation

Installed via pip using: pip install wifipasswords

Usage

from wifipasswords import WifiPasswords

passwords = WifiPasswords().get_passwords()
connected_passwords = WifiPasswords().get_currently_connected_passwords()

print(passwords)
print(connected_passwords)

WifiPasswords().save_wpa_supplicant('.', passwords, True, 'GB')

Command Line Usage

Provides a command line interface callable after installation with:

  • python3 -m wifipasswords
  • wifipasswords
    ~ $ wifipasswords

example output

To see command line options run wifipasswords -h

Packaging as EXE

Can be packaged to an EXE on windows with:
pyinstaller --clean --noconsole --onefile -i <icon> wifipasswords_exe.py

The wifipasswords_exe.py file is the same as the main.py file in the package except will pause after console output is finished to prevent the terminal from auto-closing if the EXE is run directly.

Testing

Test locally with pytest -v ./tests Currently github test runners do not have nmcli interface to access wifi data so test locally.

About

Creation date: 10-02-2019
Dependencies: colorama

Licence

Copyright (C) 2019-2022 Joe Campbell
GNU GENERAL PUBLIC LICENSE (GPLv3)

This program is free software: you can redistribute it and / or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see < https: // www.gnu.org/licenses/>.

Metadata

Release files for wifipasswords 0.4.1b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wifipasswords 0.4.1b0
File Size Uploaded
wifipasswords-0.4.1-beta-.tar.gz 27.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wifipasswords 0.4.1b0
File Interpreter ABI Platform
wifipasswords-0.4.1b0-py3-none-any.whl Python 3 none any Details

Total release size: 59.5 kB

Release files / wifipasswords-0.4.1-beta-.tar.gz

Download URL wifipasswords-0.4.1-beta-.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7deb4d3bc774ef0e408e9d6ad438cfc754c51abca7ec3d330b5b5ea1a8448412
BLAKE2b-256 checksum
How to use checksums
6bd9a388d1aa85796152629c1bd8a2612d6553488f13539bd9bbe69638941c6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / wifipasswords-0.4.1b0-py3-none-any.whl

Download URL wifipasswords-0.4.1b0-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82c007ff3c44746736ac04cbe58daf6878b3a28ac591dbc4712c435078276a49
BLAKE2b-256 checksum
How to use checksums
4c84e98bfa6bfd0c60d40e64d19d153aba37299227d460b689ef4aab5212d67b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page