Created
May 13, 2009 15:51
-
-
Save samsoir/111096 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # most basic approach | |
| find system -type f -exec sed -i -e "s/defined('SYSPATH') OR die('No direct access allowed.');//" '{}' \; | |
| # case insensitive | |
| find system -type f -exec sed -i -e "s/defined('SYSPATH') [oO][rR] die('No direct access allowed.');//" '{}' \; | |
| # case insensitive with any die message | |
| find system -type f -exec sed -i -e "s/defined('SYSPATH') [oO][rR] die('[^']\{0,\}');//" '{}' \; | |
| # all the above and also remove extra whitespace and empty php directives | |
| find system -type f -exec sed -i -e "{ s/^<?php\([ \t]\{1,\}\)defined('SYSPATH') [oO][rR] die('[^']\{0,\}');\(.\{0,\}\)$/<?php\1\2/ ; s/^<?php[ \t]\{1,\}$/<?php/ ; /^<?php[ \t]\{1,\}?>$/ d }" '{}' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment