Skip to content

Commit

Permalink
Quick bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DefinetlyNotAI committed Sep 21, 2024
1 parent 64ac82c commit 23cf375
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions CODE/wifi_stealer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
log = Log(debug=DEBUG)


def get_password(ssid: str) -> str or None:
def get_password(ssid: str) -> str:
"""
Retrieves the password associated with a given Wi-Fi SSID.
Expand All @@ -20,13 +20,19 @@ def get_password(ssid: str) -> str or None:
command_output = Actions().run_command(
f'netsh wlan show profile name="{ssid}" key=clear'
)
if command_output is None:
return "None"
key_content = command_output.splitlines()
for line in key_content:
if "Key Content" in line:
return line.split(":")[1].strip()
return None
except Exception as e:
log.error(e)
return "None"
except UnicodeDecodeError as err:
log.error(err)
return "None"
except Exception as err:
log.error(err)
return "None"


def get_wifi_names() -> list:
Expand All @@ -52,13 +58,16 @@ def get_wifi_names() -> list:
wifi_names.append(wifi_name)
log.info(f"Retrieved {len(wifi_names)} Wi-Fi names.")
return wifi_names
except Exception as e:
log.error(e)
except Exception as err:
log.error(err)


with open("WiFi.txt", "w") as file:
for name in get_wifi_names():
log.info(f"Retrieving password for {name.removeprefix(': ')}")
file.write(
f"Name: {name.removeprefix(': ')}, Password: {get_password(name.removeprefix(': '))}\n"
)
try:
log.info(f"Retrieving password for {name.removeprefix(': ')}")
file.write(
f"Name: {name.removeprefix(': ')}, Password: {get_password(name.removeprefix(': '))}\n"

Check failure

Code scanning / CodeQL

Clear-text storage of sensitive information High

This expression stores
sensitive data (password)
as clear text.
)
except Exception as e:
log.error(e)

0 comments on commit 23cf375

Please sign in to comment.