0.0.5 • Published 7 years ago

binarycpu v0.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

binarycpu

Identify the processor architecture of binary files.

Usage

On the command line

Simply install with npm install -g binarycpu and then call this with the path you wish to scan. e.g.

binarycpu c:\\apps

And it will print out the file names of identified PE/MZ binary files with their appropriate cpu architecture (see table below).

In your own code

const binarycpu = require('binarycpu')

const arch = binarycpu.determinePEArch(filename)

null is returned if the file is not a MZ/PE file. If the processor architecture is unknown it will return unknown as well as the hex identifier.

Possible architectures

These have been kept the same as the Microsoft docs for PE files.

Hex IDNamedescription
0x0000nativeapplicable to any machine type
0x0EBCebcEFI byte code
0x014Cia32Intel 386 or later compatible processors
0x0200ia64Intel Itanium processor family
0x8664amd64AMD x64 extensions / Intel 64-bit 'Core'
0x0166r4000MIPS R4000 little endian
0x0169wcemipsv2MIPS little-endian WCE v2
0x0266mips16MIPS16
0x0366mipsfpuMIPS with FPU
0x0466mipsfpu16MIPS16 with FPU
0x01A1sh3Hitachi SH3
0x01A3sh3dspHitachi SH3 DSP
0x01A6sh4Hitachi SH4
0x01A8sh5Hitachi SH5
0x01F0powerpcPower PC little endian
0x01F1powerpcfpPower PC with floating point support
0x01C0armARM little endian
0x01C2thumbARM Thumb
0x01C4armntARM Thumb-2 little endian
0xAA64arm64ARM64 little endian
0x5032riscv32RISC-V 32-bit address space
0x5064riscv64RISC-V 64-bit address space
0x5128riscv128RISC-V 128-bit address space
0x01D3am33Matsushita AM33
0x9041m32rMitsubishi M32R little endian

Notes

  • Only Portable Executable files are supported (ELF, mach-O could be added later)
  • Errors are thrown if it is a MZ file but it can't find the PE signature