Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rameshvarun/binary-inspector
Web-based inspectors for packets and binary files.
https://github.com/rameshvarun/binary-inspector
ogg png react reverse-engineering typescript
Last synced: 4 months ago
JSON representation
Web-based inspectors for packets and binary files.
- Host: GitHub
- URL: https://github.com/rameshvarun/binary-inspector
- Owner: rameshvarun
- License: isc
- Created: 2019-08-28T21:29:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T07:33:18.000Z (over 1 year ago)
- Last Synced: 2024-10-11T17:43:11.640Z (4 months ago)
- Topics: ogg, png, react, reverse-engineering, typescript
- Language: TypeScript
- Homepage: https://rameshvarun.github.io/binary-inspector/
- Size: 3.48 MB
- Stars: 23
- Watchers: 3
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔍 Binary Inspector
[![Node.js CI](https://github.com/rameshvarun/binary-inspector/actions/workflows/node.js.yml/badge.svg)](https://github.com/rameshvarun/binary-inspector/actions/workflows/node.js.yml)
This project contains web-based inspectors for binary formats. It can be used to help debug programs that process packets and binary data files. The project also contains an interface that makes it simple to write an inspector for a new binary format.
## Developing
```bash
git clone https://github.com/rameshvarun/binary-inspector.git
cd binary-inspector && npm install
npm start
```## Adding a New Inspector (IEEE 754 Single Precision Floating Point)
```typescript
// An inspector is defined by a function that takes a `ByteRange` and
// returns a `Tree`. `ByteRange`s wrap buffers and provide helpers
// for decoding data. `ByteRange`s can be sliced into subranges, as well as
// further sliced into a `BitRange`. `Tree`s describe the structure and
// contents of the data.
function inspect(range: ByteRange): Tree {
// BitRanges for the sign, exponent and fraction.
let sign = range.bits(0, 1);
let exponent = range.bits(1, 8);
let fraction = range.bits(9, 23);// The decoded floating point value.
let decoded = range.readFloat32BE();// Create the inspection tree for the floating point.
return new Tree(`IEEE 754: ${decoded}`, range, [
new Tree(
`Sign: ${sign.readUIntBE()} (${sign.readBool() ? "-1" : "+1"})`,
sign
),
new Tree(
`Exponent: ${exponent.readUIntBE()} (2^${exponent.readUIntBE() - 127})`,
exponent
),
new Tree(
`Fraction: ${fraction.readUIntBE()} (${1 +
fraction.readUIntBE() / Math.pow(2, 23)})`,
fraction
)
]);
}// We can use the SimpleInspector component to wrap our inspect function.
// Inspectors with special features will need a custom component.
ReactDOM.render(
,
document.getElementById("root")
);
```This creates an inspector that can be used to debug floating point numbers.