pe-coff
Parse the COFF file header of a PE
Last updated 9 years ago by vweevers .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pe-coff 
SYNC missed versions from official npm registry.

pe-coff

Parse the COFF file header of a PE. As specified by Microsoft PE and COFF Specification 9.3 [doc], 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

Current Tags

  • 1.0.0                                ...           latest (9 years ago)

1 Versions

  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |