diff --git a/sessionCreator.sh b/sessionCreator.sh index 9f82b6c..5c13a3a 100644 --- a/sessionCreator.sh +++ b/sessionCreator.sh @@ -1,26 +1,29 @@ #!/usr/bin/env bash -echo "Start listening " -####################### -#First check for ssh connection -username=user -TARGET_IP=192.168.7.141 -#ssh $username@$TARGET_IP -p 22 -#going to try something new here -########################### -sudo apt-get install sshpass -y -sshpass -p 'password' ssh $username@$TARGET_IP -p 22 -if [ $(whoami) != $username ]; then - echo "PWNED ! SSH is good " +echo "Start listening..." + +# Define variables +username="user" +TARGET_IP="192.168.7.141" +ssh_password="password" + +# Install sshpass if not already installed +if ! command -v sshpass &> /dev/null; then + sudo apt-get install sshpass -y +fi + +# Try SSH connection +echo "Attempting SSH connection..." +if sshpass -p "$ssh_password" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 "$username@$TARGET_IP" -p 22 "echo connected"; then + echo "PWNED! SSH is good." else - echo "No SSH access" + echo "No SSH access." fi -############################# -echo "Trying Socat access .. . " -socat STDIO TCP4:192.168.7.141:3177 #access Socat -if [ $(whoami) != 'pkvirus' ]; then - echo "PWNED ! Socat is good " + +# Try Socat access +echo "Trying Socat access..." +if echo | socat STDIO TCP4:"$TARGET_IP":3177; then + echo "PWNED! Socat is good." else - echo "No socat access" + echo "No Socat access." fi -##############################