shSize = eh.get('sh_size') shNum = eh.get('sh_num') shOff = eh.get('sh_offset') # get sh string table shStrStart = shOff + shSize * eh.get('shstrndx') strSh = Sh() strSh.retrieve(byteList[shStrStart:shStrStart+shSize]) strOff = strSh.get('offset') strSize= strSh.get('size') strTab = ''.join(map(chr, byteList[strOff:strOff+strSize])) # get sections secAggr = SectionAggregator() for idx in range(1, shNum): if idx == eh.get('shstrndx'): continue shStart = shOff + shSize * idx sh = Sh() sh.retrieve(byteList[shStart:shStart+shSize]) name = retrieveStr(strTab, sh.get('name_index')) body = byteList[sh.get('offset'):sh.get('offset')+sh.get('size')] secAggr.append(Section(body, name, sh))