#!/bin/bash
# repeatedly print status information of all currently running
# john sessions

# adjust name of binary if necessary
JOHN="john"

while true; do

#	send a signal to all currently running john sessions, so that they
#	write their status progress to the .log file, the .rec file,
#	and cracked hashes and passwords into the .pot file
	killall -s 1 $JOHN

#	identify the .rec files that were recently changed 
#	(less than 2 minutes ago) and print status update for all of these.

	for session in `find . -type f -name "*.rec" -print|sed 's#\./\(.*\)\.rec$#\1 #'|tr -d '\n'`; do 

		echo "Session: $session"

#		./john --status gets the status information from the .rec file
		./$JOHN --status=$session;

	done

#	repeat every 5 minutes
	sleep 300
done

