pe-coff

2019-02-13 admin

pe-coff是什么

什么是pe-coff,Parse the COFF file header of a PE

pe-coff使用教程帮助文档

pe-coff

Parse the COFF file header of a PE. As specified by Microsoft PE and COFF Specification 9.3 <sup>[doc]</sup>, section 3.3.

npm status node Travis build status AppVeyor build status Dependency status

example

const pecoff = require('pe-coff')

pecoff('file.exe', function (err, header, location) {
  console.log(header)
  console.log(location)
})

The header has these properties:

{
  "machineType": "i386",
  "machineDescription": "Intel 386 or later processors and compatible processors",
  "numberOfSections": 3,
  "timeDateStamp": 1480757919,
  "pointerToSymbolTable": 0,
  "numberOfSymbols": 0,
  "sizeOfOptionalHeader": 224,
  "characteristics": 258
}

And location contains the offset and length of the header in bytes:

{
  "offset": 132,
  "length": 20
}

pecoff(mixed, [limit], callback)

Where mixed is either a filename or a file descriptor. Use limit (the number of bytes to read) if you only need the first (few) fields:

pecoff('file.exe', pecoff.NUMBER_OF_SECTIONS, function (err, header) {
  // Will have machineType, machineDescription, numberOfSections
  console.log(header)
})

pecoff('file.exe', pecoff.MACHINE_TYPE, function (err, header) {
  // Will have machineType, machineDescription
  console.log(header)
})

related

install

With npm do:

npm install pe-coff

license

MIT © Vincent Weevers

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-53662.html

文章标题:pe-coff

回到顶部