Subject: | Bash PB Question |
First of all, Thanks for your excellent software.
The belowing info is my environment
OS: Cent OS 2.6.32
perl :v5.10.1
net:appliance:session version: lates
I test bash pb with my own linux host with belowing script
==============
use Net::Appliance::Session;
my $s = Net::Appliance::Session->new({
personality => 'bash',
transport => 'SSH',
host => '192.168.110.129',
privileged_paging => 1,
});
$s->set_global_log_at('notice');
try {
$s->connect({ password => '123*456' });
print $s->cmd('whoami');
}
catch {
warn "failed to execute command: $_";
}
finally {
$s->close;
};
==============
I debug the whole process while the script's running and find it is
going to privilege mode immediately after 'connect' method even no
begin_previlege method in the script. Please see following the debug
output (please check line with head [1.240975]):
[yliu@localhost test]$ perl Linux_SSH.pl
[0.035455] p finding prompt
[0.051342] t creating Net::Telnet wrapper for ssh
[0.062944] t connecting with: ssh -o StrictHostKeyChecking=no -o
UserKnownHostsFile=/dev/null -o CheckHostIP=no 192.168.110.129
[0.598659] p output matching prompt was "yliu@192.168.110.129's
password: "
[0.605699] p finding prompt
[1.221666] p output matching prompt was "[yliu@localhost ~]$ "
[1.240975] e running macro begin_privileged
[1.246655] e executing actions
[1.262767] t queueing data for send: "sudo su -"
[1.419738] p output matching prompt was "[sudo] password for yliu: "
[1.424664] e running command 123*456
[1.429580] e executing actions
[1.434439] t queueing data for send: "123*456"
[1.761632] p output matching prompt was "[root@localhost ~]# "
[1.770223] e running macro paging
[1.774703] e executing actions
[1.781214] t queueing data for send: ""
[1.790702] p output matching prompt was "[root@localhost ~]# "
[1.793147] e running macro end_privileged
[1.795802] e executing actions
[1.799884] t queueing data for send: "exit"
[1.830832] p output matching prompt was "[yliu@localhost ~]$ "
[1.834285] e running command whoami
[1.836851] e executing actions
[1.841947] t queueing data for send: "whoami"
[1.865693] p output matching prompt was "[yliu@localhost ~]$ "
yliu
[1.873366] e running macro begin_privileged
[1.875615] e executing actions
[1.878681] t queueing data for send: "sudo su -"
[2.154156] p output matching prompt was "[root@localhost ~]# "
[2.158393] e running macro paging
[2.162247] e executing actions
[2.166211] t queueing data for send: ""
[2.172790] p output matching prompt was "[root@localhost ~]# "
[2.176751] e running macro end_privileged
[2.181621] e executing actions
[2.186902] t queueing data for send: "exit"
[2.208253] p output matching prompt was "[yliu@localhost ~]$ "
[2.211426] e running macro disconnect
[2.214598] e executing actions
[2.219078] t queueing data for send: "logout"