https://www.52pojie.cn/thread-1023342-1-1.html
https://github.com/corkami/pics/blob/master/binary/README.md
https://blog.kowalczyk.info/articles/pefileformat.html
https://axcheron.github.io/pe-format-manipulation-with-pefile/
https://github.com/erocarrera/pefile
https://en.wikipedia.org/wiki/Portable_Executable
https://resources.infosecinstitute.com/topic/2-malware-researchers-handbook-demystifying-pe-file/
https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/Debug/pe-format.md

什么是可执行文件

PE101.png

PE.png

image.png

  1. dumpbin /headers calc.exe

可执行文件(executable file)指的是可以由操作系统加载的可执行文件。
可执行文件格式:

  1. - windowsPEportable exectable)文件结构
  2. - windows pe 结构定义在 WINNT.h 中,image format
  3. - linuxELFexecutable and link format

使用领域:

  1. - 病毒&反病毒
  2. - 外挂&反外挂
  3. - 加壳&脱壳
  4. - 无源码修改功能&汉化
  5. - Hot Patching

DOS&PE头

dos:5A 4D
PE: 45 50

dos 头中0x003c 的数据就是pe头在文件中的偏移 .
比如下面:0x003c 位置的数据为 0x0108 , 0x0108 就是45 50 pe 头image.png

pe文件结构

9_1301335217ht3T.gif
image.png
PE.jpg
image.png

20191105010140189.png

运行前后的差异

节表

40字节

扩大节

image.png