Accessing your router

How could I lookup mac addresses on my DHCP table on my router? Maybe by using something similar to this? And then just search for text on the page with the table.

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google

EthernetClient client;

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);

  delay(1000);

  Serial.println("connecting...");

  if (client.connect(server, 80)) {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;)
      ;
  }
}

Router IP is not google ofc. + I would need a piece of code to send my username and password to the router so I can gain access.
Any ideas on how to get started with this?

Is it even possible to access your router this way?

I had the same problem with you.
For 2 days I tried to connect the arduino with the router to take the internet ip address.
Finally I find the solution.

You need the web browser and an other program like the WIRESHARK.
The wireshark capture the ethernet port of your pc and make analysis of the packets.
After the installation of the wireshark and running, you go to your browser and make connection to the router.
When the browser ask you the name and password, you will inserted and send to router.
Next look for the wireshark at the captured data, when it stops you close the connection.
Now is the hard way to find the next data.

"
GET /xxxxx.html HTTP/1.1 ← the xxxxx is the accessing secure page that you want to access
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, /
Accept-Language: el,en-GB;q=0.8,en-US;q=0.5,el-GR;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;
Accept-Encoding: gzip, deflate
Host: xxx.xxx.xxx.xxx ← this is the ip of the router
Connection: Keep-Alive
Authorization: Basic _______________________ ← at this point is the user name and password encrypted
"
I use the Mozilla.

Then you take the previous data and insert to the arduino code.

And all the program will be like this:
"
#include <Ethernet.h>
#include <SPI.h>

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192, 168, 1, 177 };
byte server = { 192, 168, 1, 1 };

EthernetClient Client;

void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
Serial.println(Ethernet.localIP());
delay(1000);

Serial.println(“connecting…”);

if (Client.connect(server, 80))
{
Serial.println(“connected”);

Client.println(“GET /xxxxx.html HTTP/1.1”);
Client.println(“Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, *”);
Client.println(“Accept-Language: el,en-GB;q=0.8,en-US;q=0.5,el-GR;q=0.3”);
Client.println(“User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;”);
Client.println(“Accept-Encoding: gzip, deflate”);
Client.println(“Host: 192.168.1.177”);
Client.println(“Connection: Keep-Alive”);
Client.println(“Authorization: Basic _______________”);

Client.println();
}
else
{
Serial.println(“connection failed”);
}
}

void loop()
{
if (Client.available()) {
char c = Client.read();
Serial.print(c);
}

if (!Client.connected()) {
Serial.println();
Serial.println(“disconnecting.”);
Client.stop();
for(;;);
}
}
"

You send to arduino and then look at serial monitor.
The arduino will send all the data from the router,
And somewhere will be the internet address of the router.
Something like this:
"

Connected 0d:00h:01m:05s xxx.xxx.xxx.xxx " The xxx.xxx.xxx.xxx is what you want.

Authorization: Basic _______________________ ← at this point is the user name and password encrypted

No, it’s not encrypted, it’s just Base64 encoded. This is just to ensure that all header data is pure ASCII data. The string construction is no secret: base64_encode(“username:password”). Google for base64 and you’ll find lot’s of code that does that for you.