From 7f20afb14e08ff7007b6bfa7fac8b0492d9b050a Mon Sep 17 00:00:00 2001 From: Palma Solutions LTD Date: Thu, 11 May 2017 20:52:36 +0200 Subject: [PATCH] changed globals --- sc.php | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/sc.php b/sc.php index 3f12117..8487200 100644 --- a/sc.php +++ b/sc.php @@ -130,10 +130,10 @@ $error = "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried t user = $processUser['name']; + $this->top_dir = '/home/'.$this->user.'/'; + $this->web_dir = '/home/'.$this->user.'/public_html/'; $GLOBALS["red"] = ""; $GLOBALS["br"] = "
"; @@ -164,7 +164,7 @@ system ("w | grep load"); function cleanupl(){ system("find ../*/wp-content/uploads/ -type f -name '*.php' -print -exec rm -rf {} \;"); /* clear PHP files from wp-content/uploads */ system('find ../ -type f -name "*.php.suspected" -print -exec rm -rf {} \;'); /* clear files renamed as *.suspected by the server AV */ - system($GLOBALS["findcmd"].' -type f -size 0 -print -exec rm -rf {} \;'); /* clear files with 0 bytes size */ + system('find '.$this->web_dir.'./ -type f -size 0 -print -exec rm -rf {} \;'); /* clear files with 0 bytes size */ } @@ -177,9 +177,9 @@ function vulntheme(){ /* cleaning the backdoor files of the Gravity Forms Exploit */ function cleangravity(){ -system($GLOBALS["findcmd"].' -type f -name "*_input__test*" -print -exec rm -rf {} \;'); -system($GLOBALS["findcmd"].' -type f -name "*_input_*.php*" -print -exec rm -rf {} \;'); -system($GLOBALS["findcmd"].' -type f -name "*_input_*.txt*" -print -exec rm -rf {} \;'); +system('find '.$this->web_dir.'./ -type f -name "*_input__test*" -print -exec rm -rf {} \;'); +system('find '.$this->web_dir.'./ -type f -name "*_input_*.php*" -print -exec rm -rf {} \;'); +system('find '.$this->web_dir.'./ -type f -name "*_input_*.txt*" -print -exec rm -rf {} \;'); } /* use a modified version of Spamhaus's findbot.pl to identify left over backdoors */ @@ -233,7 +233,7 @@ system("./malware.pl"); /* EXIF scanner */ function checkexif(){ -define('IMAGEPATH', $GLOBALS["public_html"]); +define('IMAGEPATH', $this->web_dir); $directory = new RecursiveDirectoryIterator(IMAGEPATH); $iterator = new RecursiveIteratorIterator($directory); @@ -275,7 +275,7 @@ function insecplug(){ foreach ($plugins_list as $plugin){ - system($GLOBALS["findcmd"].' -type d -name '.$plugin.' -print'); + system('find '.$this->web_dir.'./ -type d -name '.$plugin.' -print'); } @@ -336,7 +336,7 @@ function reshog(){ foreach ($plugin_list as $plugins){ - system($GLOBALS["findcmd"].' -type d -name '.$plugins.' -print'); + system('find '.$this->web_dir.'./ -type d -name '.$plugins.' -print'); } @@ -344,7 +344,7 @@ function reshog(){ /* EXIF cleaner */ function cleanexif(){ -define('IMAGEPATH', $GLOBALS["public_html"]); +define('IMAGEPATH', $this->web_dir); $directory = new RecursiveDirectoryIterator(IMAGEPATH); $iterator = new RecursiveIteratorIterator($directory); @@ -470,9 +470,9 @@ echo "Removing Files With Zero Size"; function findchmod(){ echo "Finding All Files With Chmod Set To 0000

"; -system($GLOBALS["findcmd"].' -type f -perm 0000 -exec ls -al'); +system('find '.$this->web_dir.'./ -type f -perm 0000 -exec ls -al'); echo "Finding All Directories With Chmod Set To 0000

"; -system($GLOBALS["findcmd"].' -type d -perm 0000 -exec ls -al'); +system('find '.$this->web_dir.'./ -type d -perm 0000 -exec ls -al'); } function trimblanklines($str) { @@ -485,12 +485,12 @@ function trimblanklines($str) { function fixperms(){ echo("To save time (and money) we're going to locate the files and directories with improper permissions and fix just those:\n"); - system($GLOBALS["findcmd"].' -perm +og+w -follow -type d -print -exec chmod 755 {} \;'); - system($GLOBALS["findcmd"].' -perm 0000 -follow -type d -print -exec chmod 755 {} \;'); - system($GLOBALS["findcmd"].' -perm +og+w -follow -type f -print -exec chmod 644 {} \;'); - system($GLOBALS["findcmd"].' -perm 0000 -follow -type f -print -exec chmod 644 {} \;'); - system($GLOBALS["findcmd"].' -perm +og+w -follow -type f -name "*.cgi" -print -exec chmod 755 {} \;'); - system($GLOBALS["findcmd"].' -perm +og+w -follow -type f -name "*.pl" -print -exec chmod 755 {} \;'); + system('find '.$this->web_dir.'./ -perm +og+w -follow -type d -print -exec chmod 755 {} \;'); + system('find '.$this->web_dir.'./ -perm 0000 -follow -type d -print -exec chmod 755 {} \;'); + system('find '.$this->web_dir.'./ -perm +og+w -follow -type f -print -exec chmod 644 {} \;'); + system('find '.$this->web_dir.'./ -perm 0000 -follow -type f -print -exec chmod 644 {} \;'); + system('find '.$this->web_dir.'./ -perm +og+w -follow -type f -name "*.cgi" -print -exec chmod 755 {} \;'); + system('find '.$this->web_dir.'./ -perm +og+w -follow -type f -name "*.pl" -print -exec chmod 755 {} \;'); } function getcleaner(){ @@ -505,7 +505,7 @@ fclose($fp); function addsec(){ echo "securing .htaccess
"; - $htafile = $GLOBALS["public_html"].'/.htaccess'; + $htafile = $this->web_dir.'/.htaccess'; $htaData = " # Protection agains XSS exploits added by Lunarpages MSH team Options +FollowSymLinks @@ -526,7 +526,7 @@ file_put_contents($htafile, $htaData, FILE_APPEND | LOCK_EX); show_source($htafile); echo "moving on to php.ini"; - $phpfile = $GLOBALS["public_html"].'/php.ini'; + $phpfile = $this->web_dir.'/php.ini'; $phpData = ' ; Protection agains RFI exploits added by Lunarpages MSH team allow_url_fopen = Off @@ -536,7 +536,7 @@ display_errors = Off display_startup_errors = Off error_reporting = E_ALL mail.add_x_header = On -mail.log = '.$GLOBALS["doc_root"].'/phpmail.log +mail.log = '.$this->top_dir.'/phpmail.log '; file_put_contents($phpfile, $phpData, FILE_APPEND | LOCK_EX); @@ -551,7 +551,7 @@ file_put_contents($phpfile, $phpData, FILE_APPEND | LOCK_EX); echo ''; if(($_POST['send']) == "Remove it") { $name= ($_POST["name"]); - system($GLOBALS["findcmd"].' -name "'.$name.'" -print -exec rm -fr {} \;'); + system('find '.$this->web_dir.'./ -name "'.$name.'" -print -exec rm -fr {} \;'); } } @@ -820,12 +820,12 @@ echo '

'; $username = system('whoami'); echo "insert the location you wish to get the size for:
"; echo '
'; - echo $GLOBALS["doc_root"].''; + echo $this->top_dir.''; echo ''; if(($_POST['send']) == "Get it") { $path = ($_POST["path"]); echo "
Getting size of: ".$path."
"; - system('du -sh '.$GLOBALS["doc_root"].$path); + system('du -sh '.$this->top_dir.$path); } } @@ -834,7 +834,7 @@ echo '

'; $ziparray = array("zip", "rar", "tgz", "tar.gz", "bz2", "tar"); foreach ($ziparray as $i => $valzip) { echo 'checking for backup files with extension: '.$valzip.'
'; - system($GLOBALS["findcmd"].'-name *.'.$valzip.' -exec du -sh {} \; | grep "backup"'); + system('find '.$this->web_dir.'./-name *.'.$valzip.' -exec du -sh {} \; | grep "backup"'); } } @@ -1989,7 +1989,7 @@ default : } $settings = array ( - 'BASE_DIR' => $GLOBALS["public_html"], + 'BASE_DIR' => $this->web_dir, 'USE_DEFINITIONS' => true, 'SIZE_LIMIT' => ( 1024 * 1024 ) //size limit set to 1mb );