コード例 #1
0
ファイル: restruct.py プロジェクト: warabanshi/binstudy
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))
コード例 #2
0
ファイル: restruct.py プロジェクト: warabanshi/binstudy
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))
コード例 #3
0
ファイル: teardown.py プロジェクト: warabanshi/binstudy
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))