deus_networkus/Modules/telnet_connect_cisco.sh
2025-07-30 15:34:21 +03:00

17 lines
616 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /usr/bin/expect
#Используем модуль expect для того, чтобы принимать запросы и отвечать на них
set timeout -1
#Устанавливаем переменные, значения для которых приняли при вызове функции
set ip_address [lindex $argv 0]
set user [lindex $argv 1]
set pass [lindex $argv 2]
#Подключаемся с помощью telnet
spawn telnet $ip_address 23
#В ответ на запросы передаём ответы
expect "username:"
send "$user\r"
expect "password:"
send "$pass\r"
interact