- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.224.38.170
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/perl-Expect/tutorial/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/perl-Expect/tutorial/4.A.top
#!/usr/bin/perl
#	This example is a replay of sorts of the rlogin example
#before except in this example we turn control of the process back
#to the user through use of interact().

use Expect;
	
# $Expect::Debug=2;
 $Expect::Exp_Internal=1;

$RSH='/usr/local/bin/ssh';

$host_to_login_to=shift(@ARGV);

# Get the password. We will show how to do this without printing the
# password to the screen later.
print "Enter password: ";
$password=<STDIN>;
chomp $password;



$rsh=Expect->spawn($RSH,$host_to_login_to);

# Look for a password prompt.
$rsh->expect(30,'-re','word:\s$')||(die"Never got password prompt\n");

print $rsh "$password\r";

# Look for a prompt. Prompt can be # $ > or ] followed by a whitespace.
$prompt  = '[\]\$\>\#]\s$';

# Note the use of -re
$rsh->expect(30,'-re',$prompt)||(die "Never got prompt on host\n");

# Start top
print $rsh "exec top\r";

# OK, now return control to user.
$rsh->interact();



Youez - 2016 - github.com/yon3zu
LinuXploit