HP J4813A ProCurve Switch 2524 - Telnet using variables.
Hello!
I am facing some issues running backup on HP J4813A ProCurve Switch 2524 using Telnet (Switch doesnt support SSH-2) using variables instead of hard-coded credentials.
Here is the "prompt" line i use:
prompt /(^\r|\e\[24;[0-9][hH])?([\w]+[>#]+[\s]+)+($|(\e\[24;[0-9][0-9]?[hH]){3})/
And i also updated the "cfg :telnet do" section to match prompts:
Please Enter Login Name:
Please Enter Password:
cfg :telnet do
username /(Please\sEnter\sLogin\sName\:\s?)|(Username\:\s)/
password /(Please\sEnter\sPassword\:\s?)|(Password\:\s?)/
end
The issue im facing is that it never goes into enable mode to change prompt from ">" to "#" when i use variables.
I beleve its having a hard time to understand the feedback that comes up when i enter "enable" in prompt:
XXXX_SW> en
Please Enter Login Name: crinil
Please Enter Password:
This works:
cfg :telnet, :ssh do
# preferred way to handle additional passwords
if vars :enable
post_login do
send "enable\n"
send "oxidized\n"
send "mypassword\n"
end
end
post_login 'no page'
pre_logout "logout\ny\nn"
end
This doesn´t work:
cfg :telnet, :ssh do
# preferred way to handle additional passwords
if vars :enable
post_login do
send "enable\n"
send "oxidized\n"
cmd vars(:password)
end
end
post_login 'no page'
pre_logout "logout\ny\nn"
end
I would like for "send "oxidized\n"" to be a variable and same for "send "mypassword\n"".
Please advice me how i can skip hard-coded credentials in the .rb file to instead use variables?
//CN
It does not work with Procurve model: https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/procurve.rb ?