Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dd86k/ddhx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

                    β–‘       β–‘β–‘β–‘       β–‘β–‘β–‘  β–‘β–‘β–‘β–‘  β–‘β–‘  β–‘β–‘β–‘β–‘  β–‘
                    β–’  β–’β–’β–’β–’  β–’β–’  β–’β–’β–’β–’  β–’β–’  β–’β–’β–’β–’  β–’β–’β–’  β–’β–’  β–’β–’
                    β–“  β–“β–“β–“β–“  β–“β–“  β–“β–“β–“β–“  β–“β–“        β–“β–“β–“β–“    β–“β–“β–“
                    β–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆ
                    β–ˆ       β–ˆβ–ˆβ–ˆ       β–ˆβ–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆβ–ˆ  β–ˆ

+------------------------------------------------------------------------------+
        hex   0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f                   
          0  4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00  MZ..............  
         10  b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00  ........@.......  
         20  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................  
         30  00 00 00 00 00 00 00 00 00 00 00 00 f0 00 00 00  ................  
         40  0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68  ........!..L.!Th  
         50  69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f  is program canno  
         60  74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20  t be run in DOS   
         70  6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00  mode....$.......  
         80  41 b8 1d c5 05 d9 73 96 05 d9 73 96 05 d9 73 96  A.....s...s...s.  
         90  11 b2 77 97 09 d9 73 96 11 b2 70 97 03 d9 73 96  ..w...s...p...s.  
         a0  11 b2 76 97 c4 d9 73 96 11 b2 72 97 02 d9 73 96  ..v...s...r...s.  
         b0  05 d9 72 96 ad d9 73 96 63 b6 8e 96 0d d9 73 96  ..r...s.c.....s.  
         c0  57 ac 77 97 14 d9 73 96 57 ac 70 97 0f d9 73 96  W.w...s.W.p...s.  
         d0  57 ac 76 97 2c d9 73 96 05 d9 73 96 e0 df 73 96  W.v.,.s...s...s.  
         e0  ca ac 71 97 04 d9 73 96 52 69 63 68 05 d9 73 96  ..q...s.Rich..s.  
         f0  50 45 00 00 64 86 0d 00 02 7c bc 68 00 00 00 00  PE..d....|.h....  
        100  00 00 00 00 f0 00 22 00 0b 02 0e 1d 00 c8 21 00  ......".......!.  
        110  00 9e 0b 00 00 00 00 00 e2 7d 00 00 00 10 00 00  .........}......  
        120  00 00 00 40 01 00 00 00 00 10 00 00 00 02 00 00  ...@............  
        130  06 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00  ................  
        140  00 e0 2d 00 00 04 00 00 00 00 00 00 03 00 60 81  ..-...........`.  
        150  00 00 10 00 00 00 00 00 00 10 00 00 00 00 00 00  ................  
        160  00 00 10 00 00 00 00 00 00 10 00 00 00 00 00 00  ................  
  OVR |  x8 |    ascii |       6c
+------------------------------------------------------------------------------+

ddhx is a multi-platform Text UI hex editor, inspired by GNU nano and vim.

Currently available for Windows, macOS, Linux, and BSDs.

License: MIT
Title font: Shaded Blocky (FIGlet)

********************************************************************************
*                                    NOTICE                                    *
********************************************************************************

This software is provided with NO WARRANTY as it is marked as EXPERIMENTAL.

ALWAYS make backups of your files before editing them.

This is a Work In Progress (WIP). Everything was rewritten from scratch
in version 0.5 to have editing features. It will be buggy!

//
// Limitations
//

// Output

It currently only outputs UTF-8. You might want to stick to the ASCII charset
setting if your terminal or console lacks UTF-8 capabilities.

On Windows, the editor will attempt to use the 65001 (UTF-8) character set
automatically.

// Input

On POSIX platforms, the editor supports xterm and vt220 sequences.

On POSIX platforms, the app assumes these keys:
- ^H (\010) for Ctrl+Backspace;
- DEL (0x7f) for Backspace;
- "\033[3~" for Delete.

Not all key combinations can be detected by terminal applications. Your 
terminal emulator or framebuffer may intercept certain shortcuts for its own
features. For example, VTE-based terminals (GNOME Terminal, Terminator, Tilix)
often capture Ctrl+Shift+Arrow keys for tab/pane navigation. Or Shift+PageUp
to scroll the framebuffer upwards.

If a shortcut doesn't work, the "bind" command allows binding a command to a
shortcut: `bind alt+e select-end`. Commands can still be executed from the
command prompt.

//
// Roadmap
//

This list may change at any given time without notice.

0.5:
- [x] Overwrite data
- [x] Append data
- [x] Save new buffer to file
- [x] Save existing file
- [x] History undo/redo
- [x] Command prompt
- [x] Standard input (stdin) support as new buffer
- [x] Skip to different element (or byte) (Ctrl+Left/Right)

0.6:
- [x] Support selecting data
- [x] Config file
- [x] "bind" command: map command to shortcut
- [x] Searching ("find" command)

0.7:
- [ ] Insert data
- [ ] Delete data

Wishlist:
- [ ] Other single-byte data types in view (d8, o8)
- [ ] Multi-byte data types (d16, f32, etc.)
- [ ] Insert characters
- [ ] Insert range ("fill")
- [ ] Insert file ("insert-file" depends on mode)
- [ ] Copy & paste ("paste" depends on mode)
- [ ] Bookmarks / Annotations
- [ ] Export range
- [ ] Process memory document type
- [ ] Disk document type
- [ ] Search by charset
- [ ] Inspect data panel
- [ ] Patch system

//
// Usage
//

ddhx aims to be a small and easy-to-use visual hexadecimal editor. For that
purpose, there are multiple ways of using the editor.

Synopsis:
  ddhx [OPTIONS] [FILE|-]
  ddhx {-h|--help|--version|--ver}

Create a new document:
  $ ddhx
Open an existing or create a new file at this location:
  $ ddhx FILENAME
Create a new document from stream data:
  $ echo test | ddhx -

The command-line interface matches POSIX guidelines.

To view available start options, execute `ddhx --help`.

Minimum recommended terminal size is 80x24 characters.

To quit the editor, use Ctrl+Q, or use the "quit" command.

// Navigation

Arrow keys for basic navigation.

Page Up/Down are used to move the cursor across the screen.

Home/End to move to start or end of row.

Ctrl+Home/End to move to start or end of document.

Ctrl+Left/Right can be used to skip over data (ie, same bytes or patterns).

Ctrl+Up/Down can be used to move the view higher or lower.

Shift + navigation key to start a selection.

New keybinds can be set at runtime using the "bind" command (vim example):
  >bind h left
  >bind j down
  >bind k up
  >bind l right

Another example, "bind right-arrow goto +32" will bind the right arrow key to
"goto +32", which will make it jump 32 bytes ahead. To unbind it, use
"unbind right-arrow" or "reset-keys" to reset all keybindings.

To view default keybinds, execute `ddhx --help-keys`.

// Searching

Searching can be done using the "find" and "find-back" commands.

For example, looking for `hi\0\0` (these are equivalent):
  >find s:hi x:00 00
  >find \"hi\" 0x00 00
  >find x:68 69 00 00

Here are supported prefixes:
  x: and 0x - Hexadecimal (currently only 8-bit unsigned)
  d:        - Decimal (currently only 8-bit unsigned)
  o:        - Octal (currently only 8-bit unsigned)
  s: and "  - String (currently ASCII only)

Practical example: PDF

Use the "find s:endstream" comand to search for string "endstream", then hit
Ctrl+N ("find-next") to go to next result or Shift+N ("find-prev") to go to
the previous result.

LIMITATION: Search does not wrap and depends on cursor position.

// Editing

Editing is done directly using the A to F and 0 to 9 keys.

Saving is default mapped to Ctrl+S, and Save As mapped to Ctrl+O.

Currently, only overwrite and append operations are supported.

//
// Commands
//

All actions are mapped to command names. Some shortcuts are mapped to commands.

Commands can be executed using the command prompt within the editor.

By pressing Return, you can type a command, and then confirm it by pressing the
Return key again.

Some commands have arguments. When these arguments are omitted, the associated
command will prompt for these arguments.

For example, moving the cursor forward of 32 bytes:
  >goto +0x20

Typing "goto" alone will make the program ask for an offset. This command also
has the shortcut of Ctrl+G. In the case of "goto", it accepts decimal, octal,
and hexadecimal values.

Examples of using "goto":
  >goto 0x10
    Go to position 16 bytes (using hexadecimal) within document.
  >goto +020
    Go forward 16 bytes (using octal) from current position.
  >goto -5
    Go backward 5 bytes (using decimal) from current position.
  >goto %45
    Go to position 45% within document (45% of total size).

To view available commands, execute `ddhx --help-commands`.

//
// Configuration
//

The editor can be configured at runtime using the "set" command.

For example, changing the character set:
  >set charset mac

Runtime configurations do not persist across sessions.

Many of these configuration parameters can be set using the Command-Line
Interface. For example, both "-c" and "--columns=" map to the "columns"
configuration.

To view available configuration options, execute `ddhx --help-configs`.

//
// Compiling
//

To compile this project, you'll need a D compiler and DUB.

All major compilers are supported (DMD, GDC, and LDC). LDC, GDC, and DUB are
typically available in package repositories as gdc/gdc-*/gcc-gdc, ldc2, and
dub.

Compile a debug build:
  $ dub build
Compile a release build using a specified compiler:
  $ dub build -b release --compiler=ldc2

//
// Debugging
//

Run unit tests (useful for new platforms):
  $ dub test
Run unit tests with log traces:
  $ dub test --d-version=Trace

Environment variables:
- DDHX_LOG=PATH
  - If set, start logging to PATH.
- DDHX_BACKEND=BACKEND
  - If set, forces BACKEND to be selected, if it exists.
  - Backends: "chunk" (default), "piece"
- DDHX_CHUNKSIZE=SIZE
  - If set, sets chunk size to SIZE (binary suffix) for the chunk backend.

About

πŸͺ„ dd's hex editor

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages