[wplug] Interesting question du jour
Vanco, Donald
VANCOD at PIOS.com
Mon Apr 21 16:19:26 EDT 2003
Lance Tost wrote:
> This should do it... again, invalid for MACs ending in FF.
>
> #!/usr/bin/perl
>
> open (IN, "/tmp/infile") or die "Cannot open file: $!\n";
> open (OUT, ">/tmp/outfile") or die "Cannot open file: $!\n";
>
> while (<IN>) {
> ($host, $mac) = split;
> (undef,undef,undef,undef,undef,$x) = split(':',$mac);
> printf OUT ("%s\t%s\n", $host, $mac);
> $y = sprintf ("%02X\n", (hex $x) + 1);
> $mac =~ s/:.{2}$/:$y/;
> printf OUT ("\t%s\n", $mac);
> }
> close (IN);
> close (OUT);
Getting closer - but it still does goofy things:
This is dorked:
rcas0024 00:09:6B:49:08:2E
00:09:6B:49:08:3
Yet this is OK:
rcas0026 00:09:6B:A3:03:ED
00:09:6B:A3:03:EE
here again:
rcas0029 00:09:6B:63:0B:4B
00:09:6B:63:0B:5
...seems like the "number/letter" combo is not handled correctly
Don
More information about the wplug
mailing list