예제 #1
0
 def __init__(self, *args, **kwargs):
     AIStruct.__init__(self, AIStruct.SIZE32)
     self.section = kwargs["section"]
     self.setup(('UINT32', 'st_name', {
         "format": self.section.get_sym_name
     }), ('UINT32', 'value'), ('UINT32', 'size'), ('UINT8', 'info'),
                ('UINT8', 'other'), ('UINT16', 'st_shndx'))
예제 #2
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE32)
		self.elffile = kwargs["elffile"]
		def format_flags(x):
			the_str = [' ', ' ', ' ']
			if (x & self.PF_X):
				the_str[2] = 'E'
			if (x & self.PF_W):
				the_str[1] = 'W'
			if (x & self.PF_R):
				the_str[0] = 'R'
			return "".join(the_str)
		
		self.setup(
			('UINT32', 'p_type', {"names" :
					      {0: "NULL",
					       1: "LOAD",
					       2 : "DYNAMIC",
					       3 : "INTERP",
					       4 : "NOTE",
					       1685382481 : "GNU_STACK",
					       1694766464 : "PAX_FLAGS",
					       }
					      }  ),
			('UINT32', 'p_offset', {"format": "0x%06x"}),
			('UINT32', 'p_vaddr', {"format": "0x%08x"}),
			('UINT32', 'p_paddr', {"format": "0x%08x"}),
			('UINT32', 'p_filesz', {"format": "0x%05x"}),
			('UINT32', 'p_memsz', {"format": "0x%05x"}),
			('UINT32', 'p_flags', {"format": format_flags}),
			('UINT32', 'p_align', {"format": "0x%x"}),
		)
예제 #3
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE32)
		self.elffile = kwargs["elffile"]
		self.index = kwargs["index"]

		def format_flags(x):
			if x == (self.SHF_WRITE | self.SHF_ALLOC):
				return "WA"
			if x == (self.SHF_EXECINSTR | self.SHF_ALLOC):
				return "AX"
			if x == self.SHF_WRITE:
				return "W"
			if x == self.SHF_ALLOC:
				return "A"
			if x == self.SHF_EXECINSTR:
				return "X"
			return "%x" % x

		self.mutated = 0
		self._name = None

		self.setup(
			('UINT32', 'sh_name', {"format" : self.elffile.get_name}),
			('UINT32', 'sh_type', {"names" : {0:"NULL", 1:"PROGBITS", 2:"SYMTAB", 3:"STRTAB", 8:"NOBITS"}}),
			('UINT32', 'sh_flags', {"format": format_flags}),
			('UINT32', 'sh_addr', {"format" : "%08x"}),
			('UINT32', 'sh_offset', {"format" : "%06x"}),
			('UINT32', 'sh_size', {"format" : "%06x"}),
			('UINT32', 'sh_link'),
			('UINT32', 'sh_info', {"format" : "%3d"}),
			('UINT32', 'sh_addralign', {"format" : "%2d"}),
			('UINT32', 'sh_entsize', {"format" : "%02x"}),
		)
예제 #4
0
    def __init__(self, *args, **kwargs):
        AIStruct.__init__(self, AIStruct.SIZE32)
        self.elffile = kwargs["elffile"]
        self.index = kwargs["index"]

        def format_flags(x):
            if x == (self.SHF_WRITE | self.SHF_ALLOC):
                return "WA"
            if x == (self.SHF_EXECINSTR | self.SHF_ALLOC):
                return "AX"
            if x == self.SHF_WRITE:
                return "W"
            if x == self.SHF_ALLOC:
                return "A"
            if x == self.SHF_EXECINSTR:
                return "X"
            return "%x" % x

        self.mutated = 0
        self._name = None

        self.setup(
            ('UINT32', 'sh_name', {
                "format": self.elffile.get_name
            }),
            ('UINT32', 'sh_type', {
                "names": {
                    0: "NULL",
                    1: "PROGBITS",
                    2: "SYMTAB",
                    3: "STRTAB",
                    8: "NOBITS"
                }
            }),
            ('UINT32', 'sh_flags', {
                "format": format_flags
            }),
            ('UINT32', 'sh_addr', {
                "format": "%08x"
            }),
            ('UINT32', 'sh_offset', {
                "format": "%06x"
            }),
            ('UINT32', 'sh_size', {
                "format": "%06x"
            }),
            ('UINT32', 'sh_link'),
            ('UINT32', 'sh_info', {
                "format": "%3d"
            }),
            ('UINT32', 'sh_addralign', {
                "format": "%2d"
            }),
            ('UINT32', 'sh_entsize', {
                "format": "%02x"
            }),
        )
예제 #5
0
파일: elf.py 프로젝트: B-Rich/codezero
 def __init__(self, *args, **kwargs):
     AIStruct.__init__(self, AIStruct.SIZE32)
     self.section = kwargs["section"]
     self.setup(
         ('UINT32', 'st_name', {"format" : self.section.get_sym_name}),
         ('UINT32', 'value'),
         ('UINT32', 'size'),
         ('UINT8', 'info'),
         ('UINT8', 'other'),
         ('UINT16', 'st_shndx')
         )
예제 #6
0
파일: elf.py 프로젝트: gz/aos10
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE64)
		self.setup(
			('UINT32', 'p_type'),
			('UINT32', 'p_flags'),
			('UINT64', 'p_offset'),
			('UINT64', 'p_vaddr'),
			('UINT64', 'p_paddr'),
			('UINT64', 'p_filesz'),
			('UINT64', 'p_memsz'),
			('UINT64', 'p_align'),
		)
예제 #7
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE64)
		self.setup(
			('UINT32', 'p_type', {"names" : {0: "NULL", 1: "LOAD", 2 : "DYNAMIC", 3 : "INTERP", 4 : "NOTE"}}  ),
			('UINT32', 'p_flags'),
			('UINT64', 'p_offset'),
			('UINT64', 'p_vaddr'),
			('UINT64', 'p_paddr'),
			('UINT64', 'p_filesz'),
			('UINT64', 'p_memsz'),
			('UINT64', 'p_align'),
		)
예제 #8
0
 def __init__(self):
     AIStruct.__init__(self, AIStruct.SIZE32)
     self.setup(('UINT8', 'ei_magic', {
         'times': 4
     }), ('UINT8', 'ei_class', {
         'names': {
             1: "ELF32",
             2: "ELF64"
         }
     }), ('UINT8', 'ei_data', {
         'names': {
             1: "2's complement, little endian",
             2: "2's complement, big endian"
         }
     }), ('UINT8', 'ei_version', {
         'names': {
             1: "1 (current)"
         }
     }), ('UINT8', 'ei_osabi', {
         'names': {
             0: "UNIX - System V",
             1: "HP-UX Operating System",
             255: "Standalone application"
         }
     }), ('UINT8', 'ei_abiversion'), ('UINT8', 'ei_padding', {
         'times': 7
     }), ('UINT16', 'e_type', {
         'names': {
             2: "EXEC (Executable file)"
         }
     }), ('UINT16', 'e_machine', {
         'names': {
             3: "Intel 80836"
         }
     }), ('UINT32', 'e_version', {
         'format': "0x%x"
     }), ('UINT32', 'e_entry', {
         'format': "0x%x"
     }), ('UINT32', 'e_phoff', {
         'format': "%d (bytes into file)"
     }), ('UINT32', 'e_shoff', {
         'format': "%d (bytes into file)"
     }), ('UINT32', 'e_flags', {
         'format': "0x%x"
     }), ('UINT16', 'e_ehsize', {
         'format': "%d (bytes)"
     }), ('UINT16', 'e_phentsize', {
         'format': "%d (bytes)"
     }), ('UINT16', 'e_phnum'), ('UINT16', 'e_shentsize', {
         'format': "%d (bytes)"
     }), ('UINT16', 'e_shnum'), ('UINT16', 'e_shstrndx'))
예제 #9
0
파일: elf.py 프로젝트: gz/aos10
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE64)
		self.setup(
			('UINT32', 'sh_name'),
			('UINT32', 'sh_type'),
			('UINT64', 'sh_flags'),
			('UINT64', 'sh_addr'),
			('UINT64', 'sh_offset'),
			('UINT64', 'sh_size'),
			('UINT32', 'sh_link'),
			('UINT32', 'sh_info'),
			('UINT64', 'sh_addralign'),
			('UINT64', 'sh_entsize'),
		)
예제 #10
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE64)
		self.setup(
			('UINT32', 'sh_name'),
			('UINT32', 'sh_type'),
			('UINT64', 'sh_flags'),
			('UINT64', 'sh_addr'),
			('UINT64', 'sh_offset'),
			('UINT64', 'sh_size'),
			('UINT32', 'sh_link'),
			('UINT32', 'sh_info'),
			('UINT64', 'sh_addralign'),
			('UINT64', 'sh_entsize'),
		)
예제 #11
0
 def __init__(self):
     AIStruct.__init__(self, AIStruct.SIZE64)
     self.setup(('UINT8', 'ei_magic', {
         'times': 4
     }), ('UINT8', 'ei_class'), ('UINT8', 'ei_data'),
                ('UINT8', 'ei_version'), ('UINT8', 'ei_padding', {
                    'times': 9
                }), ('UINT16', 'e_type'), ('UINT16', 'e_machine'),
                ('UINT32', 'e_version'), ('UINT64', 'e_entry'),
                ('UINT64', 'e_phoff'), ('UINT64', 'e_shoff'),
                ('UINT32', 'e_flags'), ('UINT16', 'e_ehsize'),
                ('UINT16', 'e_phentsize'), ('UINT16', 'e_phnum'),
                ('UINT16', 'e_shentsize'), ('UINT16', 'e_shnum'),
                ('UINT16', 'e_shstrndx'))
예제 #12
0
    def __init__(self, *args, **kwargs):
        AIStruct.__init__(self, AIStruct.SIZE32)
        self.elffile = kwargs["elffile"]

        def format_flags(x):
            the_str = [' ', ' ', ' ']
            if (x & self.PF_X):
                the_str[2] = 'E'
            if (x & self.PF_W):
                the_str[1] = 'W'
            if (x & self.PF_R):
                the_str[0] = 'R'
            return "".join(the_str)

        self.setup(
            ('UINT32', 'p_type', {
                "names": {
                    0: "NULL",
                    1: "LOAD",
                    2: "DYNAMIC",
                    3: "INTERP",
                    4: "NOTE",
                    1685382481: "GNU_STACK",
                    1694766464: "PAX_FLAGS",
                }
            }),
            ('UINT32', 'p_offset', {
                "format": "0x%06x"
            }),
            ('UINT32', 'p_vaddr', {
                "format": "0x%08x"
            }),
            ('UINT32', 'p_paddr', {
                "format": "0x%08x"
            }),
            ('UINT32', 'p_filesz', {
                "format": "0x%05x"
            }),
            ('UINT32', 'p_memsz', {
                "format": "0x%05x"
            }),
            ('UINT32', 'p_flags', {
                "format": format_flags
            }),
            ('UINT32', 'p_align', {
                "format": "0x%x"
            }),
        )
예제 #13
0
 def __init__(self, *args, **kwargs):
     AIStruct.__init__(self, AIStruct.SIZE64)
     self.setup(
         ('UINT32', 'p_type', {
             "names": {
                 0: "NULL",
                 1: "LOAD",
                 2: "DYNAMIC",
                 3: "INTERP",
                 4: "NOTE"
             }
         }),
         ('UINT32', 'p_flags'),
         ('UINT64', 'p_offset'),
         ('UINT64', 'p_vaddr'),
         ('UINT64', 'p_paddr'),
         ('UINT64', 'p_filesz'),
         ('UINT64', 'p_memsz'),
         ('UINT64', 'p_align'),
     )
예제 #14
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self):
		AIStruct.__init__(self, AIStruct.SIZE64)
		self.setup(
			('UINT8', 'ei_magic', {'times': 4}),
			('UINT8', 'ei_class'),
			('UINT8', 'ei_data'),
			('UINT8', 'ei_version'),
			('UINT8', 'ei_padding', {'times': 9}),
			('UINT16', 'e_type'),
			('UINT16', 'e_machine'),
			('UINT32', 'e_version'),
			('UINT64', 'e_entry'),
			('UINT64', 'e_phoff'),
			('UINT64', 'e_shoff'),
			('UINT32', 'e_flags'),
			('UINT16', 'e_ehsize'),
			('UINT16', 'e_phentsize'),
			('UINT16', 'e_phnum'),
			('UINT16', 'e_shentsize'),
			('UINT16', 'e_shnum'),
			('UINT16', 'e_shstrndx')
		)
예제 #15
0
파일: elf.py 프로젝트: B-Rich/codezero
	def __init__(self):
		AIStruct.__init__(self, AIStruct.SIZE32)
		self.setup(
			('UINT8', 'ei_magic', {'times': 4}),
			('UINT8', 'ei_class', {'names' : { 1: "ELF32", 2: "ELF64" }} ),
			('UINT8', 'ei_data', {'names' : { 1 : "2's complement, little endian", 2: "2's complement, big endian" }}),
			('UINT8', 'ei_version', {'names' : { 1 : "1 (current)" }}),
			('UINT8', 'ei_osabi', { 'names' : { 0 : "UNIX - System V", 1 : "HP-UX Operating System", 255 : "Standalone application"}}),
			('UINT8', 'ei_abiversion'),
			('UINT8', 'ei_padding', {'times': 7}),
			('UINT16', 'e_type', { 'names' : { 2 : "EXEC (Executable file)" }} ),
			('UINT16', 'e_machine', { 'names' : { 3 : "Intel 80836" } }),
			('UINT32', 'e_version', {'format': "0x%x" }),
			('UINT32', 'e_entry', {'format': "0x%x" }),
			('UINT32', 'e_phoff', { 'format' : "%d (bytes into file)" }),
			('UINT32', 'e_shoff', { 'format' : "%d (bytes into file)" }),
			('UINT32', 'e_flags', {'format': "0x%x" }),
			('UINT16', 'e_ehsize', { 'format' : "%d (bytes)" } ),
			('UINT16', 'e_phentsize', { 'format' : "%d (bytes)" } ),
			('UINT16', 'e_phnum'),
			('UINT16', 'e_shentsize', { 'format' : "%d (bytes)" } ),
			('UINT16', 'e_shnum'),
			('UINT16', 'e_shstrndx')
		)
예제 #16
0
파일: burn.py 프로젝트: vh21/codezero
 def __init__(self, *args, **kwargs):
     AIStruct.__init__(self, AIStruct.SIZE32)
     self.setup(('UINT32', 'addr'))
예제 #17
0
파일: readelf.py 프로젝트: gz/aos10
	def __init__(self, *args, **kwargs):
		AIStruct.__init__(self, AIStruct.SIZE32)
		self.setup(
			('UINT32', 'addr')
		)
예제 #18
0
 def __init__(self, *args, **kwargs):
     AIStruct.__init__(self, AIStruct.SIZE32)
     self.setup(("UINT32", "addr"))