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;