| Server IP : 185.88.153.241 / Your IP : 216.73.217.115 Web Server : LiteSpeed System : Linux server312.bertina.biz 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 User : ( 1405) PHP Version : 7.0.33 Disable Function : mail, apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, exec, fp, highlight_file, ini_alter, ini_restore, inject_code, mysql_pconnect, openlog, passthru, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,dl,leak,crack_check,crack_closedict,crack_getlastmessage,crack_opendict,symlink,link,escapeshellarg,parse_ini_file, ln, show_source, pclose, parse_perms, mysql_list_dbs,stream_select,mysql_list_dbs,socket_select,socket_create,socket_create_listen,socket_create_pair,socket_listen,socket_accept,socket_bind,socket_strerror,socket_clear_error,socket_close,socket_connect,socket_get_option,socket_getpeername,socket_getsockname,socket_last_error,socket_read,socket_recv,socket_recvfrom,socket_send,socket_sendto,socket_set_block,socket_set_nonblock,socket_set_option,socket_shutdown,socket_write,readlink,pfsockopen,pcntl_exec,pcntl_fork,pcntl_signal,pcntl_waitpid,pcntl_wexitstatus, pcntl_wifexited, pcntl_wifsignaled, pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,fpassthru, posix_access, posix_ctermid, posix_errno, posix_get_last_error, posix_getcwd, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgrp, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_initgroups, posix_isatty, posix_mknod, posix_setegid, posix_seteuid, posix_strerror, posix_times, posix_ttyname, diskfreespace, disk_free_space, disk_total_space, sys_getloadavg,get_current_user MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib/python2.7/site-packages/ |
Upload File : |
#
# Copyright (c) 1999--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
""" Query hwdata database and return decription of vendor and/or device. """
class USB:
""" Interace to usb.ids from hwdata package """
filename = '/usr/share/hwdata/usb.ids'
devices = None
def __init__(self, filename=None):
""" Load pci.ids from file to internal data structure.
parameter 'filename' can specify location of this file
"""
if filename:
self.filename = filename
else:
self.filename = USB.filename
self.cache = 1
if self.cache and not USB.devices:
# parse usb.ids
USB.devices = {}
for line in open(self.filename).readlines():
l = line.split()
if line.startswith('#'):
if line.startswith('# List of known device classes, subclasses and protocols'):
break # end of database of devices, rest is protocols, types etc.
else:
continue
elif len(l) == 0:
continue
elif line.startswith('\t\t'):
interface_id = l[0].lower()
if len(l) > 2:
interface_name = ' '.join(l[1:])
else:
interface_name = ''
USB.devices[vendor][1][device][0][interface_id] = interface_name
elif line.startswith('\t'):
device = l[0].lower()
device_name = ' '.join(l[1:])
USB.devices[vendor][1][device] = [device_name, {}]
else:
vendor = l[0].lower()
vendor_name = ' '.join(l[1:])
if vendor not in USB.devices:
USB.devices[vendor] = [vendor_name, {}]
else: # this should not happen
USB.devices[vendor][0] = vendor_name
def get_vendor(self, vendor):
""" Return description of vendor. Parameter is two byte code in hexa.
If vendor is unknown None is returned.
"""
vendor = vendor.lower()
if self.cache:
if vendor in USB.devices:
return USB.devices[vendor][0]
else:
return None
else:
raise # not implemented yet
def get_device(self, vendor, device):
""" Return description of device. Parameters are two byte code variables in hexa.
If device is unknown None is returned.
"""
vendor = vendor.lower()
device = device.lower()
if self.cache:
if vendor in USB.devices:
if device in USB.devices[vendor][1]:
return USB.devices[vendor][1][device][0]
else:
return None
else:
return None
else:
raise # not implemented yet
class PCI:
""" Interace to pci.ids from hwdata package """
filename = '/usr/share/hwdata/pci.ids'
devices = None
def __init__(self, filename=None):
""" Load pci.ids from file to internal data structure.
parameter 'filename' can specify location of this file
"""
if filename:
self.filename = filename
else:
self.filename = PCI.filename
self.cache = 1
if self.cache and not PCI.devices:
# parse pci.ids
pcirec = {}
PCI.devices = {}
for line in open(self.filename).readlines():
l = line.split()
if line.startswith('#'):
continue
elif len(l) == 0:
continue
elif line.startswith('\t\t'):
continue
elif line.startswith('\t'):
device = l[0].lower()
device_name = ' '.join(l[1:])
PCI.devices[vendor][1][device] = device_name
else:
vendor = l[0].lower()
vendor_name = ' '.join(l[1:])
if not vendor in list(PCI.devices.keys()):
PCI.devices[vendor] = [vendor_name, {}]
else: # this should not happen
PCI.devices[vendor][0] = vendor_name
def get_vendor(self, vendor):
""" Return description of vendor. Parameter is two byte code in hexa.
If vendor is unknown None is returned.
"""
vendor = vendor.lower()
if self.cache:
if vendor in list(PCI.devices.keys()):
return PCI.devices[vendor][0]
else:
return None
else:
raise # not implemented yet
def get_device(self, vendor, device):
""" Return description of device. Parameters are two byte code variables in hexa.
If device is unknown None is returned.
"""
vendor = vendor.lower()
device = device.lower()
if self.cache:
if vendor in list(PCI.devices.keys()):
if device in list(PCI.devices[vendor][1].keys()):
return PCI.devices[vendor][1][device]
else:
return None
else:
return None
else:
raise # not implemented yet