Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • This is a really good start, but what I'd really like to have is a hash of interfaces and their MACs. Right now I have at least two MACs on my laptop: wireless card and cabled-ethernet.
    • Yeah, this started as a way to uniquely identify a computer... GUID/MessageID sort of thingy
    • #! /usr/bin/perl -w

      use strict;
      use FileHandle();

      MAIN: {
        my ($mac_address) = {};
        if (($^O eq 'linux') || ($^O eq 'solaris') || ($^O eq 'hpux') || ($^O eq 'aix')) {

          $ENV{PATH} = '/sbin:/usr/sbin:/bin:/usr/bin';
          delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};

          my ($ifconfig) = new FileHandle();
          if (my $pid = $ifconfig->open('-|')) {
            my ($buffer);
            unless (defined $ifconfig->read($buffer, 8192)) {