Skip to main content

Retreive and save all WiFi networks and passwords on the device. Cross platform windows, linux, macOS

Project description

wifipasswords

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)

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.9
  • 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

exampleoutput

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.

To-Do

  • Add macOS Support
  • Improve mac authentication methods
  • Add getters for accessing variables directly
  • Fix visible network, DNS config and number of interfaces for Linux
  • Add automated tests
  • Add method to check and return only the connected SSID name and Password
  • Use nmcli to retrieve passwords on linux rather than reading files (may not require sudo)
  • Multithreading support for windows to imporove execution speed
  • Add support for WPA-Enteprise

About

Creation date: 10-02-2019
Modified date: 30-03-2021
Dependencies: colorama

Licence

Copyright (C) 2019-2021 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/>.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wifipasswords-0.4.0-beta-.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

wifipasswords-0.4.0b0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file wifipasswords-0.4.0-beta-.tar.gz.

File metadata

  • Download URL: wifipasswords-0.4.0-beta-.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

File hashes

Hashes for wifipasswords-0.4.0-beta-.tar.gz
Algorithm Hash digest
SHA256 25c89cd683a3d1b1d2cf60b8e4ba51e4a207913db55a5c1f4424aa22eebe8990
MD5 2358b4062c171c99bb5b19e2b7bca1e1
BLAKE2b-256 01565975fea5f85889a096a8007e01ca8cc58d2b5cbebf65e368c539ee74bb54

See more details on using hashes here.

File details

Details for the file wifipasswords-0.4.0b0-py3-none-any.whl.

File metadata

  • Download URL: wifipasswords-0.4.0b0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

File hashes

Hashes for wifipasswords-0.4.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 148c3af27cc61ba9e97313c49a5d0187503f69682f180478bd80518726e03aac
MD5 c7bd00a6db45f7f410e975c11f833176
BLAKE2b-256 5714d9b1eda092e5e35b2b343400b9aefada9da6ff301ffa6b5a6fd30dfb2ee2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page