You are not logged in.
IMPORTANT! - The MAC Addresses in this post ARE FAKE/MADE UP so the outputs, most likely, WILL NOT suit to what really happened with my case. though it is similar .
the address:
http://10.138/dhcpinfo.html
the chart:
Hostname MAC Address IP Address Expires In
Len45 00:40:CA:B5:5B:06 10.0.0.1 13 minutes, 55 seconds
Len45 00:20:78:d9:5c:b3 10.0.0.2 Expired
PC-MSC 00:a0:cc:7a:7d:6d 10.0.0.3 Expired
I'm tying to follow Trent's explanation without success (I'm NOT saying that it's a bad explanation or anything like that. I'm saying that I'm not skilled enough - n00b:lol:)
this command:
wget http://user:user@10.138/dhcpinfo.html -q -O - | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
output:
10.0.0.1
10.0.0.2
10.0.0.3
this command: (\. changed to (\:
wget http://user:user@10.138/dhcpinfo.html -q -O - | grep -Eo '\<[[:digit:]]{1,3}(\:[[:digit:]]{1,3}){3}\>'
output:
CA:B5:5B:06
I have tried:
wget http://user:user@10.138/dhcpinfo.html -q -O - | grep -Eo '\<[[:digit:]]{1,6}(\:[[:digit:]]{1,6}){1}\>'
and the result was:
CA:B5
5B:06
00:20
00:a0
7d:6d
00:40:CA:B5:5B:06
00:20:78:d9:5c:b3
00:a0:cc:7a:7d:6d
What to do, please.
Thank you, for any help
Last edited by RedArcher (2009-11-07 15:49:59)
Offline
I sent an e-mail to Mr. Trent and he gave me the solution
Here's the relevant part of Trent's reply
For MAC addresses, we have -- let's see -- six pairs of hexadecimal
characters, usually separated by colons. grep(1) tells me that
there's a special notation to match any hex digit in a character
class, [:xdigit:]. So I'll build this pattern from the ground up.First I want to match a hex character:
[[:xdigit:]]
Now I want to match another one:
[[:xdigit:]]{2}
Now I want to match a colon:
[[:xdigit:]]{2}:
Now match that pattern, five times:
([[:xdigit:]]{2}:){5} (The parentheses are for grouping --
without them, the {5} would refer only to the last character.)
Now match another pair of hex characters:
([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}
As a finishing touch, I'm going to make sure the pattern doesn't match
if the first or last numbers could match more than two digits. You
could do this by putting character classes to specify "anything that
isn't an [:xdigit:]" on both sides, like so:
[^[:xdigit:]]([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}[^[:xdigit:]]
But that raises issues if you don't want to discard the characters
just before and after the expression. You could do gymnastics with
parentheses, but it's better to use the word boundary anchor, which
doesn't gobble up a character:
\<([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}\>In this case, I could really use \b instead of \< and \>. That's
because I know the thing "inside" is a word character, so I don't have
to worry about it matching the "wrong kind" of word boundary. In
fact, \b usually serves your needs fine, but when you know where to
put them, \< and \> are more readable.
Now it would be much more easier to track on my router's (10.138) current connected machines ;)
Trent, sir, Thank You so much
Thank you, thank you, thank you.
Offline
well that is fine. you could check also the grep's man page for another way or even if you want (in the future) to use it again.
If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.
Offline