Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
hacked seclib in fuel ?
  • has a any specific meaning hacked seclib library ? why is crypt_random function renamed to get ? i need use sftp from seclib and dont work now because he not find original function.. a little strange to have there seclib 2 times on ftp in 1 project hm ?
  • Running into the same issue with crypt_random. In the original library it is a function in Crypt/Random.php. In Fuel it has been converted to a class and causes anything that calls crypt_random to fail.
  • To get the PHPSecLib SFTP working with FuelPHP I had to drop the original Crypt\Random.php file in (do not add namespace def and don't convert function to a class) and then:
    namespace Fuel\Tasks;
    
    import('phpseclib/Crypt/Random', 'vendor');
    import('phpseclib/Crypt/Hash', 'vendor');
    import('phpseclib/Crypt/RC4', 'vendor');
    import('phpseclib/Net/SSH2', 'vendor');
    import('phpseclib/Net/SFTP', 'vendor');
    
    use \PHPSecLib_Crypt;
    use \PHPSecLib_Net;
    
    
    class Billingextract
    {
     function run()
     {
      return "";
     }
    
     /**
      * to run:
      *  php oil refine billingextract:run_extract
      */
     function run_extract()
     {
      require_once('fuel/core/vendor/phpseclib/Crypt/Random.php');
      require_once('fuel/core/vendor/phpseclib/Math/BigInteger.php');
      
       $filename = 'billingextract.txt';
       $output ="Hello World";
      $sftp = new \PHPSecLib\Net_SFTP('xxx.xxx.xxx.xxx');
      if (!$sftp->login('xxxxxxx', 'xxxxxxx')) {
       \Cli::write('Login Failed','red');
      } else {
       $sftp->put($filename, $output);
       \Cli::write('Success - '.$filename.' pushed to FTP server','green');
      }
      
      return;
     }
    }
    

    Hopefully, this will help someone else out.
  • The changes are there to have PHPSecLib play nice with the autoloader. So I prefer to fix sftp to breaking that. Could you create an issue for this at http://github.com/fuel/core/issues so it can be looked at?
  • I don't remember changing any code, but I'll have a look once my development environment is back online (laptop has died on me).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion