hexnet
Using linux as the basis for complex testing systems I quite often
have to create applications talking to devices like measurement
instruments or RFID controllers via IP based network connections. As in the
days of RS232/423/485, many of those devices like to communicate using their
very own very special protocol containing control characters, checksums,
size informations … at some place within the data.
Additionally device documentations are not always distinct and sometimes
erroneous, too.
Therefore it is a good idea to test communications using an universal tool
before creating the application. For serially connected devices (yes, there
are still some out there) I am very happy with Moserial,
but could not find anything similar for networked devices. One might consider
to use ncat, and I did, too, in the past.
You can send every character with ncat, but receiving control characters is
dissatisfying.
Thus I decided to write a tool of my own, very minimalistic, just with basic
functionality and created hexnet.
Hexnet is a console based appliction for testing of binary communications. It
accepts multiple pairs of characters interpreting each pair as a hexadecimal
number.
Pairs may optionally be delimited by any character, e.g. "2a:45" or "44 4c".
Lower and upper case letters are both accepted.
Data is send to a host specified by IP address and port, received data can be
displayed in different formats.
Installation
- Download and unpack hexnet-1.1.1.tar.gz.
- Change to directoy hexnet-1.1.1.
- Compile
As I provide neither a Makefile nor any autotools compliant files, you need to call
the compiler directly:
gcc -O2 -Wall -c cmdline.c hexnet.c hexnetfunctions.c
Link
Call the compiler to link the object files:
gcc -O2 -Wall -o hexnet cmdline.o hexnet.o hexnetfunctions.o
Install
Install the hexnet executable and man page, e.g.:
install -v -m755 hexnet /usr/bin/
install -v -m644 hexnet.1 /usr/share/man/man/
Test
- Set up ncat invoking a shell in one terminal:
ncat -l 127.0.0.1 8888 --sh-exec "/bin/sh" --keep-open
Start hexnet in a different terminal:
hexnet -a "127.0.0.1" -p 8888 -m 256 -f0
Execute pwd by hexnet and watch the output:
70 77 64 0a
Kill hexnet (^C) and start again with a different output format:
hexnet -a "127.0.0.1" -p 8888 -m 256 -f2
Execute pwd by hexnet again:
70 77 64 0a
Release Info
Hexnet is provided "as it is", currently I do not plan to add any features.
However, this might happen from time to time. Current release is
hexnet-1.1.1.tar.gz, the original one can be found here.
Hexnet is released under GPL3, so feel free …
If you find any bugs, you might contact me:
the.druid[at]arcor.de