Advertisement
qiwichupa

IPScan - index.php

Aug 5th, 2011
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.67 KB | None | 0 0
  1. <html>
  2. <head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
  3.  
  4. <style>
  5. table
  6. {
  7.     table-layout: auto;
  8.     margin: 7px 2px 2px 0px;
  9.     border-collapse: collapse;
  10. }
  11.  
  12. td
  13. {
  14.     padding:2px;
  15.     text-align: left;
  16.     vertical-align: middle;
  17.     background: #FFFFFF;
  18.     font-family: sans-serif;
  19.     font-size: 10pt;
  20. }
  21.  
  22. input
  23. {
  24. color: #000;
  25. background: #FAF3D2;
  26. border: 1px outset #000000
  27. }
  28.  
  29.  
  30. </style>
  31.  
  32.  
  33. <body>
  34. <table border=1><tr><td>
  35. <form action="" method=get>
  36. <input type=text name=ipfree size=5 > (70, 10, 20 etc)
  37. <input type=submit value="Search Free">
  38. </form>
  39. <td>
  40. <form action="cgi-bin/portsearch.cgi" method=get>
  41. <input type=text name='mac' size=16>
  42. <input type=submit value="Search Port by MAC">
  43. </form>
  44. </table>
  45. <br>
  46.  
  47. <table border=1>
  48. <form action="" method=get>
  49.  
  50. <tr><td>ID<td>Дата, время<td>IP (nmap -A)<td>MAC (поиск порта)<td>NBNAME<td>Логин<td>Таб.№
  51. <tr>
  52. <td><input type=text name=id size=3 >
  53. <td>
  54. <td><input type=text name=ip size=12 >
  55. <td><input type=text name=mac size=16 >
  56. <td><input type=text name=nbname size=16 >
  57. <td><input type=text name=logins size=25 >
  58. <td><input type=text name=num size=1 >
  59.  
  60. <td>
  61. <input type=submit value=Search>
  62. <input type=reset value=Clear>
  63.  
  64. </form>
  65.  
  66.  
  67.  
  68. <?php
  69.  
  70. if ($_GET[id] != '') $id=trim($_GET[id]);
  71. if ($_GET[ip] != '') $ip=trim($_GET[ip]);
  72. if ($_GET[mac] != '') $mac=trim($_GET[mac]);
  73. if ($_GET[nbname] != '') $nbname=trim($_GET[nbname]);
  74. if ($_GET[ipfree] != '') $ipfree=trim($_GET[ipfree]);
  75. if ($_GET[logins] != '') $logins=trim($_GET[logins]);
  76. if ($_GET[num] != '') $num=trim($_GET[num]);
  77.  
  78. $hostname='127.0.0.1';
  79. $username='root';
  80. $password='PA$$W0RD';
  81. $dataBase='ipscan';
  82.  
  83. mysql_connect($hostname, $username, $password) OR DIE("Mysql not connected!");
  84. mysql_select_db("$dataBase") OR DIE("Error select db");
  85.  
  86. if (isset($ipfree)==false) {        # SEARCH BY FILTER
  87.     $where='';
  88.     if (isset($ip)) $where=$where." AND ip REGEXP '.*$ip.*' ";
  89.     if (isset($mac)) $where=$where." AND mac REGEXP '.*$mac.*' ";
  90.     if (isset($nbname)) $where=$where." AND nbname REGEXP '.*$nbname.*' ";
  91.     if (isset($logins)) $where=$where." AND logins REGEXP '.*$logins.*' ";
  92.     if (isset($num)) $where=$where." AND num = '$num' ";
  93.     if (isset($id)==false) $id='%';
  94.    
  95.    
  96.     $query = "SELECT * FROM log WHERE id LIKE '$id' $where  ORDER BY log.id DESC LIMIT 0,30;";
  97.     #echo $query;
  98.     $result=mysql_query($query) or die("damn...");
  99.    
  100.     while ($row = mysql_fetch_assoc($result)) {
  101.     $row['logins']=str_replace("\n","<br>",$row['logins']);
  102.     $text=$text."<tr>"
  103.     ."<td>".$row['id']
  104.     ."<td><nobr>".date('Y-m-d H:i:s',$row['date'])."</nobr>"
  105.     ."<td><a href='cgi-bin/ipinfo.cgi?ip=".$row['ip']."'>".$row['ip']."</a>"
  106.     ."<td><a href='cgi-bin/portsearch.cgi?".$row['mac']."'>".$row['mac']."</a>"
  107.     ."<td>".$row['nbname']
  108.     ."<td>".preg_replace('/(.*\\\)(.*)/','<u>$1</u><b>$2</b>',$row['logins'])
  109.     ."<td>".$row['num']."\n";
  110.     }
  111.  
  112.  
  113. }else{                  # SEARCH FREE
  114.     $currDate=time();
  115.     $where=" ip REGEXP '.{1,}$ipfree.{1,}' AND date >= $currDate - 86400 * 21 "; #21 day
  116.     $query = "SELECT * FROM log WHERE  $where  ORDER BY log.id DESC";
  117. #   echo $query;
  118.     $result=mysql_query($query) or die("damn...");
  119.  
  120.     $i=0;
  121.     while ($row = mysql_fetch_assoc($result)) {
  122.     $ipnotfreeArr[$i]=$row['ip'];
  123. #   echo $ipnotfreeArr[$i]."<br/>";
  124.     $i++;
  125.     }
  126.  
  127.     array_unique($ipnotfreeArr);
  128. #   count($ipnotfreeArr);
  129.     for ($i=1; $i<=255; $i++){
  130.     $ipfullArr[$i]="192.168.$ipfree.$i";
  131.         }
  132.  
  133.     $ipfreeArr=array_diff($ipfullArr,$ipnotfreeArr);
  134.    
  135.     for ($i=0; $i<=count($ipfreeArr); $i++){
  136.     if ( isset($ipfreeArr[$i])  ) {  $ii++;  $text=$text."<tr><td><td><td>".$ii." - ".$ipfreeArr[$i]."<td><td>"; }
  137.     }
  138. }
  139.  
  140. print $text;
  141.  
  142. ?>
  143.  
  144. </table>
  145. </body>
  146. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement