Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class ReadelfSections(Readelf):
def readelf_options(self):
return ['--sections']
class ReadelfSymbols(Readelf):
def readelf_options(self):
return ['--symbols']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'DYNSYM', 'SYMTAB'}
class ReadelfRelocs(Readelf):
def readelf_options(self):
return ['--relocs']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'REL', 'RELA'}
class ReadelfDynamic(Readelf):
def readelf_options(self):
return ['--dynamic']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'DYNAMIC'
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'REL', 'RELA'}
class ReadelfDynamic(Readelf):
def readelf_options(self):
return ['--dynamic']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'DYNAMIC'
class ReadelfNotes(Readelf):
def readelf_options(self):
return ['--notes']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'NOTE'
class RedaelfVersionInfo(Readelf):
def readelf_options(self):
return ['--version-info']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'VERDEF', 'VERSYM', 'VERNEED'}
class ReadelfFileHeader(Readelf):
def readelf_options(self):
return ['--file-header']
class ReadelfProgramHeader(Readelf):
def readelf_options(self):
return ['--program-header']
class ReadelfSections(Readelf):
def readelf_options(self):
return ['--sections']
class ReadelfSymbols(Readelf):
def readelf_options(self):
return ['--symbols']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'DYNSYM', 'SYMTAB'}
class ReadelfRelocs(Readelf):
def readelf_options(self):
return ['--relocs']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'REL', 'RELA'}
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'DYNAMIC'
class ReadelfNotes(Readelf):
def readelf_options(self):
return ['--notes']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'NOTE'
class RedaelfVersionInfo(Readelf):
def readelf_options(self):
return ['--version-info']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'VERDEF', 'VERSYM', 'VERNEED'}
class ReadelfDebugDump(Readelf):
def __new__(cls, *args, **kwargs):
# Find the section group from the class name
debug_section_group = cls.__name__[len('ReadelfDebugDump_'):]
if debug_section_group:
return ReadelfDebugDump(debug_section_group, *args, **kwargs)
return super(Readelf, cls).__new__(cls)
@staticmethod
def should_skip_section(section_name, section_type):
return False
class ReadelfFileHeader(Readelf):
def readelf_options(self):
return ['--file-header']
class ReadelfProgramHeader(Readelf):
def readelf_options(self):
return ['--program-header']
class ReadelfSections(Readelf):
def readelf_options(self):
return ['--sections']
class ReadelfSymbols(Readelf):
def readelf_options(self):
return ['--symbols']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'DYNSYM', 'SYMTAB'}
class ReadelfRelocs(Readelf):
def readelf_options(self):
return ['--relocs']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'DYNSYM', 'SYMTAB'}
class ReadelfRelocs(Readelf):
def readelf_options(self):
return ['--relocs']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'REL', 'RELA'}
class ReadelfDynamic(Readelf):
def readelf_options(self):
return ['--dynamic']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'DYNAMIC'
class ReadelfNotes(Readelf):
def readelf_options(self):
return ['--notes']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'NOTE'
@staticmethod
def should_skip_section(section_name, section_type):
return section_type == 'NOTE'
class RedaelfVersionInfo(Readelf):
def readelf_options(self):
return ['--version-info']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'VERDEF', 'VERSYM', 'VERNEED'}
class ReadelfDebugDump(Readelf):
def __new__(cls, *args, **kwargs):
# Find the section group from the class name
debug_section_group = cls.__name__[len('ReadelfDebugDump_'):]
if debug_section_group:
return ReadelfDebugDump(debug_section_group, *args, **kwargs)
return super(Readelf, cls).__new__(cls)
def __init__(self, debug_section_group, *args, **kwargs):
self._debug_section_group = debug_section_group
super().__init__(*args, **kwargs)
def readelf_options(self):
return ['--debug-dump=%s' % self._debug_section_group]
READELF_DEBUG_DUMP_COMMANDS = [
# the full path can appear in the output, we need to remove it
return line.replace(self.path, '').encode('utf-8')
except UnicodeDecodeError:
return line
@staticmethod
def should_skip_section(section_name, section_type):
return False
class ReadelfFileHeader(Readelf):
def readelf_options(self):
return ['--file-header']
class ReadelfProgramHeader(Readelf):
def readelf_options(self):
return ['--program-header']
class ReadelfSections(Readelf):
def readelf_options(self):
return ['--sections']
class ReadelfSymbols(Readelf):
def readelf_options(self):
return ['--symbols']
@staticmethod
def should_skip_section(section_name, section_type):
return section_type in {'DYNSYM', 'SYMTAB'}
def filter(self, line):
try:
# we don't care about the name of the archive
line = self._archive_re.sub('File: lib.a(', line.decode('utf-8'))
# the full path can appear in the output, we need to remove it
return line.replace(self.path, '').encode('utf-8')
except UnicodeDecodeError:
return line
@staticmethod
def should_skip_section(section_name, section_type):
return False
class ReadelfFileHeader(Readelf):
def readelf_options(self):
return ['--file-header']
class ReadelfProgramHeader(Readelf):
def readelf_options(self):
return ['--program-header']
class ReadelfSections(Readelf):
def readelf_options(self):
return ['--sections']
class ReadelfSymbols(Readelf):
def readelf_options(self):
def __new__(cls, *args, **kwargs):
# Find the section group from the class name
debug_section_group = cls.__name__[len('ReadelfDebugDump_'):]
if debug_section_group:
return ReadelfDebugDump(debug_section_group, *args, **kwargs)
return super(Readelf, cls).__new__(cls)