I have a portable version of Apache and php7 on windows phpseclib1.0.7 . I wanted to expand the lib in order to utilize ssh. using the stock script from the website for testing
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('-Redacted-');
if (!$ssh->login('-Redacted-', '-Redacted-')) {
exit('Login Failed');
}
echo $ssh->read('username@username:~$');
$ssh->write("sudo ls -la
");
$output = $ssh->read('#[pP]assword[^:]*:|username@username:~\$#',
NET_SSH2_READ_REGEX);
echo $output;
if (preg_match('#[pP]assword[^:]*:#', $output)) {
$ssh->write("password
");
echo $ssh->read('username@username:~$');
}
?>
Even with the lack of information it should throw an error but instead it gives me
PHP Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Users\-Redacted-\Desktop\Apache2.2\htdocs\Net\SSH2.php on line 2358
Here is the SSH2.php starting at line 2351
if (isset($this->keyboard_requests_responses)) {
for ($i = 0; $i < $num_prompts; $i++) {
if (strlen($response) < 4) {
return false;
}
extract(unpack('Nlength', $this->_string_shift($response, 4)));
// prompt - ie. "Password: "; must not be empty
Line 2358---- $prompt = $this->_string_shift($response, $length);
//$echo = $this->_string_shift($response) != chr(0);
foreach ($this->keyboard_requests_responses as $key => $value) {
if (substr($prompt, 0, strlen($key)) == $key) {
$responses[] = $value;
break;
}
}
}
}
does anyone have any ideas on how to fix?