Commit caa280f6 authored by 孙 楠's avatar 孙 楠

适配jumpserver

parent c397da5e
......@@ -5,10 +5,10 @@ if [ -n "$AUTO_LOGIN_HOME" ] ; then
. "$AUTO_LOGIN_HOME/config"
token=$(python3 "$AUTO_LOGIN_HOME/onetimepass.py")
# echo ${token}
expectlogin.sh ${username} ${password} ${host} ${token}
expectlogin.sh ${username} ${password} ${host} ${token} ${port}
else
echo "AUTO_LOGIN_HOME not config"
. config
token=$(python3 onetimepass.py)
./expectlogin.sh ${username} ${password} ${host} ${token}
./expectlogin.sh ${username} ${password} ${host} ${token} ${port}
fi
\ No newline at end of file
username=name
password=password
host=fort-qz.quantgroups.com
host=jumpserver.quantgroups.com
secret=XXXXXXX
port=2222
\ No newline at end of file
......@@ -12,14 +12,15 @@ set username [lindex $argv 0]
set password [lindex $argv 1]
set host [lindex $argv 2]
set otp [lindex $argv 3]
set port [lindex $argv 4]
set timeout 10
spawn ssh "${username}@${host}"
spawn ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa "${username}@${host}" -p "${port}"
expect {
"Password"
{send "$password $otp\n";exp_continue}
"Select group"
{send 0\n0\n;exp_continue}
"password"
{send "$password\n";exp_continue}
"OTP Code"
{send "$otp\n";exp_continue}
}
interact
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment