phpseclib

phpseclib sftp->put() command: File contents are just a string, not the expected PDF document

折月煮酒 提交于 2020-04-11 08:23:06
问题 I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put(); CODE: $sftp = new SFTP($config::SFTP_SERVER); // login to remote server if (!$sftp->login($config::SFTP_USER, $config::SFTP_PASSWORD)) { throw new Exception('Login failed'); } // move to relevant directory $sftp->chdir('fatca'); // upload file $uploadFile = $sftp->put('test-pdf-upload.pdf', '/srv/www/vhosts/stage.johno.com/fatca/src/uploads/pdfs/345-553453-434__05122017_16:45:26.pdf', NET_SFTP

phpseclib $X509->setDomain on CSR?

你。 提交于 2020-02-06 04:38:49
问题 Is it possible to set x509 v3 extended attribute for subjectAltName on a CSR? I am able to successfully generate a CSR, and then pass that to a CA to sign. The CA is able to call functions like X509->setDomain("bob.com","*.bob.com","asdf.org"); and they appear in the final cert without issue (note: i am doing the sign, reload, set extensions, resign workaround for phpseclib). The CSR process calling the same functions $X509->setExtension("id-ce-subjectAltName",array("names","here") ) or $X509

Why does SFTP via PHP fail, but succeeds in FileZilla on my Windows 8.1 machine?

邮差的信 提交于 2020-01-24 18:46:04
问题 In PHP, I cannot even get the SFTP connection to work. I have tried to use the native SFTP functionality (ssh_connect), and it fails to connect. I have also tried to use phpseclib, but it fails as well. Neither of my aforementioned attempts have provided much in the way of log info. The native code: if (!function_exists('ssh2_connect')) { echo "dll not loaded properly"; //never see this, so I know it works return false; } $connection = ssh2_connect('sftp.example.com', 22); ssh2_auth_password(

phpseclib asn1 encoding structure

夙愿已清 提交于 2020-01-15 12:07:18
问题 I'm trying to use phpseclib ASN1.php and i have a map like below; $IdentityObjectMap = array('type' =>FILE_ASN1_TYPE_SEQUENCE, 'children'=> array( 'identityIdentificationData' => array('type'=>FILE_ASN1_TYPE_SEQUENCE, 'children'=> array( 'version' => array('type' => FILE_ASN1_TYPE_IA5_STRING), 'staticData' =>array('type' => FILE_ASN1_TYPE_SEQUENCE, 'children'=> array( 'acceptedPolicyVersion' => array('type' =>FILE_ASN1_TYPE_IA5_STRING), 'cardHolderID' => array('type' =>FILE_ASN1_TYPE_INTEGER)

php ssh connection phpseclib

ぃ、小莉子 提交于 2020-01-11 13:01:31
问题 System: Linux Server: XAMPP Goal: ssh-connection to a server (later: doing some stuff on this server, not part of this question) Test-Code: <?php set_include_path(get_include_path().PATH_SEPARATOR.'/home/myusername'); include('Net/SSH2.php'); $ssh = new Net_SSH2('123.45.6.78'); if (!$ssh->login('user', 'password')) { exit('Login Failed'); }else{ echo "connected".'<br>'; echo $ssh->exec('whoami').'<br>'; echo $ssh->exec('hostname')).'<br>'; } ?> Output: connected (M4300-28G-PoE+) > (M4300-28G

Slow response to a recursive rawlist request in phpseclib

梦想与她 提交于 2020-01-07 04:24:08
问题 I wrote a PHP program that performs a rawlist function on a remote server with many (about 1000) directories. The phpseclib SFTP rawlist method works, but it takes over 12 minutes to traverse the directory tree on the server. On the other hand, the plain old FTP rawlist function (ftp_rawlist) returns the same results in about 30 seconds. I understand that an SSH connection adds overhead because of encryption, but this seems excessive. I've had the same SFTP results from PHP 5.3 and 5.4

PHPSECLIB ssh2 \n not working

北城余情 提交于 2020-01-06 06:39:10
问题 So i am removing into a old server running a old IBM OS and GUI when i go to log in I run command: $ssh->write("username\n"); $ssh->write("Passw0rd"); However it just outputs Type Your ID username Type your Password Its as if the \n never worked. 回答1: The system is in the most abstract way is a old windows machine. \n works on modern machines but the older windows use \r Using \r Resolved the issue. 来源: https://stackoverflow.com/questions/45790738/phpseclib-ssh2-n-not-working

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-

how can I run a perl script which needs root?

冷暖自知 提交于 2020-01-05 07:59:05
问题 I need to execute a perl script located in /root/scripts/ from php using ssh from another computer or from the same computer. The thing is that I just don't know how to make php log into roots account to excecute only that file. As user$ I can't access /root/scripts/, so I can't call it using excec or system. I have tried using ssh to log into sudo su, and when I give my password it hangs. I leave the code here: <?php include('Net/SSH2.php'); $ssh = new Net_SSH2('IP'); if (!$ssh->login('user'

connect to the mysql database using phpseclib library

百般思念 提交于 2020-01-03 01:35:07
问题 I have successfully connect to the My VPS using phpscelib library.Now i want to connect to my existing database.Please help me for this ? <?php set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib'); include('Net/SSH2.php'); $ssh = new Net_SSH2('192.ccc.ccc.ccc'); if (!$ssh->login('ccc', 'cccc')) { exit('Login Failed'); } echo $ssh->exec("I need to put MySql commands here"); ?> 回答1: First, wouldn't it be better to allow remote access for that user to mysql? However, I don't know