D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
Filename :
viewbrute.php
back
Copy
<?php $userip = ($_SERVER['REMOTE_ADDR']); $office_ips = array( '211.26.34.109', '118.175.70.15', '203.59.32.238', '211.26.34.109', '211.26.34.110', '27.54.95.242', '203.59.32.238', '203.59.135.115', '176.74.24.253', '203.170.85.116', '124.106.215.58', '193.239.152.233', '222.127.142.244'); if (!((in_array($userip,$office_ips))|| preg_match("/^2407:4c00:6464:2:/",$userip))) { print "your ip is $userip"; exit; } $link = mysql_connect('localhost', 'cphulk_agent', 'ih0ChiekoSheeboe'); if (!$link) { die('Could not connect: ' . mysql_error()); } ?> <html> <head> <title> <?php $hostname = gethostname(); echo $hostname; ?> </title> </head> <body> <h2> List of ips listed in cphulk table </h2> <table border="1"> <?php if(isset($_POST['delete'])){ mysql_select_db("cphulkd"); mysql_query("DELETE FROM brutes WHERE ip = '".$_POST['ip']."' "); mysql_query("DELETE FROM logins WHERE ip = '".$_POST['ip']."' "); echo "You have deleted: ".$_POST['ip'].""; } $first = true; mysql_select_db("cphulkd"); $result = mysql_query("SELECT * from brutes"); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo '<tr>'; if ($first) { echo '<th> Magic Button </th>'; foreach ($row as $key => $value) { echo '<th>' . $key . '</th>'; } echo '</tr><tr>'; $first = false; } foreach ($row as $key => $value) { if ($key == "IP") { echo "<td> <form action='' method='post'> <input type='submit' name='delete' value='DELETE'> </td> <td> <input type='' name='ip' value='". $value ."'> </form> </td>"; } else { echo '<td>' . $value . '</td>'; } } echo '</tr>'; } } else { echo '<p> There are currently no records in the database meaning zero blocked ips. </p>'; } ?> </table> <h2> List of ips listed in fail2ban rules </h2> <?php echo `sudo /root/view_fail2ban.pl`; #-- perl takes care of formatting ?> </body> </html> <?php mysql_close($link); ?>