Giter Site home page Giter Site logo

hexcurse's Introduction

hexcurse v1.60.0

Build Status

hexcurse screenshot

Bug reports: https://github.com/LonnyGomes/hexcurse/issues

Description

Hexcurse is a curses-based hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values.

It was written by Lonny Gomes and James Stephenson but we haven't maintained it for some time. We recently saw an old tarball of the code floating around the net and thought it would be good to start maintaining the codebase again.

It currently supports searching, hex and decimal address output, jumping to specified locations in the file, "undo" capabilities, "bolded" modifications, EBCDIC mode, and quick keyboard shortcuts to commands.

Requirements

You must have the ncurses development libraries (version 5+) to compile this program

Installation

./configure
make
make install

Usage

usage: hexcurse [-?|help] [-a] [-r rnum] [-o outputfile] [[-i] infile]

    -a          Output addresses in decimal format initially
    -e          Output characters in EBCDIC format rather than ASCII
    -r rnum     Resize the display to "rnum" bytes wide
    -o outfile  Write output to outfile by default
    -? | -help  Display usage and version of hexcurse program
    [-i] infile Read from data from infile (-i required if not last argument)

Keyboard shortcuts

│ CTRL+?    Help     - help screen
│ CTRL+S    Save     - saves the current file open
│ CTRL+O    Open     - opens a new file
│ CTRL+G    Goto     - goto a specified address
│ CTRL+F    Find     - search for a hex/ascii value
│ CTRL+A    HexAdres - toggle between hex/decimal address
│ TAB       Hex Edit - toggle between hex/ASCII windows
│ CTRL+Q    Quit     - exit out of the program
│ CTRL+U    Page up  - scrolls one screen up
│ CTRL+D    Page down- scrolls one screen down
│ CTRL+Z    Undo     - reverts last modification
│ CTRL+T    Home     - returns to the top of the file
│ CTRL+B    End      - jumps to the bottom of the file

hexcurse's People

Contributors

barbeque avatar errge avatar felgru avatar fornwall avatar imrivera avatar kerrigan29a avatar lonnygomes avatar nonerkao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hexcurse's Issues

copyright differences

LICENSE.txt is GPL-3, but all around the code in the C file headers GPL 2 is mentioned

Won't build on Manjaro

I get this error when i run make

`$ make

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/marbangens/Code/build/hexcurse/hexcurse/missing aclocal-1.15
/home/marbangens/Code/build/hexcurse/hexcurse/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
http://www.gnu.org/software/automake
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
http://www.gnu.org/software/autoconf
http://www.gnu.org/software/m4/
http://www.perl.org/
make: *** [Makefile:337: aclocal.m4] Error 127
`

Show help if no arguments are provided

Currently, if hexcurse is run without arguments it shows the ncurses UI and you must use the keyboard shortcuts to open the file you want to edit. It turns out this isn't that helpful. Instead, show the help if hex curse is run without arguments.

faster search

Hello,

because I sometimes analyze memory dumps with hexcurse, I needed a faster search - so I implemented the Boyer–Moore string search algorithm to the hexSearch() function. It works fine for me, but it's a bit crude now (for example it doesn't work for edited files), but if you are interested, I can send you the full "patch".

Sample code:

// algorithm based on the wikipedia example
off_t hexSearchBM(FILE *fp, int pat[], off_t startfp, size_t patlen)
{
    if (! (pat && patlen > 0)) return -1;

    size_t      i, m = 1;
    int         j = patlen - 1;
    size_t      delta1 [ ALPHABET_LEN ];
    size_t      *delta2 = (size_t *)malloc(patlen * sizeof(size_t));

    char        *buf;
    char        *patt = (char *) malloc(patlen);

    if (posix_memalign((void **)&buf, getpagesize(), BUF_L) != 0)
        return -1;

    if (! (delta2 && patt)) return -1;

    make_delta1(delta1, pat, patlen);
    make_delta2(delta2, pat, patlen);
    for (i = 0; i < patlen; i++) patt[i] = (unsigned char) pat[i];

    size_t  n, rem_bytes = 0, bytes_to_read = BUF_L, full_length;
    off_t   pos1, pos2;

    fseeko(fp, startfp, SEEK_SET);          /* begin from loc     */

    pos1 = pos2 = startfp;
    while (true) {
        n = fread(&buf[rem_bytes], 1, bytes_to_read, fp);
        full_length = n + rem_bytes;
        if (n == 0 || full_length < patlen) break;
        pos2 = pos1 + full_length;

        i = patlen - 1;
        while (i < full_length) {
            j = patlen - 1;
            while (j >= 0 && (buf[i] == patt[j])) {
                --i;
                --j;
            }
            if (j < 0) {
                free(buf); free(patt); free(delta2);
                return (pos1 + i + 1);
            }

            m = max(delta1[(unsigned char) buf[i]], delta2[j]);
            i += m;
        }

        rem_bytes = full_length + m - i - 1;
        if (rem_bytes > full_length) rem_bytes = full_length;

        bytes_to_read = BUF_L - rem_bytes;
        memmove(buf, &buf[full_length - rem_bytes], rem_bytes);
        pos1 = pos2 - rem_bytes;
    }

    free(buf);
    free(patt);
    free(delta2);

    return -1;
}

Does not build w/automake 1.16.1

The source is harcoded with the 1.15 version of the make tooling, and won't build on my version automake-1.16.1-noarch-1. No big deal though.

hexcurse exit after failed save&exit

When I try to edit a read-only file on the filesystem and choose exit, hexcurse asks me if I want to save it first. So far so good, but when I choose yes, it tells me "bad permission" and then exits. Therefore I lose all my current changes. Instead, it should continue running, so I can handle the issue. Either by getting permissions in an another terminal window or saving as a different filename.

Feature request: color UI & highlighting

I'd like to be able to change from the white UI to something different (so that the hex is different to the ascii and the rest of the UI).

Also would be really nice if there was an option/parameter to highlight/color change different hex strings (pixel/hexedit does this with --color for example, 00 is colored differently etc)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.