Metadata-Version: 2.2
Name: BinaryFileReader
Version: 1.0.0
Summary: This package reads binary file to exports strings or prints content as hexadecimal.
Home-page: https://github.com/mauricelambert/BinaryFileReader
Download-URL: https://mauricelambert.github.io/info/python/security/BinaryFileReader/BinaryFileReader.pyz
Author: Maurice Lambert
Author-email: Maurice Lambert <mauricelambert434@gmail.com>
Maintainer: Maurice Lambert
Maintainer-email: Maurice Lambert <mauricelambert434@gmail.com>
License: GPL-3.0 License
Project-URL: Github, https://github.com/mauricelambert/BinaryFileReader
Project-URL: Strings Documentation, https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.html
Project-URL: Strings Python Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.pyz
Project-URL: Strings Windows Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.exe
Project-URL: HexaReader Documentation, https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.html
Project-URL: HexaReader Python Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.pyz
Project-URL: HexaReader Windows Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.exe
Project-URL: Python Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/BinaryFileReader.pyz
Project-URL: Python Windows Executable, https://mauricelambert.github.io/info/python/security/BinaryFileReader/BinaryFileReader.exe
Keywords: strings,hexadecimal,hexadecimal-reader,binary-file,reverse,binary-reader,binary-viewer
Platform: Windows
Platform: Linux
Platform: MacOS
Classifier: Topic :: System
Classifier: Topic :: Security
Classifier: Environment :: Console
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Topic :: System :: Shells
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: System Shells
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.8
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: System :: Systems Administration
Classifier: Intended Audience :: System Administrators
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: PythonToolsKit==1.2.4
Dynamic: author
Dynamic: download-url
Dynamic: home-page
Dynamic: maintainer
Dynamic: requires-python

![BinaryFileReader Logo](https://mauricelambert.github.io/info/python/security/BinaryFileReader/small.png "BinaryFileReader logo")

# BinaryFileReader

## Description

This package reads binary file to exports strings or prints content as hexadecimal.

> By default the `Strings` command print only null terminated strings (*unicode (Windows, utf-16-le)* and ascii *(Linux, latin-1)*) and support non-null termined strings with option `-t`.
> `HexaReader` is colored and support custom coloration.

## Requirements

This package require:

 - python3
 - python3 Standard Library
 - PythonToolsKit==1.2.4

## Installation

### Pip

```bash
pip install BinaryFileReader
```

### Git

```bash
git clone "https://github.com/mauricelambert/BinaryFileReader.git"
cd "BinaryFileReader"
python3 -m pip install .
```

### Wget

```bash
wget https://github.com/mauricelambert/BinaryFileReader/archive/refs/heads/main.zip
unzip main.zip
cd BinaryFileReader-main
python3 -m pip install .
```

### cURL

```bash
curl -O https://github.com/mauricelambert/BinaryFileReader/archive/refs/heads/main.zip
unzip main.zip
cd BinaryFileReader-main
python3 -m pip install .
```

## Usages

## Command line

```bash
Strings                                 # Using CLI package executable
HexaReader                              # Using CLI package executable
python3 -m BinaryFileReader strings     # Using python module
python3 -m BinaryFileReader.Strings     # Using python module
python3 -m BinaryFileReader hexareader  # Using python module
python3 -m BinaryFileReader.HexaReader  # Using python module
python3 BinaryFileReader.pyz strings    # Using python executable
python3 BinaryFileReader.pyz hexareader # Using python executable
python3 Strings.pyz                     # Using python executable
python3 HexaReader.pyz                  # Using python executable
Strings.exe                             # Using python Windows executable
HexaReader.exe                          # Using python Windows executable

Strings -h                              # get help message
Strings test.bin                        # exports null terminated strings from test.bin
Strings -n 7 -t test.dump               # exports strings with minimum length of 7 characters
HexaReader test.bin                     # Read test.bin as hexadecimal and ascii printable
HexaReader -c -s 25 test.bin            # Read test.bin as hexadecimal and ascii printable without colors and with 25 characters by line
```

### Python script

```python
from BinaryFileReader import Strings, HexaReader

with open("test.bin", 'rb') as file:
    hexareader = HexaReader(file)
    for line in hexareader.reader():
        print(line)

with open("test.bin", 'rb') as file:
    strings = Strings(file, minimum_length=5, null_terminated=True)
    for line in strings.reader():
        print(line)

with open("test.bin", 'rb') as file:
    hexa_reader = HexaReader(
        file,
        size=16,
        ascii=True,
        colors={  # color names can be found from PythonToolsKit.Terminal.COLORS (BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, GRAY)
            "abcdefghijklmnopqrstuvwxyzABCDEFIJKLMNOPQRSTUVWXYZ": "GREEN",
            "0123456789": "CYAN",
            " !\"#$%&'()*+,-./:;<=>?[\\]^_{|}~`": "YELLOW",
        },
    )
    for line in hexareader.reader():
        print(line)
```

## Links

 - [Pypi package](https://pypi.org/project/BinaryFileReader/)
 - [Github Page](https://github.com/mauricelambert/BinaryFileReader/)
 - [Strings Documentation](https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.html)
 - [Strings Python executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.pyz)
 - [Strings Python Windows executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/Strings.exe)
 - [HexaReader Documentation](https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.html)
 - [HexaReader Python executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.pyz)
 - [HexaReader Python Windows executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/HexaReader.exe)
 - [Python executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/BinaryFileReader.pyz)
 - [Python Windows executable](https://mauricelambert.github.io/info/python/security/BinaryFileReader/BinaryFileReader.exe)

## Licence

Licensed under the [GPL, version 3](https://www.gnu.org/licenses/).
