0

In a computer (with windows 10 OS), there are many networks available as shown below (ref: https://www.digitalcitizen.life/how-connect-hidden-wireless-networks-windows-10/):

enter image description here

Now lets say, if I am connected to network "adriano", then is there any way by which I can get this information using python ?

Can anyone please help me out with this ?

Ranjan Pal
  • 307
  • 3
  • 13
  • 1
    Does this answer your question? [How do I get Python to know what Wifi the user is connected to?](https://stackoverflow.com/questions/33227160/how-do-i-get-python-to-know-what-wifi-the-user-is-connected-to) – RJ Adriaansen Aug 11 '21 at 06:15
  • Thanks a lot @RJAdriaansen This has solved my query! – Ranjan Pal Aug 12 '21 at 10:08

1 Answers1

0

this worked for me:

import subprocess

def get_ssid():
    raw_wifi = subprocess.check_output(['netsh', 'WLAN', 'show', 'interfaces'])
    data_strings = raw_wifi.decode('utf-8').split()
    index = data_strings.index('Profile')
    return data_strings[index + 2]
Mark King
  • 1
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 07 '23 at 11:29