libssh2

phpseclib SSH2 write not executing long command

狂风中的少年 提交于 2020-01-06 06:30:15
问题 I am trying to execute an SSH command to a device (firewall). Command is executed when the length is short. When the length is about 1000 characters, command is not being executed. When I execute the command via putty, that is working as well. After reading few solutions, I tried to set timeout to 5 seconds. Still, no help. In the device logs, I can see SSH login and logout. But no activity. I am using phpseclib ssh version 2.0 $ssh = new SSH2(ip_address); $ssh->login($user, $password); $ssh-

Reverse Port Forward using libssh2 on iOS

情到浓时终转凉″ 提交于 2020-01-02 01:48:25
问题 I'm looking for some example code of a reverse port forward on iOS using libssh2. Here's a close example: Example code of libssh2 being used for port forwarding But I'd like it to be tailored to iOS and objective-C if possible. Straight C is fine too. I'm wary of the socket and FD code, and would rather have a robust solution than the one I'm hacking up. I've tried RTFMing libssh2 for a while, but it ends up being just RTF Code... and I'm not confident enough in my C code to do this

Stream of data through NMSSH

我的梦境 提交于 2019-12-25 07:16:22
问题 Hi I want to develop an SSH application for OSX and i have been looking into NMSSH, which is built on libssh2. How can I handle the following use case: The application user sends a ping command to the server. => the result is continious responses NMSSH's approach is send a command get a response and put that in a NSString, see below. But how can i handle a case with for instance ping where the response goes on and on. Do I need to use another SSH package for this functionality? NMSSHSession

PHP ssh2_exec, executing multiple commands at once

孤街浪徒 提交于 2019-12-24 20:35:22
问题 I'm using ssh2_exec to execute a few commands from PHP on my CentOS servers, and I have used it many times, but today, when I tried making it do 4 or 5 commands at once with &&, it did not work. Here is the code below: if (!($stream = ssh2_exec($con, 'cp -rf /home/shared/Tekkit_Server_3.1.2.zip /home/servers2/'.$mUsername.' && unzip /home/servers2/'.$mUsername.'/Tekkit_Server_3.1.2.zip && rm -rf /home/servers2/'.$mUsername.'/mods/mod_NetherOres.jar && mv -f /home/servers2/'.$mUsername.'

Waiting for command to finish using SSH2_Shell in PHP

牧云@^-^@ 提交于 2019-12-24 10:09:29
问题 I have an SSH2_Shell session working in PHP. my issue is that i need a command to completely finish before moving onto the next command. Here is my code so far: $command_capture = "cd /mnt/NADS/scripts/"; $command_capture2 = "./tcpdump.sh $capture_name $sleep"; if (!($connection = ssh2_connect("172.20.1.18", 22))) { echo "fail: unable to establish connection"; } if (!ssh2_auth_password($connection, "root", "Hideandseek")) { echo "fail: unable to authenticate"; } $stream = ssh2_shell(

How to send a file using scp using python 3.2?

て烟熏妆下的殇ゞ 提交于 2019-12-24 04:12:10
问题 I'm trying to send a group of files to a remote server through no-ack's python byndings for libssh2, but I am totally lost regarding the library usage due to the lack of documentation. I've tried using the C docs for libssh2 unsuccesfully. Since I'm using python 3.2, paramiko and pexpect are out of the question. Anyone can help? EDIT: I just found some code in no-Ack's blog comments to his post. import libssh2, socket, os SERVER = 'someserver' username = 'someuser' password = 'secret!'

Installing SSH2 for PHP to run on a Xampp Apache server on a OSX 10.9.1

我们两清 提交于 2019-12-22 10:43:57
问题 I am running Xampp on a Mac with OS X 10.9.1 and I am trying to develop a web page that calls a PHP script through an Ajax call. Xampp is used here for development purposes and it is not intended to form the backend of an online page. A PHP script needs to connect though ssh to a remote machine, reason for which I plan to use the ssh2 library. When I try to run the commands: $connection = ssh2_connect('my.remote.machine.address', 5432); I get the following error: Fatal error: Call to

PHP ssh2_connect() Implement A Timeout

时光毁灭记忆、已成空白 提交于 2019-12-21 10:49:40
问题 I am using the PHP ssh2 library, and simply doing: $ssh = ssh2_connect($hostname, $port); The problem is I want to set a timeout, i.e. after 5 seconds stop trying to connect. As far as I can tell the ssh2 library does not support a timeout on connect natively. How can I implement a timeout wrapper? 回答1: I know this is an old thread, but the problem is still there. So, here is the solution for it. ssh2_connect() uses socket_connect() . socket_connect relies on the php ini configuration

PHP Install SSH2 on Windows machine

被刻印的时光 ゝ 提交于 2019-12-17 03:18:12
问题 I am trying to install this on a Windows+Apache machine. Documentation says that SSH2 requires the OpenSSL and libssh2 libraries. I have added this lines in my php.ini file: extension=php_openssl.dll extension=php_ssh2.dll and restarted Apache but it still not working ( Fatal error: Call to undefined function ssh2_connect() ). Can anyone explain me how to install this service? Thanks ps: i'm italian, sorry for my english... 回答1: Here's how I did it: Downloaded Win32 SSH2 PECL extension from

Which PHP value has a timeout of 900 seconds?

房东的猫 提交于 2019-12-14 03:29:05
问题 I have a script that is called over apache 2.4 on Ubuntu 14.10. All sites work fine but one that doesn't work on one of my computers. The page-generation dies after exactly 900 seconds (15 Minutes). In my /etc/php5/apache2/php.ini there is no such timeout. What could it be, that waits 900 seconds before it timeouts? Here is my php.ini I have installed php5-ssh2, mysql, ... everything standard debian Ubuntu otherwise EDIT: could it be connected with nfs? Because the only value of 900 in my