douzhong1730 2016-01-13 11:00
浏览 128

Ruby命令没有在PHP shell_exec函数中执行

I want to run WPScan through PHP file. I am using shell_exec function to call the WPScan command, but it throws out following error:

[ERROR] cannot load such file -- bundler/setup

WPScan needs ruby to be running in the server and WPScan command can only run inside the WPScan directory. When we run this command outside the WPScan directory, than it throws out the same following error:

[ERROR] cannot load such file -- bundler/setup

Means browser is not able to locate the files needed by the WPScan, and all the files are placed inside the document root of the website. Other all commands are working through shell_exec, but ruby command throws out a error. In short it is unable to find the files needed by the WPScan.

The command is:

ruby wpscan.rb --url http://example.com/ --follow-redirection --log

I tried using full path also:

/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby /var/www/html/wp-scan/wpscan.rb --url example.com --follow-redirection --log

But nothing works.

$wp_command = shell_exec('/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby /var/www/html/wp-scan/wpscan.rb --url example.com --follow-redirection --log');

echo $wp_command;

die;
  • 写回答

1条回答 默认 最新

  • dsgnze6572 2016-01-13 11:30
    关注

    Try something like this:

    $wp_command = shell-exec('cd /var/www/html/wp-scan && ruby wpscan.rb --url example.com --follow-redirection --log');
    
    echo $wp_command;
    
    die;
    

    Should work if you install WPScan and RVM correctly.

    评论

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用