Python教程

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

本文主要是介绍/// 静态链接和动态链接 /// 查看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  共享库 应该是扩展的类型
这篇关于/// 静态链接和动态链接 /// 查看PE和ELF的动态链接 ///python-magic 获取MIME文件类型(x-sharedlib application/x-executable的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!