"; echo""; echo"

\"\"

"; if ($debug){echo"Start
";} //if (isset($_GET['ip'])) { // $formErrors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST'){ if ($debug){echo"it is a post
";} if ($debug){print_r($_POST);echo"
";} $formValues = $_POST; $formErrors = array(); if (isset($_POST['checkip'])) { $checkip=$_POST['checkip']; if($debug){ echo "Submit check new ip $ip
";} }else{ if (!VerifyForm($formValues, $formErrors)) ErrorDisplay($formValues, $formErrors); else ProcessForm($formValues); die;#done } //require("/etc/vmail.conf"); //else{ #if (isset($_POST['submit'])) { #echo "Submit
"; #} } #else{ echo ""; ?>
$font
Winc Blacklist check and removal

Our system may blacklist your IP address for the following reasons:
1- A virus scanning for addresses on a infected computer using this IP address.
2- Invalid, wrong or non exiting email addresses as a recipient in our servers.
3- Dictionary scan of our servers for email addresses.
4- Too many attempts to login with a wrong password. "; $raddr = getenv("REMOTE_ADDR"); $name = gethostbyaddr($raddr); echo ""; echo ""; echo"
"; if (!isset($_GET['ip'])) { $_GET['ip']=$raddr; } if ($checkip) { if ($debug){echo"checkip is on
";} $_GET['ip']=$checkip; } //echo "db: $db
"; if (isset($_GET['ip'])) { //echo "conn: $connection
"; $ip = $_GET['ip']; echo ""; $connection = mysql_pconnect($server, $user, $pass); $query = "SELECT * FROM rbl WHERE ip = '$ip'"; $result = mysql_db_query($db,$query,$connection); $row = mysql_fetch_array($result); // $numrows = $row[0]; if ($row["id"]){ $id = $row["id"]; $ip = $row["ip"]; $from = $row["from"]; $to = $row["to"]; $helo = $row["helo"]; $reverse = $row["reverse"]; $error = $row["error"]; $timestamp = $row["timestamp"]; $hitcounter = $row["hitcounter"]+1; $year = substr($timestamp, 0, 4); $month = substr($timestamp, 4, 2); $day = substr($timestamp, 6, 2); $hour = substr($timestamp, 8, 2); $min = substr($timestamp, 10, 2); $sec = substr($timestamp, 12, 2); $lock_date = $month."/".$day."/".$year." ".$hour.":".$min.":".$sec; echo ""; echo ""; $timestamp=substr($error, strlen($error)-14, 14); $year = substr($timestamp, 0, 4); $month = substr($timestamp, 4, 2); $day = substr($timestamp, 6, 2); $hour = substr($timestamp, 8, 2); $min = substr($timestamp, 10, 2); $sec = substr($timestamp, 12, 2); $lock_date1 = $month."/".$day."/".$year." ".$hour.":".$min.":".$sec; echo ""; echo ""; if(strpos($error, "Error_Bncc")){ echo "";} else{ echo "";} echo ""; echo ""; echo ""; echo "
$font Your IP address is:$font ".$raddr."
$font You connection name$font $name
$font IP address to be unblocked:$font $ip
$font Blocked IP Address:$font $ip
$font Blocked data:$font $error
$font First block happened on:$font $lock_date1
$font From:$font $from
$font To:$font $to -- Email content word trap.
$font To:$font $to -- Invalid, Incorrect or non existent.
$font Sender server real name:$font $reverse
$font Sender id itself as:$font $helo
$font Last hit happened on:$font $lock_date
$font Hit counter from this IP address:$font $hitcounter
"; // insert form here// ?>
You may try to unblock this IP address:
Please enter the required info below and click the Unblock button below
Enter a VALID email address below the ip will not be unblocked if the email address is invalid or bounces. You will receive a comfirmation email if it is unblocked.
You may also contact us at Click here
Your Name:
Your Email Address:
To verify your entry, please enter all the letters before the @ from your email address written backwards.
Comments:
IP address: $ip is NOT listed here
Enter an IP to check:

\n"; #}//end is post submit echo" "; # # function ErrorDisplay($values, $errors){ ?> Data Entry Error There were some errors in your submitted form, please correct them and try again. Your Name: Your Email Address: Verification. "; #} $Ip_2_Unblock = $_POST['Ip_2_Unblock']; $Ip_block_2_unblock = `echo $Ip_2_Unblock | awk -F . {'print $1"."$2"."$3".0/24"'}`; #} $connection = mysql_pconnect($server, $user, $pass); $query = "SELECT * FROM rbl WHERE ip = '$Ip_2_Unblock'"; $result = mysql_db_query($db,$query,$connection); $row = mysql_fetch_array($result); $Content = "Unblock request OK.\n Unblock IP info:\n"; $Content=$Content."Your comment: ".$values['text']."\nIP unblocked: ".$ip = $row["ip"]."\n"; $id = $row["id"]; $helo = $row["helo"]; $Content=$Content."ID: ".$id."\n"; $Content=$Content."From: ".$row["from"]."\n"; $Content=$Content."To: ".$row["to"]."\n"; $Content=$Content."Sender announced itself as: ".$helo."\n"; $Content=$Content."Sender Connection name: ".$row["reverse"]."\n"; $error = $row["error"]; $Content=$Content."Error Message sent: ".$error."\n"; $timestamp = $row["timestamp"]; $hitcounter = $row["hitcounter"]+1; $year = substr($timestamp, 0, 4); $month = substr($timestamp, 4, 2); $day = substr($timestamp, 6, 2); $hour = substr($timestamp, 8, 2); $min = substr($timestamp, 10, 2); $sec = substr($timestamp, 12, 2); $lock_date = $month."/".$day."/".$year." ".$hour.":".$min.":".$sec; $timestamp=substr($error, strlen($error)-14, 14); $year = substr($timestamp, 0, 4); $month = substr($timestamp, 4, 2); $day = substr($timestamp, 6, 2); $hour = substr($timestamp, 8, 2); $min = substr($timestamp, 10, 2); $sec = substr($timestamp, 12, 2); $lock_date1 = $month."/".$day."/".$year." ".$hour.":".$min.":".$sec; $Content=$Content."First locked on : ".$lock_date."\n"; $Content=$Content."Last hit on : ".$lock_date."\n"; $Content=$Content."Total hits : ".$hitcounter."\n"; #Unblock the ip $query = "DELETE FROM rbl WHERE id = '$id'"; $result = mysql_db_query($db,$query,$connection); if($result){ $row = mysql_fetch_array($result); echo $row[0]."
"; } # $row=0; # remove iptables rule if fail2ban and whole IP seg block $f2b_rule = explode("-", $helo); if ($f2b_rule[0] == "fail2ban"){ $iptables_rule="fail2ban-".$f2b_rule[1]; }else{ $iptables_rule="fail2ban-".$f2b_rule[0]; } $Content=$Content."Found F2B: ".$iptables_rule." -- ".$f2b_rule[0]."\n"; # iptables -D fail2ban-sasl -s 1.55.129.0/24 -j DROP $Shell_Command="sudo /sbin/iptables -nL $iptables_rule --line-numbers | grep $Ip_block_2_unblock"; $iptables_result=shell_exec($Shell_Command); if($iptables_result){ $f2b_rule_numb = explode(" ", $iptables_result); if ($f2b_rule_numb[0]){ $Shell_Command="sudo /sbin/iptables -D $iptables_rule $f2b_rule_numb[0]"; $Shell_Command_test="sudo /sbin/iptables -D $iptables_rule $f2b_rule_numb[0]"; $iptables_result=shell_exec($Shell_Command); $Content=$Content."f2b ".$iptables_rule." rule# ".$f2b_rule_numb[0]." and removed it.\n"; } } # if ($iptables_rule == "fail2ban-sasl" || $iptables_rule == "fail2ban-SMTP"){ if ($iptables_rule){ # $Shell_Command_test="sudo /sbin/iptables -D fail2ban-sasl -s $Ip_block_2_unblock -j DROP"; # $Shell_Command="sudo /sbin/iptables -D fail2ban-sasl -s $Ip_block_2_unblock -j DROP"; # $iptables_result_tst=shell_exec($Shell_Command); ## iptables -nL fail2ban-sasl --line-numbers | grep 166.205.9.16 $Shell_Command="sudo /sbin/iptables -nL $iptables_rule --line-numbers | grep $ip"; $iptables_result=shell_exec($Shell_Command); if($iptables_result){ $f2b_rule_numb = explode(" ", $iptables_result); if ($f2b_rule_numb[0]){ $Shell_Command="sudo /sbin/iptables -D $iptables_rule $f2b_rule_numb[0]"; $iptables_result=shell_exec($Shell_Command); $Content=$Content."f2b ".$iptables_rule." rule# ".$f2b_rule_numb[0]." and removed it.\n"; } } } if(!$row){ $sendto=$values['email']; mail('sergio@winc.net', 'BL postfix removal', $Content, "From: \"{$values['name']}\" <{$values['email']}>"); #SC mail($sendto, 'Winc blacklist IP removal confirmation', $Content, "From: \"Support at winc\" "); // Replace with actual page or redirect :P echo "WINC Unblock ip. Thank you!You should receive a confirmation email.
Thank you!
$Ip_block_2_unblock
$Shell_Command_test
$iptables_result_tst
"; } } # function VerifyForm(&$values, &$errors){ // Do all necessary form verification if (strlen($values['name']) < 3) $errors['name'] = 'Name too short'; elseif (strlen($values['name']) > 50) $errors['name'] = 'Name too long'; // Needs better checking ;) if (!ereg('.*@.*\..{2,4}', $values['email'])) $errors['email'] = 'Email address invalid'; list($email1, $emaildomain) = split("@", $values['email']); $emailrev = strrev($email1); if ($values['emailbw'] != $emailrev) $errors['emailbw'] = 'Human verify failed.'; return (count($errors) == 0); } ?>