Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🔮 Futuristic take on hexdump, made in Rust.

License

NotificationsYou must be signed in to change notification settings

sitkevij/hex

Repository files navigation

Futuristic take on hexdump.

hx accepts a file path or stdin as input and outputsa hexadecimal colorized view to stdout.

hx with file path as input, outputting colorized hexadecimal:

$ hx tests/files/alphanumeric.txt0x000000: 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6a abcdefghij0x00000a: 0x6b 0x69 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 kilmnopqrs0x000014: 0x74 0x75 0x76 0x77 0x78 0x79 0x7a 0x30 0x31 0x32 tuvwxyz0120x00001e: 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x0a 0x30 0x31 3456789.010x000028: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 23456789010x000032: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 23456789010x00003c: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39           23456789   bytes: 68

hx with stdin as input, outputting colorized hexadecimal:

cat tests/files/alphanumeric.txt| hx0x000000: 0x61 0x62 0x63 0x64 0x65 0x66 0x67 0x68 0x69 0x6a abcdefghij0x00000a: 0x6b 0x69 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 kilmnopqrs0x000014: 0x74 0x75 0x76 0x77 0x78 0x79 0x7a 0x30 0x31 0x32 tuvwxyz0120x00001e: 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x0a 0x30 0x31 3456789.010x000028: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 23456789010x000032: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x31 23456789010x00003c: 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39           23456789   bytes: 68

crates.iobuild status

quick links

examples

lower hex format -fx

$ hx src/main.rs

lower hex output format

binary hex format -fb

$ hx -fb -c4 src/main.rs

binary hex output format

octal hex format -fo

$ hx -fo -c8 src/main.rs

octal hex output format

installation

packaging availability

hx is packaged and available for install on the following platforms:

Packaging status

crates.io install

Ifcargo is already installed, simply:

cargo install hx

source install

From within thehx source code directory, simply execute:

make install

This will run the followingcargo commands:

cargo build --releasecargotest --verbose --all -- --nocapturecargo install --path.

Which will compile the release version, run tests and install release binary to<USERDIR>/.cargo/bin/hx.

If<USERDIR>/.cargo/bin is part of thePATH environment variable,hx should be ableexecutable anywhere in the shell.

arch linux install

pacman -S hex

debian install

Browsehttps://github.com/sitkevij/hex/releases/latest to chooseVERSION for use with this debianinstallation example:

VERSION=0.6.0&& curl -sLO"https://github.com/sitkevij/hex/releases/download/v$VERSION/hx_$VERSION-1_amd64.deb"&& dpkg -i"hx_$VERSION-1_amd64.deb"

guix install

guix install hex

In an isolated environment:

guix shell --container hex

docker run

# stdincat README.md| docker run -ti sitkevij/hx:latest# file input with parameters and NO_COLOR environment variableecho"NO_COLOR=1">docker_env_vars.ignore.txt&&docker run -ti --env-file docker_env_vars.ignore.txt -v$(pwd)/README.md:/README.md sitkevij/hx:latest -fo -c8 /README.md

features

output arrays inrust,c,golang,python,fsharp,kotlin,java, orswift

hx has a feature which can output the input file bytes as source code arrays.

For example:

rust array: -ar

$ hx -ar -c8 tests/files/tiny.txtlet ARRAY: [u8; 3] = [    0x69, 0x6c, 0x0a];

c array: -ac

$ hx -ac -c8 tests/files/tiny.txtunsigned char ARRAY[3] = {    0x69, 0x6c, 0x0a};

golang array: -ag

$ hx -ag -c8 tests/files/tiny.txta := [3]byte{    0x69, 0x6c, 0x0a,}

python array: -ap

$ hx -ap -c8 tests/files/tiny.txta = [    0x69, 0x6c, 0x0a]

kotlin array: -ak

$ hx -ak -c8 tests/files/tiny.txtval a = byteArrayOf(    0x69, 0x6c, 0x0a)

java array: -aj

$ hx -aj -c8 tests/files/tiny.txtbyte[] a = new byte[]{    0x69, 0x6c, 0x0a};

swift array: -as

$ hx -as -c8 tests/files/tiny.txtlet a: [UInt8] = [    0x69, 0x6c, 0x0a]

fsharp array: -af

$ hx -af -c8 tests/files/tiny.txtlet a = [|    0x69uy; 0x6cuy; 0x0auy|]

NO_COLOR support

hx will honor the NO_COLOR environment variable. If set, no color will be output to the terminal.

Rustno_color crate:

help

hxFuturistic take on hexdump, made in Rust.USAGE:    hx [OPTIONS] [INPUTFILE]    <stdout> | hx [OPTIONS]FLAGS:    -h, --help       Prints help information    -V, --version    Prints version informationOPTIONS:    -a, --array <array_format>    Set source code format output: rust (r), C (c), golang (g), python (p), kotlin (k),                                  java (j), swift (s), fsharp (f) [possible values: r, c, g, p, k, j, s, f]    -t, --color <color>           Set color tint terminal output. 0 to disable, 1 to enable [possible values: 0, 1]    -c, --cols <columns>          Set column length    -f, --format <format>         Set format of octet: Octal (o), LowerHex (x), UpperHex (X), Binary (b) [possible                                  values: o, x, X, b]    -u, --func <func_length>      Set function wave length    -l, --len <len>               Set <len> bytes to read    -p, --places <func_places>    Set function wave output decimal placesARGS:    <INPUTFILE>    Pass file path as an argument, or input data may be passed via stdin

license

MIT

About

🔮 Futuristic take on hexdump, made in Rust.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors11


[8]ページ先頭

©2009-2025 Movatter.jp