#!/bin/bash
SERVER_IP="47.253.147.187"
SERVER_USER="root"
SERVER_PASS="5H0FuZ:2s0q)Lx"

/usr/bin/expect <<EOF
set timeout 30
spawn ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP

expect {
    "password:" { send "$SERVER_PASS\r" }
    "yes/no" { send "yes\r"; exp_continue }
}

expect "#"
send "ls -F /www/server/nginx/conf/\r"
send "ls -F /www/server/nginx/conf/vhost/\r"
send "ls -F /www/server/panel/vhost/nginx/ 2>/dev/null\r"
send "echo '--- EXISTING CERTS ---'\r"
send "find /www/server -name '*.pem' -o -name '*.crt' | head -n 10\r"
send "cat /www/server/nginx/conf/nginx.conf\r"
send "exit\r"
expect eof
EOF
