by Jeremy Canfield | Updated January 31st, 2018
The following Perl script can be used to execute a command on a remote host.
#!/usr/bin/perl use Core; my $user = "username"; my $pass = "password"; my $host = "hostname of the target server"; my $command = "the command you want to run on the target server"; ($stdout, $stderr, $exit) = create_shell($host, $user, $pass); ($stdout, $stderr, $exit) = execute_shell_inline($host, $user, $command);
If you want to prompt a user for input, make sure to use chomp.
my $user = <STDIN>; chomp($user);