Wifi router options via C++

Hey,
just a simple question. Is there a way to access the router settings via c++? My friend wanted me to write something that would turn off wifi broadcasting on his router when pressing the button in the program.
The only way I can think about is to connect to the router via .net framework and then use reverse engineering (on the router settings site) to find a way how to simulate change of option via POST or GET method.
Is there any other better way?
Thanks

PS: Or maybe to turn off the whole router would be ok too. Any suggestions how to do that?
Last edited on
It depends on the router.

But yes, you'd start by doing a network trace on a good conversation and replicating that in your system of choice.
Thanks for the fast reply.
I would love to see some code of this if you guys have a bit of source. Very curious as to how this works.
I would use WebRequest() from .net, look for it on MSDN help.
It's not problem to login, but then you have to know what to send to the router. I am not sure how to recognize that. Never did reverse engineering before.
Maybe I will experiment a bit with Firebug.
Last edited on
So I am back with a solution.
I found most of the resources in c# so I used that. It is really simple using .net. In this example I want to change my SSID name. Here is the code:

1
2
3
4
5
6
7
8
static void turnOff()
{
var request = (HttpWebRequest)WebRequest.Create("http://192.168.1.1/userRpm/WlanNetworkRpm.htm?ssid=changedName");

request.Credentials = new NetworkCredential("name", "pass");

var response = (HttpWebResponse)request.GetResponse();
}


I had to examine how does the router options page send data after saving the changes.
Used browser plugin called Firebug. I found that it uses GET method to post the parameters which can be written like a link with some additional info.
In our case like this: http://192.168.1.1/userRpm/WlanNetworkRpm.htm?ssid=changedName
So this is all I need. Then just use simple .net functions for connecting to the router and send this link with the parameters I wanna change.

I guess there are many ways to avoid using .net especially in c++ but this is simple and fast.
Topic archived. No new replies allowed.