updated .htaccess securing
This commit is contained in:
31
sc.php
31
sc.php
@@ -165,6 +165,9 @@ function vulntheme(){
|
||||
|
||||
}
|
||||
|
||||
function clear_cache(){
|
||||
system("if [ $(find-name "cache" -maxdepth 0 -type d -empty 2>/dev/null) ]; then rm -rfv $i/*; echo "no cache dirs, or empty ones found"; fi");
|
||||
}
|
||||
/* cleaning the backdoor files of the Gravity Forms Exploit */
|
||||
function cleangravity(){
|
||||
system('find '.$this->web_dir.'./ -type f -name "*_input__test*" -print -exec rm -rf {} \;');
|
||||
@@ -179,18 +182,40 @@ echo "<pre>$output</pre>";
|
||||
}
|
||||
|
||||
/* secure the temporary directories against execution of malicious files */
|
||||
// need to change this to PHP: https://gist.github.com/PalmaSolutions/3b5d2b69ac020c87ce53942785e39127
|
||||
function securetemps(){
|
||||
|
||||
$htdata = '
|
||||
<FilesMatch "\.(php([0-9]|s)?|s?p?html|cgi|pl|exe)$">
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
';
|
||||
system("for i in `find ../ -type d -path '*/wp-content/uploads';`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done");
|
||||
system("for i in `find ../ -type d -path '*/tmp'`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done");
|
||||
if (file_exists("wp-content"))
|
||||
|
||||
{
|
||||
if (file_exists("wp-content/uploads"))
|
||||
{
|
||||
if (is_dir("wp-content/uploads"))
|
||||
{
|
||||
if (file_exists("wp-content/uploads/.htaccess"))
|
||||
{
|
||||
echo "file exists - skipping\n"
|
||||
else
|
||||
$hta = fopen("wp-content/uploads/.htaccess", "w");
|
||||
fwrite($hta, $htdata);
|
||||
fclose($hta);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// system("for i in `find ../ -type d -path '*/wp-content/uploads';`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done");
|
||||
// system("for i in `find ../ -type d -path '*/tmp'`; do echo $i && echo -e '".$htdata."' >> \$i/.htaccess; done");
|
||||
/* Joomla /images may cause a ton of false positive patches so we'll research this further */
|
||||
// system("for i in `find ./ -type d -path '*/images' -print;`; do echo -e '".$htdata."' >> \$i/.htaccess; done");
|
||||
echo "all patched\n";
|
||||
//echo "all patched\n";
|
||||
|
||||
}
|
||||
/* Vulnerability check
|
||||
|
||||
Reference in New Issue
Block a user