29 lines
697 B
Bash
29 lines
697 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
LOG_SERVER_TO_CLIENT=./log_s2c.log
|
|
LOG_CLIENT_TO_SERVER=./log_c2s.log
|
|
TARGET_SERVER="irc.example.org"
|
|
|
|
CLIENT_RUNTIME="./tiger-bot.bin"
|
|
COMMS_RUNTIME="openssl s_client -connect $TARGET_SERVER:6697"
|
|
|
|
# Ensure logs are new
|
|
rm -f "$LOG_CLIENT_TO_SERVER"
|
|
rm -f "$LOG_SERVER_TO_CLIENT"
|
|
touch "$LOG_CLIENT_TO_SERVER"
|
|
touch "$LOG_SERVER_TO_CLIENT"
|
|
|
|
# Begin communication
|
|
echo "Beginning connection..."
|
|
tail -f -n 0 "$LOG_CLIENT_TO_SERVER" | eval $COMMS_RUNTIME >> "$LOG_SERVER_TO_CLIENT" &
|
|
|
|
echo "Waiting for SSL handshake to complete..."
|
|
sleep 1
|
|
|
|
echo "Starting bot..."
|
|
tail -f -n 0 "$LOG_SERVER_TO_CLIENT" | eval $CLIENT_RUNTIME >> "$LOG_CLIENT_TO_SERVER"
|
|
|
|
#echo "Bot started!..."
|
|
|