This project is a Python-based script that simulates keyboard actions to extract saved Wi-Fi passwords on a Windows machine. The script uses PowerShell commands to list and retrieve passwords, stores the information in a text file (pws.txt
), and then moves the file to a specified directory.
This project mimics the behavior of a "Rubber Ducky" — a USB device that acts like a keyboard to perform automated tasks on a computer. In this case, the task is to retrieve stored Wi-Fi passwords on the machine using netsh wlan
and PowerShell commands, and save them in a .txt
file, which can then be moved to another directory.
- Python 3.x
- Python packages:
keyboard
time
os
getpass
Install the required Python libraries:
pip install keyboard
Clone the repository to your local machine:
git clone https://github.com/yourusername/rubber-ducky-wifi-extractor.git
Navigate to the project directory:
cd rubber-ducky-wifi-extractor
Install the required Python libraries:
pip install -r requirements.txt
Ensure that Python and PowerShell are installed on your machine and that Python is added to your system’s PATH.
The script simulates the following sequence of events:
- Opens the Windows Run dialog using the Windows + R shortcut or Normal application.
- Opens a PowerShell session by typing "pwsh" (if PowerShell is installed).
- Changes the directory to 'Pictures' (can be changed if needed).
- Executes a PowerShell command (netsh wlan show profile) to get the Wi-Fi profiles stored on the system.
- For each Wi-Fi profile, it retrieves the password by extracting the Key Content from the netsh command output.
- The extracted profiles and passwords are saved in a file (pws.txt).
- The file is moved to the D: drive as specified (NOTE: The name of the disk needs to be changed depending on the user usb name).
- The PowerShell window is closed using Alt + F4.
To run the script, follow these steps:
- Copy the script into a USB drive.
- Ensure you have keyboard and other required libraries installed.
- Run the Python script:
python3 rubber_ducky_wifi_extractor.py
- After execution, the Wi-Fi profile details and passwords will be stored in pws.txt, which will be moved to the D: drive (or any directory you specify).
- Admin Privileges: Running the script on a system without admin privileges will result in failure to access Wi-Fi profiles.
- Keyboard Timing: If the system is slow, you may need to adjust the sleep timers for different parts of the script.