[CLOSED] Connect to access point from Windows lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- pcurtis · 2021-10-26 13:10 Anyone got some pointers or code on how to connect to a Wifi AP? Thanks. ---------------------------------------------------------------------- pcurtis · 2021-11-01 15:37 500 hits and not even a hint  Probably the Holly Grail of programming. ---------------------------------------------------------------------- PascalDragon · 2021-11-02 11:52 You'll probably have to look at the Native Wifi API provided by Windows. Quote from: pcurtis on November 01, 2021, 04:37:58 pmProbably 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 · 2021-11-02 12:03 Quote from: PascalDragon on November 02, 2021, 12:52:34 pmYou'll probably have to look at the Native Wifi API provided by Windows. Quote from: pcurtis on November 01, 2021, 04:37:58 pmProbably 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 ---------------------------------------------------------------------- pcurtis · 2021-11-02 14:58 I just want to learn how to do it with the API ---------------------------------------------------------------------- MarkMLl · 2021-11-02 16:13 Quote from: PascalDragon on November 02, 2021, 12:52:34 pmMainly 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 ---------------------------------------------------------------------- pcurtis · 2021-11-02 16:44 Why aren't I respectable? ---------------------------------------------------------------------- MarkMLl · 2021-11-02 17:00 Quote from: pcurtis on November 02, 2021, 05:44:51 pmWhy 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 ---------------------------------------------------------------------- pcurtis · 2021-11-02 19:06 If I wanted to do "abnormal things" I would use KALI Linux. I have other reasons. ---------------------------------------------------------------------- SymbolicFrank · 2021-11-02 21:01 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 · 2021-11-02 21:18 So if I am to understand there is no, for example, a call to a function (simplified) CONNECT(ssid, pass, protocol, ...) ---------------------------------------------------------------------- MarkMLl · 2021-11-02 21:28 Quote from: pcurtis on November 02, 2021, 10:18:08 pmSo 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 ---------------------------------------------------------------------- pcurtis · 2021-11-02 21:33 QuoteI 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 ---------------------------------------------------------------------- Zvoni · 2021-11-02 21:38 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) ---------------------------------------------------------------------- Warfley · 2021-11-02 21:51 Quote from: pcurtis on November 02, 2021, 10:18:08 pmSo 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 ---------------------------------------------------------------------- MarkMLl · 2021-11-03 10:16 Quote from: pcurtis on November 02, 2021, 10:33:39 pmQuoteI 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 I was trying to emphasise that APs are, generally speaking, much more than ' just a "wide range" Antenna', and that they can't be relied on to be controllable with the standard "Berkeley-like" sockets API. Anyway, as a forum user I'm glad to see that a couple of people have contributed focussed answers: I didn't mention wpa_supplicant myself since I think you hinted that you were interested in Windows, although I suppose it might have been relevant since it indicated the range of parameters applicable. But I still feel that broadly speaking it's not something that an app would get involved with. Even the sort of stuff which I write, but gets pretty weird on occasion. MarkMLl ---------------------------------------------------------------------- pcurtis · 2021-11-03 10:52 Thanks