Skip to content

Support for hidden SSIDs #36

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

Open
wants to merge 6 commits into
base: master
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
Expand Up @@ -3,3 +3,4 @@ build/
dist/
*.egg-info/
*.pyc
.idea/
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ various contributors
- Thomas Bell https://github.com/bell345
- William Gaylord https://github.com/chibill
- Tucker Kern https://github.com/mill1000
- Shiyue Liu https://github.com/iceananas
5 changes: 5 additions & 0 deletions pywifi/_wifiutil_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def add_network_profile(self, obj, params):
obj['name'],
'SET_NETWORK {} psk \"{}\"'.format(network_id, params.key))

if params.hidden:
self._send_cmd_to_wpas(
obj['name'],
'SET_NETWORK {} scan_ssid {}'.format(network_id, 1))

return params

def network_profiles(self, obj):
Expand Down
1 change: 1 addition & 0 deletions pywifi/iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def network_profiles(self):
self._logger.info("\tauth: %s", profile.auth)
self._logger.info("\takm: %s", profile.akm)
self._logger.info("\tcipher: %s", profile.cipher)
self._logger.info("\thidden: %s", profile.hidden)

return profiles

Expand Down
1 change: 1 addition & 0 deletions pywifi/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self):
self.ssid = None
self.bssid = None
self.key = None
self.hidden = False

def process_akm(self):

Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
from distutils.core import setup

setup(
name='pywifi',
version='1.1.10',
author='Jiang Sheng-Jhih',
author_email='[email protected]',
name='pywifimotius',
version='1.2',
author='Shiyue Liu',
author_email='[email protected]',
description="A cross-platform module for manipulating WiFi devices.",
packages=find_packages(),
install_requires=[
'comtypes'
],
url='https://github.com/awkman/pywifi',
url='https://github.com/motius/pywifi',
license='MIT',
download_url='https://github.com/awkman/pywifi/archive/master.zip',
download_url='https://github.com/motius/pywifi/archive/master.zip',
classifiers=[
'Intended Audience :: Developers',
'Topic :: Utilities',
Expand Down
29 changes: 29 additions & 0 deletions tests/pywifi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,35 @@ def test_connect_open():
assert iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]

def test_connect_hidden():
wifi = pywifi.PyWiFi()

iface = wifi.interfaces()[0]

iface.disconnect()
time.sleep(1)
assert iface.status() in \
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]

profile = pywifi.Profile()
profile.ssid = 'hiddentestap'
profile.auth = const.AUTH_ALG_OPEN
profile.akm.append(const.AKM_TYPE_NONE)
profile.hidden = True

iface.remove_all_network_profiles()
tmp_profile = iface.add_network_profile(profile)

iface.connect(tmp_profile)
time.sleep(40)
assert iface.status() == const.IFACE_CONNECTED

iface.disconnect()
time.sleep(1)
assert iface.status() in \
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]


def test_disconnect():

wifi = pywifi.PyWiFi()
Expand Down