GithubHelp home page GithubHelp logo

madsen / vbindiff Goto Github PK

View Code? Open in Web Editor NEW
471.0 31.0 52.0 145 KB

Visual Binary Diff (VBinDiff) displays files in hex & ASCII and can highlight the differences between 2 files

Emacs Lisp 0.51% C++ 85.96% C 9.89% Makefile 2.01% M4 1.63%

vbindiff's Introduction

VBinDiff - Visual Binary Diff

Visual Binary Diff (VBinDiff) displays files in hexadecimal and ASCII (or EBCDIC). It can also display two files at once, and highlight the differences between them. Unlike diff, it works well with large files (up to 4 GB).

VBinDiff was inspired by the Compare Files function of the ProSel utilities by Glen Bredon, for the Apple II. When I couldn't find a similar utility for the PC, I wrote it myself.

The single-file mode was inspired by the LIST utility of 4DOS and friends. While less provides a good line-oriented display, it has no equivalent to LIST's hex display. (True, you can pipe the file through hexdump, but that's incredibly inefficient on multi-gigabyte files.)

Working with This Repository

This repository uses a submodule to pull in my Free GetOpt package, which makes it a bit trickier to get started with than the average Git repository. Here's how to get started.

  1. Clone this repository and cd into it.
  2. Run git submodule update --init
  3. If you're working on a Unix system, run autoreconf -i

Now you're ready to use the normal ./configure && make process on Unix, or open win32/vbindiff.dsw on Windows.

To build the documentation, you'll also need Perl, Date::Format, and Template-Toolkit. For Windows, I recommend Strawberry Perl, which comes with the necessary modules. On Unix, your distro may have packages, or you can install from CPAN. Package names for some distros are:

  • Arch Linux: perl perl-template-toolkit perl-timedate
  • Gentoo Linux: dev-lang/perl dev-perl/Template-Toolkit dev-perl/TimeDate
  • Ubuntu: perl libtemplate-perl libtimedate-perl

If you're developing on Unix, I suggest you also cp -a tools/post-commit .git/hooks/. That hook will touch configure.ac after each commit that modifies it, causing configure to be regenerated and making AC_REVISION reflect the new commit.

Copyright and License

Visual Binary Diff is copyright 1995-2013 by Christopher J. Madsen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

vbindiff's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vbindiff's Issues

Cannot open files with unicode filenames (Windows)

It returns an error message with them replaced by question marks:

λ "VBinDiff.exe" "CU-25 IC test.xls" "CU-25 IC  测试.xls"
VBinDiff 3.0_beta5, Copyright 1995-2017 Christopher J. Madsen
VBinDiff comes with ABSOLUTELY NO WARRANTY; for details type `vbindiff -L'.

Unable to open CU-25 IC ??.xls: The filename, directory name, or volume label syntax is
incorrect.

Segfault when attempting to compare with empty file (size = 0)

vbindiff segfaults when comparing a file of non-zero size to a file of zero size. While obviously a ridiculous thing to do, I just happened to attempt it by accident after a file transfer failed, leaving me with an empty file.

I've reproduced this @ 57868ac. Unless someone beats me to it, I'll try to be a good neighbor and track this down, updating this issue with more information or a patch. (I might get a chance to look at it Thur/Fri this week....)

Works:

$ dd if=/dev/urandom of=test1.bin count=2
$ dd if=/dev/urandom of=test2.bin count=2
$ vbindiff test1.bin test2.bin

Failure, Segfault

$ rm test2.bin
$ touch test2.bin
$ vbindiff test1.bin test2.bin

FWIW, it appears that things eventually grind to a halt in ConWindow::putAttribs, originating the file2.display() in vbindiff.c.

Program received signal SIGSEGV, Segmentation fault.
ConWindow::putAttribs (this=0x200000000060a728, x=11, y=1, color=cFileDiff, count=2) at curses/ConWin.cpp:200
200   mvwchgat(win, y, x, count, attribStyle[color], colorStyle[color], NULL);
(gdb) bt
#0  ConWindow::putAttribs (this=0x200000000060a728, x=11, y=1, color=cFileDiff, count=2) at curses/ConWin.cpp:200
#1  0x0000000000402f51 in FileDisplay::display (this=this@entry=0x60a600 <file2>) at vbindiff.cpp:497
#2  0x0000000000402568 in main (argc=3, argv=0x7fffffffe498) at vbindiff.cpp:1863

Note that ''this'' looks a little clobbered here, in an interesting way. (Saw a few sprintf's on the way down the call stack...is that a space character that got written over that pointer?)

I'm hoping to take a closer look soon...while I was tempted to suggest a band-aid patch with a quick size check and error message, I think I'll mull it over to see if there's something a little...cleaner?

Horizontal layout

It would be nice if there was an option for horizontal layout, with one file on the left, the other on the right side. This makes sense because most displays are wide instead of high.

Currently the right side of the screen is black and unused.

(basically like binwalk -W file1 file2 | less -R, but more efficient)

Win10x64 VBinDiff.exe: Unable to initialize windows

$ ./VBinDiff.exe ./x0 ./x
VBinDiff 3.0_beta5, Copyright 1995-2017 Christopher J. Madsen
VBinDiff comes with ABSOLUTELY NO WARRANTY; for details type `vbindiff -L'.

VBinDiff.exe: Unable to initialize windows


Reload file(s)

Some change in recent beta versions (or maybe a library in the middle?) broke my workflow.

This might sound like a "spacebar heating" issue, but I use this program a lot while debugging why two binaries don't match, and up until now, I've been able to press the arrow keys to have the view be "refreshed" with new contents of the loaded file(s). Having to close and re-open the program to see the updated diff is a major pain.

For some reason this isn't working now, so I'd like to request an explicit feature: Have a shortcut to refresh the files.

Vbindiff crashes when comparing some files

SUMMARY

Vbindiff crashes when comparing some files.

ENVIRONMENT INFORMATION

lsb_release -a shows:
[...]
Ubuntu 14.04.2 LTS
[...]

vbindiff --version shows:
VBinDiff 3.0_beta4
Copyright 1995-2008 Christopher J. Madsen

STEPS TO REPRODUCE

Execute:
wget https://cloud.githubusercontent.com/assets/2103153/8145148/24394c2a-11fc-11e5-95f9-115ba65c96df.png
wget https://cloud.githubusercontent.com/assets/2103153/8145146/13179848-11fc-11e5-8d0e-d183d183a417.png
vbindiff *.png

Press the End key, press Enter. See the crash of Vbindiff.

It also happens if the user presses the B key instead of the End key. Sometimes pressing the Enter key is not necessary to experiment the crash.

ADDITIONAL COMMENTS

:-) Thank you for Vbindiff!

segfault on hitting F key in Mageia

I maintain vbindiff for Mageia and have just been alerted to this bug report:
https://bugs.mageia.org/show_bug.cgi?id=26780
I am suspecting that it is maybe 6 months old as it is affecting our current stable release and the development branch.

ncurses in Mga7 is ncurses-6.1-20181117.3.1.mga7 which was a snapshot on 17 Nov 2018.

Building locally in Mga7 using current upstream git master clone (manual build and run from build tree without packaging) produces a similar segfault:
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7f867a4 in wresize (win=<optimized out>, ToLines=2, ToCols=31, ToCols@entry=32) at ../../ncurses/base/wresize.c:161 161 if (s == 0) (gdb) bt #0 0x00007ffff7f867a4 in wresize (win=<optimized out>, ToLines=2, ToCols=31, ToCols@entry=32) at ../../ncurses/base/wresize.c:161 #1 0x0000000000407ed5 in ConWindow::resize (this=this@entry=0x40d860 <inWin>, width=width@entry=32, height=height@entry=3) at curses/ConWin.cpp:239 #2 0x000000000040500a in positionInWin (cmd=cmd@entry=19 '\023', width=width@entry=32, title=title@entry=0x409619 " Find ") at vbindiff.cpp:1280 #3 0x0000000000406dd1 in searchFiles (cmd=19 '\023') at vbindiff.cpp:1635 #4 0x0000000000407237 in handleCmd (cmd=<optimized out>) at vbindiff.cpp:1676 #5 0x0000000000403878 in main (argc=<optimized out>, argv=<optimized out>) at vbindiff.cpp:1868

There is a possibility to use ANSI API with UTF-8 now.

          Yes, this is a consequence of using the Windows ANSI API instead of the wide-character version.  I don't really do much Windows programming, and I've never done any I18N work on Windows.  I'm not sure how much work it would be to convert VBinDiff to the W API.  I'd be interested in a patch if somebody wants to try.

The workaround is to rename the file so it can be represented in the selected codepage.

Originally posted by @madsen in #20 (comment)

Project status

The last commits were 2017, is fork project still supported or abandoned?

segfault when opening small files

Vbindiff segfaults when displaying the last line of a file.

  • if the file is short enough to fit in my window, the segfault happens immediately.
  • otherwise, I have to scroll down until the end of file before it segfaults

Vbindiff 3.0 beta 4, built from source with cygwin tools
running on cygwin 2.873 over win8.1

_jean-louis
ps. big thanks for vbindiff Mr Madsen

Missing ncruses include on OpenSUSE

Hi.
I was trying to compile vbindiff in OpenSUSE but It was failing all the time since #include <panel.h> was not founded.

I solve it by just modifing the AM_CPPFLAGS by adding: -I/usr/include/ncurses:
AM_CPPFLAGS = -I$(srcdir)/curses -I/usr/include/ncurses

on Makefile.

Cheers :)

Please merge past pull requests

@madsen Can you please merge those past PR's? I love this tool and use it very often...

Also, would you have any experience on how well it works on a Linux based system? It's not very clear from your README how to do that. Finally, do you think it's possible to port this to Android?

Linux Fork

Introducing: vbl - VBindiff for Linux

vbl

Alive and kicking!

... I originally just wanted to add the backwards search.

QuickSearch

vbindiff

you have some leisure time?

  • create a 4GB file with zeros
  • at the end, overwrite "33 00"
  • search from start with leading zero ("00 33")
  • bad
  • search a string with trailing zero
  • get a coffee ...

One more thing:

vbl 3 is coming soon.

  • with edit insert/delete

some gcc7 warnings

just for the case it is not known:

vbindiff.cpp: In member function ‘void FileDisplay::setByte(short int, short int, Byte)’:
vbindiff.cpp:635:6: warning: ‘%02X’ directive writing between 2 and 8 bytes into a region of size 3 [-Wformat-overflow=]
void FileDisplay::setByte(short x, short y, Byte b)
^~~~~~~~~~~
vbindiff.cpp:635:6: note: directive argument in the range [0, 2147483647]
vbindiff.cpp:659:12: note: ‘sprintf’ output between 3 and 9 bytes into a destination of size 3
sprintf(str, "%02X", b);

Feature Request: Column width

Thank you for a great app! Would be awesome to have a -w tag that would allow specifying the width/number of columns. Thank you.

key for previous difference

I'm aware of enter and space navigating to the next difference.
I'm interested in navigation to the previous difference.

file sizes of power of two crash vbindiff

To reproduce:
$ dd if=/dev/urandom of=rand1024 bs=1 count=1024
$ dd if=/dev/urandom of=rand1025 bs=1 count=1025
$ dd if=/dev/urandom of=rand1026 bs=1 count=1026

$ vbindiff rand1025 rand1026

Scroll to end of file -> OK

$ vbindiff rand1024 rand1026

Scroll to end of file -> Crash

File sizes of 2048 and 4096 bytes crash, too.

Tested with

VBinDiff 3.0_beta4
Copyright 1995-2008 Christopher J. Madsen

and

VBinDiff 3.0_beta5
Copyright 1995-2008 Christopher J. Madsen

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.