Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
- <style>
- table
- {
- table-layout: auto;
- margin: 7px 2px 2px 0px;
- border-collapse: collapse;
- }
- td
- {
- padding:2px;
- text-align: left;
- vertical-align: middle;
- background: #FFFFFF;
- font-family: sans-serif;
- font-size: 10pt;
- }
- input
- {
- color: #000;
- background: #FAF3D2;
- border: 1px outset #000000
- }
- </style>
- <body>
- <table border=1><tr><td>
- <form action="" method=get>
- <input type=text name=ipfree size=5 > (70, 10, 20 etc)
- <input type=submit value="Search Free">
- </form>
- <td>
- <form action="cgi-bin/portsearch.cgi" method=get>
- <input type=text name='mac' size=16>
- <input type=submit value="Search Port by MAC">
- </form>
- </table>
- <br>
- <table border=1>
- <form action="" method=get>
- <tr><td>ID<td>Дата, время<td>IP (nmap -A)<td>MAC (поиск порта)<td>NBNAME<td>Логин<td>Таб.№
- <tr>
- <td><input type=text name=id size=3 >
- <td>
- <td><input type=text name=ip size=12 >
- <td><input type=text name=mac size=16 >
- <td><input type=text name=nbname size=16 >
- <td><input type=text name=logins size=25 >
- <td><input type=text name=num size=1 >
- <td>
- <input type=submit value=Search>
- <input type=reset value=Clear>
- </form>
- <?php
- if ($_GET[id] != '') $id=trim($_GET[id]);
- if ($_GET[ip] != '') $ip=trim($_GET[ip]);
- if ($_GET[mac] != '') $mac=trim($_GET[mac]);
- if ($_GET[nbname] != '') $nbname=trim($_GET[nbname]);
- if ($_GET[ipfree] != '') $ipfree=trim($_GET[ipfree]);
- if ($_GET[logins] != '') $logins=trim($_GET[logins]);
- if ($_GET[num] != '') $num=trim($_GET[num]);
- $hostname='127.0.0.1';
- $username='root';
- $password='PA$$W0RD';
- $dataBase='ipscan';
- mysql_connect($hostname, $username, $password) OR DIE("Mysql not connected!");
- mysql_select_db("$dataBase") OR DIE("Error select db");
- if (isset($ipfree)==false) { # SEARCH BY FILTER
- $where='';
- if (isset($ip)) $where=$where." AND ip REGEXP '.*$ip.*' ";
- if (isset($mac)) $where=$where." AND mac REGEXP '.*$mac.*' ";
- if (isset($nbname)) $where=$where." AND nbname REGEXP '.*$nbname.*' ";
- if (isset($logins)) $where=$where." AND logins REGEXP '.*$logins.*' ";
- if (isset($num)) $where=$where." AND num = '$num' ";
- if (isset($id)==false) $id='%';
- $query = "SELECT * FROM log WHERE id LIKE '$id' $where ORDER BY log.id DESC LIMIT 0,30;";
- #echo $query;
- $result=mysql_query($query) or die("damn...");
- while ($row = mysql_fetch_assoc($result)) {
- $row['logins']=str_replace("\n","<br>",$row['logins']);
- $text=$text."<tr>"
- ."<td>".$row['id']
- ."<td><nobr>".date('Y-m-d H:i:s',$row['date'])."</nobr>"
- ."<td><a href='cgi-bin/ipinfo.cgi?ip=".$row['ip']."'>".$row['ip']."</a>"
- ."<td><a href='cgi-bin/portsearch.cgi?".$row['mac']."'>".$row['mac']."</a>"
- ."<td>".$row['nbname']
- ."<td>".preg_replace('/(.*\\\)(.*)/','<u>$1</u><b>$2</b>',$row['logins'])
- ."<td>".$row['num']."\n";
- }
- }else{ # SEARCH FREE
- $currDate=time();
- $where=" ip REGEXP '.{1,}$ipfree.{1,}' AND date >= $currDate - 86400 * 21 "; #21 day
- $query = "SELECT * FROM log WHERE $where ORDER BY log.id DESC";
- # echo $query;
- $result=mysql_query($query) or die("damn...");
- $i=0;
- while ($row = mysql_fetch_assoc($result)) {
- $ipnotfreeArr[$i]=$row['ip'];
- # echo $ipnotfreeArr[$i]."<br/>";
- $i++;
- }
- array_unique($ipnotfreeArr);
- # count($ipnotfreeArr);
- for ($i=1; $i<=255; $i++){
- $ipfullArr[$i]="192.168.$ipfree.$i";
- }
- $ipfreeArr=array_diff($ipfullArr,$ipnotfreeArr);
- for ($i=0; $i<=count($ipfreeArr); $i++){
- if ( isset($ipfreeArr[$i]) ) { $ii++; $text=$text."<tr><td><td><td>".$ii." - ".$ipfreeArr[$i]."<td><td>"; }
- }
- }
- print $text;
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement