# ubuntu的ELF文件格式
- 什么是ELF呢?
答:在 Linux、Windows 和 macOS 系统中,ELF
、PE
和 Mach-O
是不同平台的可执行文件格式标准,它们属于二进制文件的底层结构,无法通过简单的文件属性窗口查看,但可以通过以下专业方法检测:
# Linux(ELF 格式)
file 可执行文件名
1
实战的案例:
(base) gun@gun:~/桌面/ubuntu_rust_code/rust_code_test01/target/debug$ file rust_code_test01
rust_code_test01: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4db8a07029407ec6bc31cf882d713c47172d8eb1, for GNU/Linux 3.2.0, with debug_info, not stripped
1
2
2
这个是输出的日志信息:
rust_code_test01: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4db8a07029407ec6bc31cf882d713c47172d8eb1, for GNU/Linux 3.2.0, with debug_info, not stripped
1
这些信息是什么意思?无法理解?
# Windows(PE 格式)
# 使用 PowerShell
Get-FileHash -Algorithm SHA256 可执行文件名.exe
# 或通过工具(如 Detect It Easy)分析 PE 头
1
2
3
2
3