{"_id":"pe-signature","_rev":"3-a530f13b527c6a71eed7404fefef181a","name":"pe-signature","description":"Test if buffer is a PE signature","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"pe-signature","version":"1.0.0","description":"Test if buffer is a PE signature","license":"MIT","author":{"name":"Vincent Weevers"},"files":["index.js"],"scripts":{"test":"node test.js"},"dependencies":{},"devDependencies":{"tape":"~4.6.3"},"keywords":["executable","pe","pe-coff","portable-executable","windows"],"engines":{"node":">=4.0.0","npm":">=2.0.0"},"repository":{"type":"git","url":"git+https://github.com/vweevers/pe-signature.git"},"bugs":{"url":"https://github.com/vweevers/pe-signature/issues"},"homepage":"https://github.com/vweevers/pe-signature","gitHead":"8f73cd3c65859b7357c22a3fc8e858e4e45cd08b","_id":"pe-signature@1.0.0","_shasum":"8093990cfc1ddee6b7307a18d74e3f2af9ef21d3","_from":".","_npmVersion":"4.0.3","_nodeVersion":"6.8.0","_npmUser":{"name":"vweevers","email":"dev@vincentweevers.nl"},"maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"dist":{"shasum":"8093990cfc1ddee6b7307a18d74e3f2af9ef21d3","tarball":"https://registry.npmjs.org/pe-signature/-/pe-signature-1.0.0.tgz","integrity":"sha512-8ZlF6mvkSljIyUCIIxfM4f1reqLnnsEc3sFZaS1qnVOtuzRB173nt1dAri4DbCwP5CGKFagnnY3lnSLasJAyoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxytqWss10xYAmOjKoIleIWCcqM1/C86RfQlcqHgVPKAiEAn/9XiiMq8cPrtGAQz8ZwfwdZci07pZA0YM8ambcOXzA="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pe-signature-1.0.0.tgz_1482064929193_0.7401110252831131"}}},"readme":"# pe-signature\n\n**Test if buffer is a [PE](https://en.wikipedia.org/wiki/Portable_Executable) signature. As specified by [Microsoft PE and COFF Specification 9.3](https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/pecoff_v83.docx) <sup>[doc]</sup>, section 3.2:**\n\n> After the MS-DOS stub, at the file offset specified at offset `0x3c`, is a 4-byte signature that identifies the file as a PE format image file. This signature is `PE\\0\\0` (the letters \"P\" and \"E\" followed by two null bytes).\n\n[![npm status](http://img.shields.io/npm/v/pe-signature.svg?style=flat-square)](https://www.npmjs.org/package/pe-signature) [![node](https://img.shields.io/node/v/pe-signature.svg?style=flat-square)](https://www.npmjs.org/package/pe-signature) [![Travis build status](https://img.shields.io/travis/vweevers/pe-signature.svg?style=flat-square&label=travis)](http://travis-ci.org/vweevers/pe-signature) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/pe-signature.svg?style=flat-square&label=appveyor)](https://ci.appveyor.com/project/vweevers/pe-signature) [![Dependency status](https://img.shields.io/david/vweevers/pe-signature.svg?style=flat-square)](https://david-dm.org/vweevers/pe-signature)\n\n## usage\n\n```js\nconst psig = require('pe-signature')\n\nconst a = Buffer('PE\\0\\0')\nconst b = Buffer('PE\\0\\0xxx')\nconst c = Buffer('xxxPE\\0\\0')\n\nconsole.log(psig.is(a))    // true\nconsole.log(psig.is(b))    // false\nconsole.log(psig.has(b))   // true\nconsole.log(psig.is(c, 3)) // true\n```\n\n## related\n\nUse [pe-signature-offset](https://github.com/vweevers/pe-signature-offset) to get the position of the signature in a PE file:\n\n```js\nconst open = require('fs-maybe-open')\n    , getOffset = require('pe-signature-offset')\n    , fs = require('fs')\n    , len = psig.length\n\nfunction isPEFile (fdOrFile, done) {\n  open(fdOrFile, 'r', function (err, fd, close) {\n    if (err) return done(err)\n\n    getOffset(fd, function (err, offset) {\n      if (err) return close(done, err)\n\n      fs.read(fd, Buffer(len), 0, len, offset, function (err, bytesRead, buf) {\n        if (err) return close(done, err)\n\n        close(done, null, psig.is(buf))\n      })\n    })\n  })\n}\n\nisPEFile('chrome.exe', function (err, is) {\n  if (err) throw err\n  console.log(is) // true\n})\n```\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install pe-signature\n```\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n","maintainers":[{"name":"vweevers","email":"dev@vincentweevers.nl"}],"time":{"modified":"2022-06-23T16:56:33.645Z","created":"2016-12-18T12:42:11.046Z","1.0.0":"2016-12-18T12:42:11.046Z"},"homepage":"https://github.com/vweevers/pe-signature","keywords":["executable","pe","pe-coff","portable-executable","windows"],"repository":{"type":"git","url":"git+https://github.com/vweevers/pe-signature.git"},"author":{"name":"Vincent Weevers"},"bugs":{"url":"https://github.com/vweevers/pe-signature/issues"},"license":"MIT","readmeFilename":"readme.md"}