“Empty” gets more mentions in hacking, IT security and science

Celebrating another birthday of Empty – my expect-like tool to automate interactive tasks.

Though, I didn’t pay much attention to it for some time, it collects more and more mentions over Internet. It looks like Empty is mostly useful in hacking, IT-security, science and even teaching.

After more then 10 years from the first release in August, 2005 it has around 500 downloads per month and now you may find it everywhere from computing clusters to embedded systems, various small Raspberry (and not only) devices, routers, modems and so on. And here are the most intriguing references and usage cases.

Expect article in Wikipedia mentions Empty in Alternatives section:

Drones Hacking Drones by Darren Kitchen and Hak5:

PARROT DRONES HIJACKING by Pedro Cabrera for RSA Conference

Network Performance and Security: Testing and Analyzing Using Open Source and low-cost tools by Chris Chapman

Transplanting Binary Decision Trees by Eli M. Dow and Tim Penderghest from Clarkson University

Posted in empty, Impressions, My projects | Tagged , , , , , , | Leave a comment

IPv6 multicast ping in Python

In the meantime, I continue to reinvent the wheel: just added IPv6 multicast ping to my small ICMP script collection in Python.

	sp_mping6.py -i interface [-a address] [-m ttl] [-t timeout] [-v]

	-i				interface Interface to work on
	[-a address]	IPv6 multicast address to ping or ff02::1
	[-m ttl]		TTL of outgoing packets. Default is 64
	[-s number]		Packet sequence number: 0-65535. Default is 0
	[-t timeout]	Timeout on socket. Default is 5
	[-v]			Be verbose (show more info about packets)

Note! You must be root to run this program.

And finally, sp_ping project page is here. Sources are there.

Posted in My projects, sp_ping | Tagged , , , , , | 1 Comment

My ICMP ping supports IPv6 now

Wohoo! This Sunday was awesome: I have just added IPv6 support to my own ICMP ping implementation in Python 3. Amazing, but it works:
I’m not sure about Linux, but it successfully pings Google from my small FreeBSD box 🙂

Posted in My projects, sp_ping | Tagged , , , , | Leave a comment

Compare two regular or device files block by block

Yes, there are a number of utilities like cmp, bdiff and etc that allow to compare binary files and even create patches. Anyway, here is my script, which I hope, will ease tracking changes on block granularity within storage volumes and partition images while I’m working on the BeaST storage system and the BQ daemon.

bfcmp.sh - Compare two regular or device files block by block

    bfcmp.sh -s /path/to/src.bin -d /path/to/dst.bin [-b size][-v 0-3][-f][-D]

    -s  Source file to compare [SRC]
    -d  Destination file [DST]
    -b  Block size. Default is 512 bytes
    -v  Verbosity level 0 to 3. Default is 2
    -f  Enable fullscan mode. Continue to scan for different blocks even
        if [SRC] and [DST] filesizes are different
    -D  Enable debug mode

UPD 2018.07.27 To pair bfcmp.sh a new script to “patch” destination file is added:

bfmerge.sh - Compare and merge two regular or device files block by block

	bfmerge.sh -s /path/to/src.bin -d /path/to/dst.bin [-b size][-v 0-2][-BfD]

	-s	Source file to compare [SRC]
	-d	Destination file [DST]
	-b	Block size. Default is 512 bytes
	-v	Verbosity level 0 to 2. Default is 1
	-f	Enable fullscan mode. Do not stop if [SRC] and [DST] filesizes differ
	-D	Enable debug mode

I was trying to keep old school Bourne shell syntax while writing both scripts. Everything should run on FreeBSD, Mac OS and Linux.

Posted in BeaST, BeaST Quorum, Storage, Storage Automation | Tagged , , , , , , | Leave a comment

Printing lines side by side in shell

Everybody knows, there is paste command in every *NIX to print two files side by side or join which is obviously used to join text-files by their key-fields. And there are a lot of examples and tutorials over Internet, so the subject is as trivial as cat-ting files together with right command-line options.

Ah, wait… What if we have textual data stored not in files but in two variables as a result, for example, of piping or redirection?

Imagine there’s no heaven two variables:

a="aa qq
bb ww
cc ee"

b="11 44
22 55
33 66"

And we want to see this as the result:

aa qq | 11 44
bb ww | 22 55
cc ee | 33 66

It’s not an issue having Bash and arrays:

#!/usr/bin/env bash

a="aa qq
bb ww
cc ee"

b="11 44
22 55
33 66"

IFS=$'\n' read -d '' -a a_arr <<< "$a"
IFS=$'\n' read -d '' -a b_arr <<< "$b"

for  i in ${!a_arr[@]}; do
	echo ${a_arr[i]} "|" ${a_arr[i]}

The main trick is done with read command which stores lines in arrays, while the rest is just a loop which scans arrays to print lines with the same index.

But life is not always easy and sometimes one could still deal with pure old Bourne shell without any hints on arrays where set command was utilised to create $@ array of $1 to $n elements. Agree, this is not always handy.

So, in the worst case it’s always possible to use a counter variable and an external tool to scan over the strings. For example, awk:


a="aa qq
bb ww
cc ee"

b="11 44
22 55
33 66"

echo "$a" | while read -r ln; do
	cnt=`expr $cnt + 1`
	printf "$ln | "
	printf "$b" | awk -v c="$cnt" 'NR==c {print}'

or even like this:


a="aa qq
bb ww
cc ee"

b="11 44
22 55
33 66"

for l in $(seq 1 `wc -l <<< "$a"`); do
	awk -v l="$l" 'BEGIN {ORS=" | "} NR==l {print}' <<< "$a"
	awk -v l="$l" 'NR==l {print}' <<< "$b"

Keeping in mind external tools and languages, there are much more possibilities to do the task, but lets stop on this for a while 🙂

Posted in Tips & tricks | Tagged , , , , | 10 Comments

Configuring Linux server to work with the BeaST storage system over iSCSI protocol

It’s weekend, so I continue to work on the BeaST storage system.

Here is my small HOW-TO describing multipath connection with the BeaST from a RHEL/Centos Linux server via iSCSI: Configuring Linux server to work with the BeaST storage system over iSCSI protocol.pdf

Posted in BeaST, My projects, Storage | Tagged , , , , , , , , , | Leave a comment

Of course, not all of the scientists are so kind

My funny story as follows. A long time ago I discovered my expect-like tool “Empty” is mentioned in a paper buried somewhere in a book full of scientific articles. Of course, the book wasn’t free. But I was young and so pleasantly surprised to be mentioned somewhere outside my blog that I started my digging.

After a quick investigation I found the exact article and both names of its authors. Unfortunately, it was a dead end, because it wasn’t possible to discover their contacts. But I easily found the email address of that respected professor on the cover of the book. I wrote to him immediately and asked if he could send me the article or at least its fragment where my name and utility are mentioned. Unfortunately, he didn’t reply. After some time, I requested him again. And he asked me what I wanted from him. I repeated my question for the third time. Since then he completely ignored me.

Years later I found the book, scrolled the article to the desired paragraph with my name and read something stunning like that: “Mikhail Zakharov’s utility named “Empty” can’t be used to achieve the goal of the article”.

That pretty much explained me why the professor kept silence 🙂

Posted in empty, Impressions, IRL, Offtop | Tagged , , | Leave a comment