Net_SFTP: download file from Miktorik router

Get help with using the PHP Secure Communications Library.

Moderator: Nuxius

Forum rules
The purpose of this forum is to provide support for phpseclib, a pure PHP SSH / SFTP / RSA library.

Posts by new users are held in a moderation queue and are not publicly visible until the post is approved.

Net_SFTP: download file from Miktorik router

Postby panel » Wed Sep 18, 2013 12:20 pm

Hello,

I'm trying to download backup file from Mikrotik router, but it returns me only empty string without any error. I have tried to download with WinSCP and it works correct.

Have anybody same experience or any hints ?

Code: Select all
$sftp = new Net_SFTP($ip, 2222);
if (!$sftp->login('username', 'password')) {
   exit('Login Failed');
}
else {
   print_r($sftp->nlist()); // file appears in list / rawlist with correct filesize
   var_dump($sftp->get('MikroTik-0002.backup', dirname(__FILE__).'/MikroTik-0002.backup'));   
}
panel
Traveler
 
Posts: 3
Joined: Wed Sep 18, 2013 12:12 pm

Re: Net_SFTP: download file from Miktorik router

Postby TerraFrost » Wed Sep 18, 2013 2:53 pm

Try the latest Git version:

https://github.com/phpseclib/phpseclib/ ... 564ae4.zip

I think that'll fix it for you. If not lmk.

Thanks!
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am

Re: Net_SFTP: download file from Miktorik router

Postby panel » Wed Sep 18, 2013 3:07 pm

Hello,

I have found this: https://github.com/phpseclib/phpseclib/ ... 4cdd22d9d0

but this gave me error
Code: Select all
var $max_sftp_packet = 1 << 20;

and made workaround.I have defined empty $this->max_sftp_packet and filled $this->max_sftp_packet = 1 << 20; in function Net_SFTP() {}.

I will try it tomorrow and let you know.

Anyway thanks.
panel
Traveler
 
Posts: 3
Joined: Wed Sep 18, 2013 12:12 pm

Re: Net_SFTP: download file from Miktorik router

Postby TerraFrost » Wed Sep 18, 2013 3:59 pm

That was fixed in a later commit:

https://github.com/phpseclib/phpseclib/ ... 6adc93a8e4

Anyway I kinda deprecated that a few more commits later:

https://github.com/phpseclib/phpseclib/ ... e95d564ae4

So now it's just 1 << 15 for everything.
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am

Re: Net_SFTP: download file from Miktorik router

Postby panel » Thu Sep 19, 2013 7:53 am

Thank you very much, working well.

And thank you for your phpseclib library, I will support you with some small donation.
panel
Traveler
 
Posts: 3
Joined: Wed Sep 18, 2013 12:12 pm

Re: Net_SFTP: download file from Miktorik router

Postby TerraFrost » Thu Sep 19, 2013 3:03 pm

A donation would be awesome - thanks! :D
TerraFrost
Legendary Guard
 
Posts: 12357
Joined: Wed Dec 04, 2002 6:37 am


Return to phpseclib support

Who is online

Users browsing this forum: No registered users and 1 guest

cron