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

Is there a way to connect to hidden wireless networks #12

Open
kcahow opened this issue Mar 19, 2015 · 9 comments
Open

Is there a way to connect to hidden wireless networks #12

kcahow opened this issue Mar 19, 2015 · 9 comments
Labels

Comments

@kcahow
Copy link

kcahow commented Mar 19, 2015

We have the requirement to be able to connect to a hidden wireless endpoint, one that is not broadcast. Is this possible right now?

@robinwassen
Copy link
Contributor

Not without modification, but it should be pretty easy if you want to test it. Can't guarantee that it will work though.

I am not sure how connecting to a hidden endpoint is supposed to be implemented, but my guess is that you manually need to specify all the network settings that the OS normally provides when it finds a wireless endpoint.

The modifications you probably need to do to test are:

Change Wifi._client to be a public variable.
Change AccessPoint constructor to public.

Test script part:

Define the access point settings manually

The wireless access point settings are returned by OS as the WlanAvailableNetwork struct, start with manually creating an instance of that one with the following properties specified to match your hidden network:

  • dot11Ssid.SSID
  • dot11Ssid.SSIDLength
  • securityEnabled
  • profileName
  • dot11DefaultCipherAlgorithm
  • dot11BssType

Get your hands on a WlanInterface

Create an instance of Wifi, then you access WiFi_client.Interfaces which is an array of all your wireless network cards. Grab the first one and store in a variable.

Instantiate and connect to AccessPoint

Create an instance of AccessPoint where you pass in the WlanInterface you just retrieved and the WlanAvailableNetwork you defined with your network settings.

Then just run the method Connect() on the AccessPoint and it should connect to the wireless network. If it does not, a ToString() on the AccessPoint should give a hint for the reason.

@kcahow
Copy link
Author

kcahow commented Mar 19, 2015

Thanks,

I will give it a try. I was going down that rout but getting it all messed
up. I will re-try it again tomorrow

Thanks

Ken CaHow

On Thu, Mar 19, 2015 at 4:23 PM, Robin Andersson [email protected]
wrote:

Not without modification, but it should be pretty easy if you want to test
it. Can't guarantee that it will work though.

I am not sure how connecting to a hidden endpoint is supposed to be
implemented, but my guess is that you manually need to specify all the
network settings that the OS normally provides when it finds a wireless
endpoint.

The modifications you probably need to do to test is:

Change Wifi._client
https://github.com/DigiExam/simplewifi/blob/master/SimpleWifi/Wifi.cs#L17
to be a public variable.
Change AccessPoint constructor
https://github.com/DigiExam/simplewifi/blob/master/SimpleWifi/AccessPoint.cs
to public.
Test script part: Define the access point settings manually

The wireless access point settings are returned by OS as the WlanAvailableNetwork
struct
https://github.com/DigiExam/simplewifi/blob/master/SimpleWifi/Win32/Interop/Structs.cs#L31,
start with manually creating an instance of that one with the following
properties specified to match your hidden network:

  • dot11Ssid.SSID
  • dot11Ssid.SSIDLength
  • securityEnabled
  • profileName
  • dot11DefaultCipherAlgorithm
  • dot11BssType

Get your hands on a WlanInterface

Create an instance of Wifi, then you access WiFi_client.Interfaces which
is an array of all your wireless network cards. Grab the first one and
store in a variable.
Instantiate and connect to AccessPoint

Create an instance of AccessPoint where you pass in the WlanInterface you
just retrieved and the WlanAvailableNetwork you defined with your network
settings.

Then just run the method Connect() on the AccessPoint and it should
connect to the wireless network. If it does not, a ToString() on the
AccessPoint should give a hint for the reason.


Reply to this email directly or view it on GitHub
#12 (comment).

@robinwassen
Copy link
Contributor

@kcahow How did your test go?

@aaronczichon
Copy link

How to create an instance of AccessPoint without an constructor? I also trying to connect to a hidden network...

@DMDTT
Copy link

DMDTT commented Jun 20, 2017

Is there any progress?
I always get a Scan_Failed response

`var network = new WlanAvailableNetwork();
network.dot11BssType = Dot11BssType.Infrastructure;
network.Dot11PhyTypes = new Dot11PhyType[] { (Dot11PhyType)7, Dot11PhyType.Any, Dot11PhyType.Any, Dot11PhyType.Any, Dot11PhyType.Any, Dot11PhyType.Any, Dot11PhyType.Any, Dot11PhyType.Any };

        item.SSID = "Test1";
        item.Key = "12345678";
        network.dot11Ssid = new Dot11Ssid
        {
            SSID = Encoding.ASCII.GetBytes(item.SSID),
            SSIDLength = (uint)item.SSID.Length
        };

        network.dot11DefaultAuthAlgorithm = Dot11AuthAlgorithm.RSNA_PSK;
        network.dot11DefaultCipherAlgorithm = Dot11CipherAlgorithm.CCMP;
        network.securityEnabled = true;

        AccessPoint ap = new AccessPoint(new WlanClient().Interfaces.FirstOrDefault(), network);
        network.profileName = item.SSID;
        var authrequest = new AuthRequest(ap);
        authrequest.Password = item.Key;
        bool connected = ap.Connect(authrequest, true);`

with ap.ToString() returning
Interface: WLAN 2\r\nAuth algorithm: RSNA_PSK\r\nCipher algorithm: CCMP\r\nBSS type: Infrastructure\r\nConnectable: False\r\nReason to false: Success\r\n"

@aaronczichon
Copy link

I think the maintainer is no longer supporting this library.

@DMDTT
Copy link

DMDTT commented Jun 20, 2017

@Inoverse did you manage? did you find a workaround?

@aaronczichon
Copy link

Nope. It's over a year ago.
Also don't do .Net anymore. Sorry.

@DMDTT
Copy link

DMDTT commented Jun 21, 2017

see #32

I got it to get it working on our environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants