{"id":17001603,"url":"https://github.com/shresht7/hex-ray","last_synced_at":"2025-03-22T08:48:21.836Z","repository":{"id":257153725,"uuid":"857452460","full_name":"Shresht7/hex-ray","owner":"Shresht7","description":"A hex-dump utility written in Rust that lets you look at the individual bytes that make up a file","archived":false,"fork":false,"pushed_at":"2025-01-01T14:46:40.000Z","size":446,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T09:09:35.859Z","etag":null,"topics":["cli","command-line","hexdump"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shresht7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-14T17:40:16.000Z","updated_at":"2025-01-01T14:46:38.000Z","dependencies_parsed_at":"2024-09-17T09:55:07.500Z","dependency_job_id":"d24e683b-90d9-4b55-ac66-dd37363504f9","html_url":"https://github.com/Shresht7/hex-ray","commit_stats":null,"previous_names":["shresht7/hex-ray"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fhex-ray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fhex-ray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fhex-ray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresht7%2Fhex-ray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shresht7","download_url":"https://codeload.github.com/Shresht7/hex-ray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244931586,"owners_count":20534010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","hexdump"],"created_at":"2024-10-14T04:25:28.827Z","updated_at":"2025-03-22T08:48:21.805Z","avatar_url":"https://github.com/Shresht7.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `hex-ray`\n\nA hexdump utility that let's you look at the individual bytes that make up a file. The value of each 8-bit byte is displayed as a pair of hexadecimal (base-16) values.\n\n![demo](./docs/demo.gif)\n\n---\n\n## 📦 Installation\n\nTo install `hex-ray`, ensure you have Rust and Cargo installed. You can then build the project from source.\n\n- Clone the repository.\n\n    ```sh\n    git clone https://github.com/Shresht7/hex-ray.git\n    cd hex-ray\n    ```\n\n- Build the project and use the compiled binary located in the `target/release` directory.\n\n    ```sh\n    cargo build --release\n    ```\n\n    **Alternatively**, install directly using cargo\n\n    ```sh\n    cargo install --path .\n    ```\n\n---\n\n## 📘 Usage\n\nTo use `hex-ray`, run the executable followed by the path of the file you want to inspect.\n\n```sh\nhex-ray \u003csubcommand\u003e [options]\n```\n\nor pipe something in\n\n```sh\ngit log | hex-ray \u003csubcommand\u003e\n```\n\n### Commands\n\n- `view`: View the hex-dump table\n- `inspect`: View the hex-dump table in an interactive terminal UI\n- `output`: Output only the values\n\n\u003e[!TIP]\n\u003e \n\u003e Use the `--help` flag for more information.\n\n### Arguments\n\n#### `inspect` and `view`\n\nBoth `inspect` and `view` support the following options:\n\n| Argument           | Description                                                                                            | Aliases        | Default |\n| ------------------ | ------------------------------------------------------------------------------------------------------ | -------------- | ------: |\n| `[filepath]`       | The only positional argument. Accepts the path to the file to read. If empty, input is read from STDIN | `path`, `src`  | `STDIN` |\n| `-o, --offset`     | The byte offset at which to start reading. This can be a positive or negative integer value.           | `skip`, `seek` |     `0` |\n| `-l, --limit`      | The number of bytes to read. The program will stop after reading the specified number of bytes         |                |   `ALL` |\n| `-s, --size`       | The size of each row in the tabulated output                                                           |                |    `16` |\n| `-g, --group-size` | Chunks the output into groups of this size                                                             | `chunk`        |     `4` |\n| `-f, --format`     | The output display [format](#formats).                                                                 |                |   `hex` |\n| `--no-color`       | Disables ANSI colors in the output. Useful when redirecting the output to a file                       |                | `false` |\n| `-p, --plain`      | Similar to `--no-color`, disables all stylistic formatting for the output                              | `simple`       | `false` |\n\n#### `output`\n\n The `output` subcommand supports the following flags:\n\n| Argument          | Description                                                                                            | Aliases        | Default |\n| ----------------- | ------------------------------------------------------------------------------------------------------ | -------------- | ------: |\n| `[filepath]`      | The only positional argument. Accepts the path to the file to read. If empty, input is read from STDIN | `path`, `src`  | `STDIN` |\n| `-o, --offset`    | The byte offset at which to start reading. This can be a positive or negative integer value.           | `skip`, `seek` |     `0` |\n| `-l, --limit`     | The number of bytes to read. The program will stop after reading the specified number of bytes         |                |   `ALL` |\n| `-f, --format`    | The output display [format](#formats).                                                                 |                |   `hex` |\n| `-s, --separator` | The character to separate the output values                                                            |                |     ` ` |\n\n### Examples\n\n- #### `cat ./src/main.rs | hex-ray view`\n\n    ```output\n    Source: STDIN\n    ┌───────────┬─────────────────────────────────────────────────────┬─────────────────────┐\n    │  ·····000 │ 2f 2f 20 54  72 61 69 74  73 0d 0a 75  73 65 20 63  │ //·T rait s··u se·c │\n    │  ·····020 │ 6c 61 70 3a  3a 50 61 72  73 65 72 3b  0d 0a 0d 0a  │ lap: :Par ser; ···· │\n    │  ·····040 │ 2f 2f 20 4d  6f 64 75 6c  65 73 0d 0a  6d 6f 64 20  │ //·M odul es·· mod· │\n    │  ·····060 │ 63 6c 69 3b  0d 0a 6d 6f  64 20 75 74  69 6c 73 3b  │ cli; ··mo d·ut ils; │\n    .........................................................................................\n    │  ·····160 │ 4f 6b 28 72  65 74 29 0d  0a 7d 0d 0a               │ Ok(r et)· ·}··      │\n    └───────────┴─────────────────────────────────────────────────────┴─────────────────────┘\n    Read 636 bytes\n    ```\n\n- #### `cat ./src/main.rs | hex-ray view --plain`\n\n    ```output\n    00000000:  2f 2f 20 54  72 61 69 74  73 0d 0a 75  73 65 20 63   | //·T rait s··u se·c\n    00000020:  6c 61 70 3a  3a 50 61 72  73 65 72 3b  0d 0a 0d 0a   | lap: :Par ser; ····\n    00000040:  2f 2f 20 4d  6f 64 75 6c  65 73 0d 0a  6d 6f 64 20   | //·M odul es·· mod·\n    00000060:  63 6c 69 3b  0d 0a 6d 6f  64 20 75 74  69 6c 73 3b   | cli; ··mo d·ut ils;\n    ...\n    ```\n\n- #### `\"Wow!\" | hex-ray output --format binary`\n\n    ```output\n    01010111 01101111 01110111 00100001 00001101 00001010\n    ```\n\n### Formats\n\nAll subcommands support the `--format` option, which dictates the format of the output values.\n\n| Format                            | Example Output | Accepted Options                             |\n| --------------------------------- | :------------: | -------------------------------------------- |\n| Hexadecimal                       |      `3f`      | `\"hex\"`, `\"x\"`, `\"hexadecimal\"`              |\n| Hexadecimal with Prefix           |     `0x3f`     | `\"#hex\"`, `\"#x\"`, `\"#hexadecimal\"`           |\n| Uppercase Hexadecimal             |      `3F`      | `\"HEX\"`, `\"X\"`, `\"Hex\"`, `\"Hexadecimal\"`     |\n| Uppercase Hexadecimal with Prefix |     `0x3F`     | `\"#HEX\"`, `\"#X\"`, `\"#Hex\"`, `\"#Hexadecimal\"` |\n| Binary                            |   `00111111`   | `\"binary\"`, `\"b\"`, `\"bin\"`                   |\n| Binary with Prefix                |  `0b00111111`  | `\"#binary\"`, `\"#b\"`, `\"#bin\"`                |\n| Octal                             |     `077`      | `\"octal\"`, `\"o\"`, `\"oct\"`                    |\n| Octal with Prefix                 |    `0o077`     | `\"#oct\"`, `\"#o\"`, `\"#oct\"`                   |\n| Decimal                           |     `063`      | `\"decimal\"`, `\"d\"`, `\"dec\"`                  |\n\n\u003e [!TIP]\n\u003e The `--format` option also works for the interactive terminal UI.\n\n#### Examples\n\n- `hex-ray view ./src/main.rs --offset 500 --limit 50 --format binary --size 4`\n    \n    ```\n    Source: ./src/main.rs\n    ┌───────────┬──────────────────────────────────────┬──────┐\n    │  ·····364 │ 00111101 00111110 00100000 01100011  │ =\u003e·c │\n    │  ·····370 │ 01101101 01100100 00101110 01100101  │ md.e │\n    │  ·····374 │ 01111000 01100101 01100011 01110101  │ xecu │\n    │  ·····000 │ 01110100 01100101 00101000 00101001  │ te() │\n    │  ·····004 │ 00111111 00101100 00001101 00001010  │ ?,·· │\n    │  ·····010 │ 00100000 00100000 00100000 00100000  │ ···· │\n    │  ·····014 │ 00100000 00100000 00100000 00100000  │ ···· │\n    │  ·····020 │ 01010011 01101111 01101101 01100101  │ Some │\n    │  ·····024 │ 00101000 01100011 01101100 01101001  │ (cli │\n    │  ·····030 │ 00111010 00111010 01000011 01101111  │ ::Co │\n    │  ·····034 │ 01101101 01101101 01100001 01101110  │ mman │\n    │  ·····040 │ 01100100 00111010 00111010 01001001  │ d::I │\n    │  ·····044 │ 01101110 01110011                    │ ns   │\n    └───────────┴──────────────────────────────────────┴──────┘\n    Read 50 bytes\n    ```\n\n- The same in octal with prefix. `hex-ray view ./src/main.rs --offset 500 --limit 50 --format \"#oct\" --size 4`\n\n    ```\n    Source: ./src/main.rs\n    ┌───────────┬──────────────────────────┬──────┐\n    │  ·····364 │ 0o075 0o076 0o040 0o143  │ =\u003e·c │\n    │  ·····370 │ 0o155 0o144 0o056 0o145  │ md.e │\n    │  ·····374 │ 0o170 0o145 0o143 0o165  │ xecu │\n    │  ·····000 │ 0o164 0o145 0o050 0o051  │ te() │\n    │  ·····004 │ 0o077 0o054 0o015 0o012  │ ?,·· │\n    │  ·····010 │ 0o040 0o040 0o040 0o040  │ ···· │\n    │  ·····014 │ 0o040 0o040 0o040 0o040  │ ···· │\n    │  ·····020 │ 0o123 0o157 0o155 0o145  │ Some │\n    │  ·····024 │ 0o050 0o143 0o154 0o151  │ (cli │\n    │  ·····030 │ 0o072 0o072 0o103 0o157  │ ::Co │\n    │  ·····034 │ 0o155 0o155 0o141 0o156  │ mman │\n    │  ·····040 │ 0o144 0o072 0o072 0o111  │ d::I │\n    │  ·····044 │ 0o156 0o163              │ ns   │\n    └───────────┴──────────────────────────┴──────┘\n    Read 50 bytes\n    ```\n\n---\n\n## 📕 Additional Information\n\n\n\u003e [!NOTE]\n\u003e\n\u003e ## Why Hexadecimal?\n\u003e\n\u003e The number of distinct values any sequence of digits can represent is given by the base raised to the power of the number of digits in the sequence. For example, a 2-bit binary (base-2) sequence can represent 2\u003csup\u003e2\u003c/sup\u003e = 4 distinct values; namely 00, 01, 10, 11. The 8 binary digits in a byte can represent 2\u003csup\u003e8\u003c/sup\u003e = 256 distinct values, usually interpreted as the numbers 0 to 255. Similarly, two-digit hexadecimal (base-16) numbers can represent 16\u003csup\u003e2\u003c/sup\u003e distinct values - also 256. This convenient correspondence is why programmers like hexadecimal notation so much - it gives us a compact way of representing all possible byte values with just two digits!\n\u003e\n\u003e Actually, it's even better than you might suspect at first. Each hexadecimal digit aligns cleanly with four bits of the corresponding byte so the hexadecimal number 0x12 corresponds to the byte 0001_0010 and the hexadecimal number 0x34 corresponds to 0011_0100. This makes it really easy to read bit patterns directly from hex notation!\n\u003e\n\n\u003e [!NOTE]\n\u003e \n\u003e The `0x` prefix indicates that a number is written in hexadecimal (base-16) format. Similarly, `0o` is used to indicate octal (base-8) and `0b` to indicate binary (base-2).\n\n### `NO_COLOR` Environment Variable\n\n\u003e [!TIP]\n\u003e `hex-ray` respects the `NO_COLOR` environment variable. ANSI colors will be disabled if `NO_COLOR` is set. You can pass in the `--no-color` flag to force disable the colors.\n\n---\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE). See the [LICENSE](./LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresht7%2Fhex-ray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshresht7%2Fhex-ray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresht7%2Fhex-ray/lists"}