Skip to content

Commit

Permalink
finish basic structure, but needs more improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
WindSoilder committed Aug 7, 2022
0 parents commit f451566
Show file tree
Hide file tree
Showing 8 changed files with 2,470 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Project-specific generated files
docs/build/

bench/results/
bench/env/
bench/trio/

# Byte-compiled / optimized / DLL files / editor temp files
__pycache__/
*.py[cod]
*~
\#*
.#*
*.swp

# C extensions
*.so

# Distribution / packaging
.Python
/build/
/develop-eggs/
/dist/
/eggs/
/lib/
/lib64/
/parts/
/sdist/
/var/
*.egg-info/
.installed.cfg
*.egg
/.pybuild

# Installer logs
pip-log.txt

# Unit test / coverage reports
htmlcov/
.tox/
.venv/
.coverage
.coverage.*
.cache
.pytest_cache/
.mypy_cache/
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
doc/_build/

# vscode config file
.vscode/*
Binary file added FiraCode-VF.ttf
Binary file not shown.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Nu plugin binary reader
A general binary parser based on [kaitai struct](https://formats.kaitai.io/).

## Require python version
python3.7+

## Usage
1. register the plugin to nushell
```
register -e json plugin.py
```

It will introduce a new command: `from-binary`. So you can just play with it.

## Usage example
1. read and parse png file:
```
open capture.PNG | from-binary png | get ihdr
```

2. read and parse ttf file:
```
open FiraCode-VF.ttf | from-binary ttf | get directory_table
```

## Note
The `kaitaistruct.py` is just a copy of [kaitai struct python runtime](https://github.com/kaitai-io/kaitai_struct_python_runtime), put it directly here, so we don't need extra requirements.
And `reader/*.py` are just a copy of auto-generated parser, DON'T CHANGE IT.

0 comments on commit f451566

Please sign in to comment.