Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

dz6

OpenSSF Best Practices

dz6

Fast Vim-inspired hex editor for the terminal

Features

  • Fast, even when editing large files
  • Runs in the terminal / Text User Interface (TUI)
  • Vim-like key bindings
  • Configurable options
  • Edit in hex or ASCII
  • String list with regex filtering
  • Multiple smart ways to navigate through a file
  • Find strings and hex bytes
  • Add comments and bookmarks
  • Mark blocks with colors
  • PE/ELF headers parsing
  • Cross-platform
  • Open source

Demo

asciicast

Installation

Rust package manager (all operating systems)

Follow the instructions here to install cargo. Then, open up a terminal and type

cargo install dz6

Arch Linux (via AUR)

yay -S dz6

BigLinux

pacman -S dz6

FreeBSD

pkg install dz6

Windows

If you have WinGet, install dz6 with

winget install mentebinaria.dz6

Scoop users can also

scoop install dz6

Alternatively, download the release package for your system.

macOS

Homebrew users can

brew install dz6

From the sources

If you want to test the most recent, but still under development, version of dz6, you'll need Cargo and git, then you can

git clone https://github.com/mentebinaria/dz6.git
cd dz6
cargo install --path .

Usage

Usage: dz6 [OPTIONS] <FILE>

Arguments:
  <FILE>  File to open

Options:
  -o, --offset <OFFSET>  Initial cursor offset (hex default; `t` suffix = decimal) [default: 0]
  -r, --readonly         Set read-only mode
  -h, --help             Print help
  -V, --version          Print version

Once you load a file in dz6, you can use the commands below.

Global key bindings

KeyActionTips
TabSwitch viewsCycle through Hex, Text, and Headers. Backtab: Cycle backward.
Alt+lOpen log window
:Open command barSee Commands

Commands

CommandActionParametersTips/Examples
<number>Go to offsethex default; t suffix = decimal; + prefix = incremental jump; - prefix = decremental jump
cmtAdd <comment> to <offset><offset> <comment>cmt 1000 "my comment" (comment at offset 0x1000; offset obeys the same rules above)
selSelect <length> bytes from <offset><offset> <length>sel 40 10t (select 10 bytes from offset 0x40)
set bytelineSet the number of bytes per line<number> or autoset byteline 8 (default is 16; auto enables automatic setting based on screen width)
set ctrlcharSet the character shown in the ASCII dump for non-graphic values<char>set ctrlchar " " would set a blankspace (default: .)
set dbTurn on database file saving/loading (default)A database file with a .dz6 extension will be used to store bookmarks and comments for the file
set nodbTurn off database file saving/loading
set dimzeroDim (gray out) null bytes only (default)
set dimctrlDim all control charactersAll non-graphic characters will be dimmed
set nodimTurn off byte dimming
set themeSet the themedark or lightset theme light (default: dark)
set viewChanges the current viewtext, hex or headerset view header (default: hex)
set wrapscanEnable search results wrap
set nowrapscanDisable search results wrap
wWrite changes to file
wq or xWrite changes to file and quit
qQuit without saving changesIn replace mode, T (truncate) is an exception because it modifies the file immediately.

If you need permanent settings, create a $HOME/.dz6init file containing any of the commands above, one per line. dz6 will load that at startup. Lines starting with # are ignored.

Hex view

This is the main view you would expect from a hex editor. It displays file offsets alongside the file contents in a hexadecimal dump that you can navigate, search, edit, and more.

KeyActionTips
Arrow keysNavigationVim-like h, j, k, l also work
w d qAdvance by a word (2 bytes), a dword (4 bytes), or a qword (8 bytes), respectivelyUse the capital letters W, D, and Q to move backwards
oGo to the next other byte (the one that differs from the byte under the cursor)O goes backwards
Home or 0Set the cursor to the beginning of the current line
End or $Set the cursor to the end of the current line
Ctrl+Home or gGo to the first offset
Ctrl+End or GGo to the last offset in the file
Ctrl+f or Page DownMove down one page
Ctrl+bor Page UpMove up one page
rEnter replace mode
zSet the byte under the cursor zero
~Change case if applicableOnly works with bytes within the ASCII alphabetic range
Ctrl+aIncrement byte under the cursor
Ctrl+xDecrement byte under the cursor
vEnter select mode
uUndo the last change made to the bufferUse it before writing to the file (:w)
/Search (forward)Search the entire file. Tab cycles between ASCII and hex search
nSearch next (forward)
?Search (backward)Search the entire file. Tab cycles between ASCII and hex search
NSearch next (backward)
sOpen Strings window
BackspaceGo to the previously visited offsetThis is useful after a Go to command, for example
+Add current offset to bookmarks
-Go to the last added bookmark
Alt+1..8Go to bookmark
Alt+-Remove the last added bookmarkThe cursor must be at the bookmarked offset
Alt+0Clear bookmarks
Alt+hToggle byte highlight
;Add a comment to the selected offset
Ant+nOpen Names window. Added comments will be there.
=Open Calculator

Hex selection mode

KeyActionTips
Arrow keysNavigationVim-like h, j, k, l also work
~Change case if applicableOnly works with bytes within the ASCII alphabetic range
nFill selected bytes with NOPsThis puts dz6 in replace mode; press Enter to save the buffer; Esc to cancel
zFill selected bytes with zeroesSame as above
yCopy bytes to system's clipboardThere is no paste command yet
Alt+mMark a block with a random colorAlt+m again to pick another color. [ and ] to navigate to block boundaries
EscGo back to normal mode

Hex replace mode

KeyActionTips
Arrow keysNavigation
BackspaceThe same as navigating left
~Change case if applicableOnly works with bytes within the ASCII alphabetic range
zSet byte to zero
Ctrl+aIncrement byte
Ctrl+xDecrement byte
EscGo back to normal modeChanges are saved to buffer, but not written to file yet
TabCycle through hex and ASCII dump to edit the file in ASCII
tRemove all bytes after the the selected offsetBe aware this can't be undone
TRemove all bytes before the the selected offsetBe aware this can't be undone

Names

KeyActionTips
Arrow keysNavigationUp/Down only
fFilter names using a regular expression
DDelete all names
EscClose
EndSelect the last item shown
Ctrl+EndSelect the last item on the list
HomeSelect the first item shown
Ctrl+HomeSelect the first item on the list
Page DownGo down one page
Page UpGo up one page
EnterFollow the name in hex dump and close the window

Strings

KeyActionTips
Arrow keysNavigationUp/Down only
/Filter strings using a regular expression
RRe-read strings from fileUseful if you changed the file
EscClose
EndSelect the last item shown
Ctrl+EndSelect the last item on the list
HomeSelect the first item shown
Ctrl+HomeSelect the first item on the list
Page DownGo down one page
Page UpGo up one page
EnterFollow the string in hex dump and close the window

Calculator

64-bit calculator. Default base is decimal, but you can prefix hex numbers with 0x. Pre-defined variables:

VariableValueLength
@xSigned value under cursorx is b (byte), w (word), d (dword) or q (qword)
@XUnsigned value under cursorX is B (byte), W (word), D (dword) or Q (qword)
@oCurrent offsetdword on 32-bit systems; qword on 64
@OPreviously visited offsetsame as above

Use the up and down arrow keys to navigate through the history.

Text view

This view is a work in progress.

The Text view displays the file as plain text. This can be useful even when editing binary files, as it lets you quickly inspect large blocks of text contained within them.

KeyAction
eOpen encoding selection dialog

Header view

This view is a work in progress.

The Header view is a new view (expected in v0.8.0) available for executable files. It parses the executable headers and shows them in a nice way. Currently, it supports PE and ELF files, but all features from them.

KeyActionTips
Arrow keysTab navigationLeft/Right only. Vim-like h, l also work. To quickly pick a tab, you can also press keys 1, 2, etc.
Arrow keysField navigationUp/Down only. Vim-like j, k also work.
Ctrl+f/bScroll one page forward / backword
SpaceChange output numeric baseOutput numbers in hexadecimal (default) or decimal
EnterFollow a field valueFor applicable fields (e.g., AddressOfEntryPoint in the PE Optional Header), follow their value in the Hex view.

FAQ

1. I'm on a Mac. How am I supposed to use Alt key?!

iTerm2 users: go to Settings → Profiles → (your profile) → Keys and set the Left Option key to Esc+. This will make the Option key work like Alt.

2. Do all Vim commands work in dz6?

No. Some key bindings behave similarly, but dz6 is not meant to be 100% compatible with Vim. For example, o in dz6 moves to the next other byte, while the same key in Vim opens a new line below the current one.

3. Is dz6 stable yet?

No. Stability is expected only at v1.0.0. Until then, breaking changes are expected.

关于 About

Fast Vim-inspired hex editor for the terminal
elffile-editorfile-inspectionforensicshex-editinghex-editormalware-analysispe-filereverse-engineeringvim-like

语言 Languages

Rust100.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
217
Total Commits
峰值: 34次/周
Less
More

核心贡献者 Contributors