simpleelf
v1.0.0
ELF 파일은 실행 파일 일뿐 만 아니라 메모리의 프로그램 레이아웃을 설명하는 매우 편리한 방법입니다. 이 프로젝트의 원래 의도는 개인이 임베디드 프로그램에 사용되는 메모리 매핑을 설명하는 ELF 파일을 만들 수 있도록하는 것입니다. IDA/GHIDRA 등과 같은 다른 분석 도구와 함께 사용하는 데 특히 유용합니다. Ida/Ghidra 등 ... 일반 .bin 파일 만 열 필요없이 원하는 정보를 모두 가질 수 있고 여러 idapython 스크립트를 실행할 필요가 없습니다 ( Load additional binary file... 옵션).
풀 요청은 물론 환영하는 것 이상입니까?.
pip 사용 :
python3 -m pip install simpleelf또는 자신을 복제하고 구축하십시오.
git clone [email protected]:doronz88/simpleelf.git
cd simpleelf
python -m pip install -e . -U이제 Simpleelf를 가져 와서 게임을 시작할 수 있습니다.
ElfStruct 사용하면 구문 분석이 쉽습니다. 시도해보십시오 :
from simpleelf . elf_structs import ElfStructs
ElfStructs ( '<' ). Elf32 . parse ( elf32_buffer ) # outputs a constucts' container
ElfStructs ( '<' ). Elf64 . parse ( elf64_buffer ) # outputs a constucts' container ElfBuilder 사용하는 건물은 쉽습니다. 시도해보십시오 :
from simpleelf . elf_builder import ElfBuilder
from simpleelf import elf_consts
# can also be used with ELFCLASS64 to create 64bit layouts
e = ElfBuilder ( elf_consts . ELFCLASS32 )
e . set_endianity ( '<' )
e . set_machine ( elf_consts . EM_ARM )
code = b'CODECODE'
# add a segment
text_address = 0x1234
text_buffer = b'cybercyberbitimbitim' + code
e . add_segment ( text_address , text_buffer ,
elf_consts . PF_R | elf_consts . PF_W | elf_consts . PF_X )
# add a second segment
e . add_segment ( 0x88771122 , b'data in 0x88771122' ,
elf_consts . PF_R | elf_consts . PF_W | elf_consts . PF_X )
# add a code section inside the first segment
code_address = text_address + text_buffer . find ( code ) # point at CODECODE
code_size = len ( code )
e . add_code_section ( code_address , code_size , name = '.text' )
# set entry point
e . set_entry ( code_address )
# add .bss section. not requiring a loaded segment from
# file
bss_address = 0x5678
bss_size = 0x200
e . add_empty_data_section ( bss_address , bss_size , name = '.bss' )
# get raw elf
e . build ()