[#64] Addition of Wireshark abbreviations for OUI manufacturers
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
* [#32] Show device layers in Details tab
|
* [#32] Show device layers in Details tab
|
||||||
* [#66] Remove reference to "native" VLAN in code and replace with "untagged"
|
* [#66] Remove reference to "native" VLAN in code and replace with "untagged"
|
||||||
* [#66] DB Schema update to add "native" column to PK of device_port_vlan table
|
* [#66] DB Schema update to add "native" column to PK of device_port_vlan table
|
||||||
|
* [#64] Addition of Wireshark abbreviations for OUI manufacturers
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ use Archive::Extract;
|
|||||||
$Archive::Extract::PREFER_BIN = 1;
|
$Archive::Extract::PREFER_BIN = 1;
|
||||||
use HTTP::Tiny;
|
use HTTP::Tiny;
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
|
use Encode;
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
@@ -168,7 +169,9 @@ sub deploy_oui {
|
|||||||
if ($line =~ m/^\s*(.{2}-.{2}-.{2})\s+\(hex\)\s+(.*)\s*$/i) {
|
if ($line =~ m/^\s*(.{2}-.{2}-.{2})\s+\(hex\)\s+(.*)\s*$/i) {
|
||||||
my ($oui, $company) = ($1, $2);
|
my ($oui, $company) = ($1, $2);
|
||||||
$oui =~ s/-/:/g;
|
$oui =~ s/-/:/g;
|
||||||
$data{lc($oui)} = $company;
|
my $abbrev = shorten($company);
|
||||||
|
$data{lc($oui)}{'company'} = $company;
|
||||||
|
$data{lc($oui)}{'abbrev'} = $abbrev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +179,12 @@ sub deploy_oui {
|
|||||||
$schema->txn_do(sub{
|
$schema->txn_do(sub{
|
||||||
$schema->resultset('Oui')->delete;
|
$schema->resultset('Oui')->delete;
|
||||||
$schema->resultset('Oui')->populate([
|
$schema->resultset('Oui')->populate([
|
||||||
map {{oui => $_, company => $data{$_}}} keys %data
|
map {
|
||||||
|
{ oui => $_,
|
||||||
|
company => $data{$_}{'company'},
|
||||||
|
abbrev => $data{$_}{'abbrev'}
|
||||||
|
}
|
||||||
|
} keys %data
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -185,6 +193,37 @@ sub deploy_oui {
|
|||||||
say 'OUI update complete.';
|
say 'OUI update complete.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This subroutine is from Wireshark's make-manuf
|
||||||
|
# http://anonsvn.wireshark.org/wireshark/trunk/tools/make-manuf
|
||||||
|
sub shorten {
|
||||||
|
my $manuf = shift;
|
||||||
|
|
||||||
|
$manuf = decode "utf8", $manuf, Encode::FB_CROAK;
|
||||||
|
$manuf = " " . $manuf . " ";
|
||||||
|
|
||||||
|
# Remove any punctuation
|
||||||
|
$manuf =~ tr/',.()/ /;
|
||||||
|
|
||||||
|
# & isn't needed when Standalone
|
||||||
|
$manuf =~ s/ \& / /g;
|
||||||
|
|
||||||
|
# Remove any "the", "inc", "plc" ...
|
||||||
|
$manuf
|
||||||
|
=~ s/\s(the|inc|incorporated|plc||systems|corp|corporation|s\/a|a\/s|ab|ag|kg|gmbh|co|company|limited|ltd|holding|spa)(?= )//gi;
|
||||||
|
|
||||||
|
# Convert to consistent case
|
||||||
|
$manuf =~ s/(\w+)/\u\L$1/g;
|
||||||
|
|
||||||
|
# Remove all spaces
|
||||||
|
$manuf =~ s/\s+//g;
|
||||||
|
|
||||||
|
# Truncate all names to a reasonable length, say, 8 characters.
|
||||||
|
# If the string contains UTF-8, this may be substantially more than 8 bytes.
|
||||||
|
$manuf = substr( $manuf, 0, 8 );
|
||||||
|
|
||||||
|
return encode( "utf8", $manuf );
|
||||||
|
}
|
||||||
|
|
||||||
sub deploy_mibs {
|
sub deploy_mibs {
|
||||||
my $mibhome = dir(shift);
|
my $mibhome = dir(shift);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ __PACKAGE__->load_namespaces(
|
|||||||
default_resultset_class => 'ResultSet',
|
default_resultset_class => 'ResultSet',
|
||||||
);
|
);
|
||||||
|
|
||||||
our $VERSION = 32; # schema version used for upgrades, keep as integer
|
our $VERSION = 33; # schema version used for upgrades, keep as integer
|
||||||
|
|
||||||
use Path::Class;
|
use Path::Class;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ __PACKAGE__->add_columns(
|
|||||||
{ data_type => "varchar", is_nullable => 0, size => 8 },
|
{ data_type => "varchar", is_nullable => 0, size => 8 },
|
||||||
"company",
|
"company",
|
||||||
{ data_type => "text", is_nullable => 1 },
|
{ data_type => "text", is_nullable => 1 },
|
||||||
|
"abbrev",
|
||||||
|
{ data_type => "text", is_nullable => 1 },
|
||||||
);
|
);
|
||||||
__PACKAGE__->set_primary_key("oui");
|
__PACKAGE__->set_primary_key("oui");
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE oui ADD COLUMN abbrev text;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
Reference in New Issue
Block a user