/// 静态链接和动态链接 /// 查看PE和ELF的动态链接 ///python-magic 获取MIME文件类型(x-sharedlib application/x-executable)

编译和链接

静态链接和动态链接

这两部分参考程序员的自我修养

查看PE和ELF的动态链接 readelf ldd ida 

file

可以先使用file命令查看文件类型

对于ELF文件

参考 https://blog.csdn.net/mayue_web/article/details/104019036

以hpcenter为例

objdump

readelf -d

 

ida

 

ldd

注意需要对应架构的linuix。可以参考buildroot入门。

其中/lib/ld-linux-armhf.so.3是解释器

 

若无动态链接库(statically linked)

 

对于PE文件

dependency walker

python-magic MIME(x-sharedlib  application/x-executable)

 使用python的magic模块可以识别文件的类型。

# use magic to get the filetype
def _get_filetype(data, mime=True):
    return magic.from_file(data, mime);

而mime

MIME (Multipurpose Internet Mail Extensions) 是描述消息内容类型的因特网标准。

MIME 消息能包含文本、图像、音频、视频以及其他应用程序专用的数据。

https://www.w3school.com.cn/media/media_mimeref.asp

例如识别文件类型为

application/pdf

标准中并没有x-executable,

application/x-executable  可执行文件
"application/x-sharedlib  共享库
应该是扩展的类型
原文地址:https://www.cnblogs.com/lqerio/p/15330844.html