From 59bb018b8fbeb855b601ba84111d6d0c8dc648c7 Mon Sep 17 00:00:00 2001 From: puria-asr Date: Sun, 9 Apr 2023 21:53:06 +0430 Subject: [PATCH 1/3] fix a bug and add text file --- index.txt | 3 +++ windows10-wifi.py | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 index.txt diff --git a/index.txt b/index.txt new file mode 100644 index 0000000..9ec0d87 --- /dev/null +++ b/index.txt @@ -0,0 +1,3 @@ +netsh wlan show profiles // for show the wifi +netsh wlan show profiles Redmi // for al information +netsh wlan show profiles Redmi key=clear// for all information (password) \ No newline at end of file diff --git a/windows10-wifi.py b/windows10-wifi.py index 7e6ecea..f8a22e6 100644 --- a/windows10-wifi.py +++ b/windows10-wifi.py @@ -1,9 +1,3 @@ -#! py -###################################### -#Copyright of David Bombal, 2021 # -#https://www.davidbombal.com # -#https://www.youtube.com/davidbombal # -###################################### # Import subprocess so we can use system commands. import subprocess @@ -24,7 +18,7 @@ # To do this we specify the second argument as capture_output = True. # This information gets stored in the stdout attribute as bytes and # needs to be decoded before being used as a String in Python. -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('iso-8859-1') # We imported the re module to make use of regular expressions. # We want to find all the wifi names which are listed after @@ -47,7 +41,7 @@ # We can now run a more specific command to see the information # about the wifi connection and if the Security key # is not absent it may be possible to get the password. - 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('iso-8859-1') # We use the regular expression to only look for the absent cases so we can ignore them. if re.search("Security key : Absent", profile_info): continue @@ -56,7 +50,7 @@ wifi_profile["ssid"] = name # These cases aren't absent and we should run the # "key=clear" command part to get the password. - 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('iso-8859-1') # Again run the regular expression to capture the # group after the : (which is the password). password = re.search("Key Content : (.*)\r", profile_info_pass) From 9d5620448da18d00858b508de365539f9782b331 Mon Sep 17 00:00:00 2001 From: Pouria Asrzad Date: Mon, 1 May 2023 09:29:12 +0330 Subject: [PATCH 2/3] Update windows10-wifi.py --- windows10-wifi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows10-wifi.py b/windows10-wifi.py index f8a22e6..2a978ab 100644 --- a/windows10-wifi.py +++ b/windows10-wifi.py @@ -64,7 +64,7 @@ wifi_profile["password"] = password[1] # We append the wifi information to the variable wifi_list. wifi_list.append(wifi_profile) - -for x in range(len(wifi_list)): +#bug fixed with iso-8859-1 +for x in range(len(wifi_list)): print(wifi_list[x]) From c61616a4a8c968227d58fc313e79feffc333bc4d Mon Sep 17 00:00:00 2001 From: Pouria Asrzad Date: Thu, 6 Jul 2023 00:25:15 +0330 Subject: [PATCH 3/3] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0ad39e --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# red-python-scripts