Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > get ip from mac

Reply
Thread Tools

get ip from mac

 
 
Tom Anderson
Guest
Posts: n/a
 
      07-23-2008
On Wed, 23 Jul 2008, Roedy Green wrote:

> On Wed, 23 Jul 2008 00:28:01 +0100, Tom Anderson
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> said :
>
>>> He then knows the MAC through some mysterious means.

>>
>> Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.

>
> That is how you find out your OWN MAC. The way he found out the remote
> MAC required some unspecified fiddle to get the machine to reveal it to
> the outside world, perhaps via a human on the telephone.


Yes, that's what i was thinking. It could be a bit more automatic than a
technician with a phone, but that would also work. If he's only monitoring
a small number of machines, it might even be the easiest way to do it.

> The MAC is confidential in the sense the Java Applet sandbox will IIRC
> not let you find out the MAC of your own machine and tattle to another
> machine, unless you sign the applet.


That's certainly true.

But it is possible to do it without running *any code at all* on the
remote machine - you can get the remote machine's MAC address from your
own local ARP cache.

Here's a script to do it under unix:

#! /bin/bash
addr=$1
arp -a | grep $addr | cut -d " " -f 4

I've called it getmac - here it is in action:

cramerlab$ getmac mrclmcb174.mcbl.ucl.ac.uk
0:d:93:40:b1:e6

You do need to have the remote machine in your ARP cache, which means
either pinging it somehow, or waiting for it to advertise itself.

tom

--
We can only see a short distance ahead, but we can see plenty there that
needs to be done. -- Alan Turing
 
Reply With Quote
 
 
 
 
BigZero
Guest
Posts: n/a
 
      07-23-2008
On Jul 23, 6:05*pm, Tom Anderson <(E-Mail Removed)> wrote:
> On Wed, 23 Jul 2008, Roedy Green wrote:
> > On Wed, 23 Jul 2008 00:28:01 +0100, Tom Anderson
> > <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> > said :

>
> >>> He then knows the MAC through some mysterious means.

>
> >> Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.

>
> > That is how you find out your OWN MAC. The way he found out the remote
> > MAC required some unspecified fiddle to get the machine to reveal it to
> > the outside world, perhaps via a human on the telephone.

>
> Yes, that's what i was thinking. It could be a bit more automatic than a
> technician with a phone, but that would also work. If he's only monitoring
> a small number of machines, it might even be the easiest way to do it.
>
> > The MAC is confidential in the sense the Java Applet sandbox will IIRC
> > not let you find out the MAC of your own machine and tattle to another
> > machine, unless you sign the applet.

>
> That's certainly true.
>
> But it is possible to do it without running *any code at all* on the
> remote machine - you can get the remote machine's MAC address from your
> own local ARP cache.
>
> Here's a script to do it under unix:
>
> #! /bin/bash
> addr=$1
> arp -a | grep $addr | cut -d " " -f 4
>
> I've called it getmac - here it is in action:
>
> cramerlab$ getmac mrclmcb174.mcbl.ucl.ac.uk
> 0:d:93:40:b1:e6
>
> You do need to have the remote machine in your ARP cache, which means
> either pinging it somehow, or waiting for it to advertise itself.
>
> tom
>
> --
> We can only see a short distance ahead, but we can see plenty there that
> needs to be done. -- Alan Turing


Well this script not worked for me
it gives error arp: command not found
i try this on the Linux 2.6.11-1.1369_FC4 i686 athlon i386 GNU/Linux


Thanks
VM
 
Reply With Quote
 
 
 
 
Tom Anderson
Guest
Posts: n/a
 
      07-23-2008
On Wed, 23 Jul 2008, BigZero wrote:

> On Jul 23, 6:05*pm, Tom Anderson <(E-Mail Removed)> wrote:
>
>> But it is possible to do it without running *any code at all* on the
>> remote machine - you can get the remote machine's MAC address from your
>> own local ARP cache.
>>
>> Here's a script to do it under unix:
>>
>> #! /bin/bash
>> addr=$1
>> arp -a | grep $addr | cut -d " " -f 4

>
> Well this script not worked for me
> it gives error arp: command not found
> i try this on the Linux 2.6.11-1.1369_FC4 i686 athlon i386 GNU/Linux


I would guess the arp command isn't on your path. It is on my Mac, but
i've just tried on a linux box (i think it's Debian), and it isn't on
that.

So, instead, find your arp command and invoke it with its full path.
Mine's at:

/usr/sbin/arp

If yours isn't, try:

locate */arp

And look for likely candidates.

tom

--
We can only see a short distance ahead, but we can see plenty there that
needs to be done. -- Alan Turing
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image quality on .mac (dot mac) eyalnevo@gmail.com Digital Photography 4 05-16-2006 03:07 PM
Vertical Gap between DIVs in Opera 8.5 Mac + IE 5.2 Mac mangm HTML 2 12-01-2005 12:48 PM
mac!! mac!!! * * * Y o u r . S h e p h e r d . A q u i l a . D e u s . ( d 2 0 0 5 x x , d 2 0 0 4 x x , d 2 0 0 Computer Support 7 06-03-2005 12:48 AM
Senseless rendering: Mac.Mozilla != Mac.Netscape6.01 ?!?! Roman =?ISO-8859-15?Q?Bl=F6th?= HTML 1 07-02-2003 10:23 AM



Advertisments