Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No magerun installed?" oneliner from README.php is not working in Bash #16

Closed
jeroenvermeulen opened this issue Feb 9, 2019 · 0 comments · Fixed by #17
Closed

"No magerun installed?" oneliner from README.php is not working in Bash #16

jeroenvermeulen opened this issue Feb 9, 2019 · 0 comments · Fixed by #17

Comments

@jeroenvermeulen
Copy link
Collaborator

jeroenvermeulen commented Feb 9, 2019

See: https://github.com/gwillem/magevulndb#no-magerun-installed

This does not work in Bash.
The PHP code is between "double quotes", so Bash will replace all $variables by the value of the variable in Bash, of by nothing if not defined.

Example:

/path/to/httpdocs$ php -r "require_once('app/Mage.php');Mage::app();$config=Mage::getConfig()->getNode()->modules;$found=array();$list=fopen('https://raw.githubusercontent.com/gwillem/magevulndb/master/magento1-vulnerable-extensions.csv','r');while($list&&list($name,$version)=list($row['module'],$row['fixed_in'],,$row['reference'],$row['update'])=fgetcsv($list)){if(isset($name,$version,$config->{$name},$config->{$name}->version)&&(empty($version)||version_compare($config->{$name}->version,$version,'<'))){$found[]=$row;}}if($found){echo 'Found possible vulnerable modules: '.print_r($found,1);}else{echo 'No known vulnerable modules detected.';}"
PHP Parse error:  syntax error, unexpected '=', expecting end of file in Command line code on line 1

Parse error: syntax error, unexpected '=', expecting end of file in Command line code on line 1

PHP complains here because $config is removed so the remaining statement is =Mage::getConfig()->getNode()->modules;

jeroenvermeulen added a commit that referenced this issue Feb 9, 2019
Swapped single and double quotes to fix #16
gwillem pushed a commit that referenced this issue Feb 13, 2019
Swapped single and double quotes to fix #16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant