Recent

Author Topic: [CLOSED] Connect to access point from Windows  (Read 5460 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 951
[CLOSED] Connect to access point from Windows
« on: October 26, 2021, 03:10:49 pm »
Anyone got some pointers or code on how to connect to a Wifi AP?

Thanks.
« Last Edit: November 04, 2021, 12:28:56 pm by pcurtis »
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #1 on: November 01, 2021, 04:37:58 pm »
500 hits and not even a hint  :(

Probably the Holly Grail of programming.
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Connect to access point from Windows
« Reply #2 on: November 02, 2021, 12:52:34 pm »
You'll probably have to look at the Native Wifi API provided by Windows.

Probably the Holly Grail of programming.

Mainly that nobody has a need for it as the WiFi is usually set up by the user and applications are not supposed to touch it.

Zvoni

  • Hero Member
  • *****
  • Posts: 2330
Re: Connect to access point from Windows
« Reply #3 on: November 02, 2021, 01:03:39 pm »
You'll probably have to look at the Native Wifi API provided by Windows.

Probably the Holly Grail of programming.

Mainly that nobody has a need for it as the WiFi is usually set up by the user and applications are not supposed to touch it.
Nevermind that a WiFi AP (=Access Point) is basically just a "wide range" Antenna, extending your WiFi-Router and/or controlled by a Wifi-controller.
It has everything to do with networking and nothing to do with any Apps/Programs requiring networking.
Though, i admit there are exceptions to the rule, GoPro's QuikCapture comes to mind (GoPro's own App for iPad/Tablet/Whatever) where you can directly connect to your camera from within the app, using Bluetooth, Wifi, whatever's available
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #4 on: November 02, 2021, 03:58:52 pm »
I just want to learn how to do it with the API
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Connect to access point from Windows
« Reply #5 on: November 02, 2021, 05:13:08 pm »
Mainly that nobody has a need for it as the WiFi is usually set up by the user and applications are not supposed to touch it.

Or at least nobody respectable.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #6 on: November 02, 2021, 05:44:51 pm »
Why aren't I respectable?
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Connect to access point from Windows
« Reply #7 on: November 02, 2021, 06:00:37 pm »
Why aren't I respectable?

Well, you aren't doing it yet so there's still hope for you :-)

On a more serious note: it's the sort of thing that a black-hat hacker, or somebody who's taken Google's shilling, would do. Even on Linux, where configuration facilities are arguably more accessible, it generally requires admin rights... in part to prevent one messing up the local system's configuration, in part to prevent one making oneself unpopular with the neighbours, and in part to prevent one from inspecting credentials that might have already been set up.

I grant there are corner cases: for example, if one were experimenting with a novel alternative to QR codes or similar as a means of granting temporary access.

It used to be possible to do lots of clever things with the Windows "net" program (i.e. "net use" etc.): is there anything relevant there?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #8 on: November 02, 2021, 08:06:29 pm »
If I wanted to do "abnormal things" I would use KALI Linux. I have other reasons.
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Connect to access point from Windows
« Reply #9 on: November 02, 2021, 10:01:54 pm »
Well, you need to find out if the host has a WiFi port. If it does, see if it is available. Bind it to a socket and you can treat it like any other one.

That you get so few reactions is simply, that in almost all cases the OS and driver do this for you. It's just a socket that connects you to the network. You might have different "routes" for the network traffic to follow, like an Ethernet cable or a WiFi connection, but that is transparent to the software and can change.

Often, the only way to distinguish them is if they both connect to a different network with a different IP address range.

So, essentially, you're asking either:

1. Can I write a driver for a WiFi interface in FPC?
2. Can I capture and take over the communication to and from some WiFi hardware with a program written in FPC?

The answer to both questions is "yes". But for the second, you have to study specific adapters and their drivers and see how you can worm your way in, which has nothing to do with the programming language used. It has more to do with knowing how to disassemble code and how to use a debugger. And knowing the strengths and weaknesses of the various methods used.

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #10 on: November 02, 2021, 10:18:08 pm »
So if I am to understand there is no, for example, a call to a function (simplified) CONNECT(ssid, pass, protocol, ...)
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Connect to access point from Windows
« Reply #11 on: November 02, 2021, 10:28:41 pm »
So if I am to understand there is no, for example, a call to a function (simplified) CONNECT(ssid, pass, protocol, ...)

I think there will be a separate authentication stage, which is where the SSID etc. come into play. This will be very much OS-specific.

Once authentication to the access point has been completed, you will need to find what routing is available using DHCP etc., multiple APs can front a single network/router. The APIs might be OS-specific, even if the concepts aren't.

Once you've sorted out both authentication and routing, you should be able to use standard networking facilities.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Connect to access point from Windows
« Reply #12 on: November 02, 2021, 10:33:39 pm »
Quote
I think there will be a separate authentication stage, which is where the SSID etc. come into play. This will be very much OS-specific.

And this is what I am after
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

Zvoni

  • Hero Member
  • *****
  • Posts: 2330
Re: Connect to access point from Windows
« Reply #13 on: November 02, 2021, 10:38:24 pm »
Well, in that case, if everything else fails, my first step would be to hunt down the source-code for „wpa—supplicant“ (or whatever its name)
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: Connect to access point from Windows
« Reply #14 on: November 02, 2021, 10:51:22 pm »
So if I am to understand there is no, for example, a call to a function (simplified) CONNECT(ssid, pass, protocol, ...)

Well there is a function WLanConnect which takes an WLAN_CONNECTION_PARAMETERS in which you can specify a profile.

A profile can either be system internal or a path to an just an XML file that contains all the relevant information of the network (SSID, encryption, etc.). Further information: Link

 

TinyPortal © 2005-2018