Sponsored Content
Top Forums Shell Programming and Scripting getting mac from ip (or the contrary) Post 302296594 by chebarbudo on Wednesday 11th of March 2009 11:28:41 AM
Old 03-11-2009
Thanks danmero for helping me.
Unfortunately, I can't use arp (command not found). Maybe because I'm not root.
I found this solution though:
Code:
[[ -n $(mysql "SELECT id FROM terminal WHERE ip = '$ip' AND mac = '$(ssh root@$ip 'cat /sys/class/net/eth0/address')'") ]] && ...

 

We Also Found This Discussion For You

1. OS X (Apple)

Let's get a .mac top level domain! As in www.xyz.mac

ICANN, the Internet Corporation for Assigned Names and Numbers, is inviting proposals for new sponsored top level domains. This may be wishful thinking, but isn't that a chance to push for a .mac top level domain (TLD)? I for one would VASTLY like the idea of having a domain of something.mac --... (0 Replies)
Discussion started by: ropers
0 Replies
Net::Libdnet::Arp(3pm)					User Contributed Perl Documentation				    Net::Libdnet::Arp(3pm)

NAME
Net::Libdnet::Arp - high level API to access libdnet arp_* functions SYNOPSIS
use Net::Libdnet::Arp; my $h = Net::Libdnet::Arp->new; my $mac = $h->get('10.0.0.1'); my $sucess = $h->add('10.0.0.1', '00:11:22:33:44:55'); my $sucess = $h->delete('10.0.0.1', '00:11:22:33:44:55'); my $data; $h->loop(&arp_print, $data); sub arp_print { my ($e, $data) = @_; printf("%s at %s ", $e->{arp_pa}, $e->{arp_ha}); } DESCRIPTION
This modules is a higher level abstraction for libdnet arp_* functions. METHODS
new () Returns an object to access arp cache table on success, undef otherwise. get (scalar) Returns the mac address of specified IP address, undef otherwise. add (scalar, scalar) Adds an entry to arp cache table. Returns 1 on success, undef otherwise. First parameter is the IP address, second is the mac address. delete (scalar, scalar) Deletes an entry from arp cache table. Returns 1 on success, undef otherwise. First parameter is the IP address, second is the mac address. loop (subref, [ scalarref ]) Calls the specified sub ref for each entry in the arp cache table. The second optional parameter is a scalar ref, to store state information (if any). AUTHOR
Patrice <GomoR> Auffret COPYRIGHT AND LICENSE
You may distribute this module under the terms of the BSD license. See LICENSE file in the source distribution archive. Copyright (c) 2008-2011, Patrice <GomoR> Auffret perl v5.14.2 2011-10-15 Net::Libdnet::Arp(3pm)
All times are GMT -4. The time now is 12:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy