Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
share
/
perl5
/
vendor_perl
/
Ocsinventory
/
Agent
/
Backend
/
OS
/
Generic
/
Lsusb
Upload
3 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
Usb.pm
1.66 KB
-rw-r--r--
2024-10-28 14:52:47
Edit
Del
Editing: Usb.pm
(1.66 KB)
Path: /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Lsusb/Usb.pm
Back
package Ocsinventory::Agent::Backend::OS::Generic::Lsusb::Usb; use strict; use Config; use Data::Dumper; my $vendor; my $product; my $interface; my $bus; my $device; my $serial; my $protocol; my $id; sub run { my $params = shift; my $common = $params->{common}; foreach (`lsusb`) { if (/^Bus\s+(\d+)\sDevice\s(\d*):\sID\s(\d+):(\d+)*/i) { next if (grep (/$4/,qw(0001 0002 0024))); $bus=$1; $device=$2; #if (defined $bus && defined $device) { my @detail = `lsusb -v -s $bus:$device 2>/dev/null`; foreach my $d (@detail) { if ($d =~ /^\s*iManufacturer\s*\d+\s*(.*)/i) { $vendor = $1; } elsif ($d =~ /^\s*iProduct\s*\d+\s*(.*)/i) { $product = $1; } elsif ($d =~ /^\s*iSerial\s*\d+\s(.*)/i) { $serial = $1; #} elsif ($d =~ /^\s*bInterfaceProtocol\s*\d\s(.*)/i) { } elsif ($d =~ /^\s*bInterfaceClass\s*\d+\s*(.*)/i) { #$protocol = $1 unless defined $protocol || $1 eq 'None'; $protocol = $1; #} elsif ($d =~ /^\s*iInterface\s*\d\s(\w+)\s(.*)/i){ } elsif ($d =~ /^\s*bInterfaceSubClass\s*\d+\s(.*)/i){ $interface = $1; } } # Add information to $current $common->addUsb({ DESCRIPTION => $product, INTERFACE => $interface, MANUFACTURER => $vendor, SERIAL => $serial, TYPE => $protocol, }); } } } 1;