Skip to content

Instantly share code, notes, and snippets.

@drego85
Last active April 29, 2025 18:32
Show Gist options
  • Save drego85/1f6b0ea350ba37dd3646feef49ea13a6 to your computer and use it in GitHub Desktop.
Save drego85/1f6b0ea350ba37dd3646feef49ea13a6 to your computer and use it in GitHub Desktop.
Script for automatic upload of handshakes to Distributed WPA PSK auditor (wpa-sec.stanev.org)
#!/usr/bin/env python3
#
# Script for automatic upload of handshakes captured
# by Pwnagotchi, Flipper Zero or Marauder to
# Distributed WPA PSK auditor (wpa-sec.stanev.org).
#
# The script is progressive, not sending to WPA Sec
# handshaske already analysed.
#
# The script also saves the detected WPA keys locally.
#
# Made with ♥ by Andrea Draghetti
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 3 (the ``GPL'').
#
import os
import time
import hashlib
import requests
# SSIDs of WiFi networks that you do not want to upload to WPA Sec.
# The whitelist is based on file names, so it indicates the first characters of your WiFi network.
list_ssid_whitelist = ["TestSSID", "Example2"]
# WPA Sec Token
wpa_sec_token = ""
# Handshaske path
base_directory = "/root/handshakes/"
def load_analyzed_hash():
list_analyzed_handshakes = []
try:
f = open("hash_handshakes.txt", "r", errors="ignore")
for line in f:
if line:
line = line.rstrip()
list_analyzed_handshakes.append(line)
f.close()
except:
pass
return list_analyzed_handshakes
def save_analyzed_hash(hash):
try:
f = open("hash_handshakes.txt", "a")
f.write(str(hash) + "\n")
f.close()
except:
pass
def is_not_whitelisted_filename(filename, prefixes):
for prefix in prefixes:
filename = filename.lower()
if filename.startswith(prefix.lower()):
return False
return True
def main():
list_analyzed_handshakes = load_analyzed_hash()
for file_name in os.listdir(base_directory):
if file_name.endswith(".pcap"):
if is_not_whitelisted_filename(file_name, list_ssid_whitelist):
file_hash = hashlib.md5(open(base_directory + file_name,"rb").read()).hexdigest()
if file_hash not in list_analyzed_handshakes:
print("[+] Upload: " + file_name)
cookie = {"key": wpa_sec_token}
payload = {"file": open(base_directory + file_name, "rb")}
result = requests.post("https://wpa-sec.stanev.org", cookies=cookie, files=payload, timeout=30)
if result.status_code == 200:
print(result.text)
save_analyzed_hash(file_hash)
time.sleep(.25)
# Download All Found
cookie = {"key": wpa_sec_token}
result = requests.get('https://wpa-sec.stanev.org/?api&dl=1', cookies=cookie)
if result.status_code == 200:
with open("wpa-sec.founds.potfile", "wb") as f:
f.write(result.content)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment