Minor file structure updates

This commit is contained in:
Russ 2015-08-25 23:37:44 -04:00
parent a7d9b08865
commit b9781ea0b6
10 changed files with 79 additions and 80 deletions

View File

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Destination IPs by Source</h3> <h3>Destination IPs by Source</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -16,10 +16,10 @@
<?php <?php
//Include DB connection info //Include DB connection info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -30,7 +30,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -65,27 +65,27 @@
if(isset($_GET['formIP'])) { if(isset($_GET['formIP'])) {
$varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP); $varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP);
} }
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Check Connection //Check Connection
if ($conn2->connect_error) { if ($conn2->connect_error) {
die("Connection Failed: " . $conn2->connect_error); die("Connection Failed: " . $conn2->connect_error);
} }
//Query //Query
$sql = "SELECT src_ip, dst_ip FROM `rawdata` WHERE `src_ip` = '".$varIP."' AND `dst_port` = '".$varPort."' GROUP BY dst_ip ORDER BY dst_ip;"; $sql = "SELECT src_ip, dst_ip FROM `rawdata` WHERE `src_ip` = '".$varIP."' AND `dst_port` = '".$varPort."' GROUP BY dst_ip ORDER BY dst_ip;";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results of the query, display them. //If there are results of the query, display them.
if ($result->num_rows >0) { if ($result->num_rows >0) {
echo "Now viewing data for Destination Port: $varPort"; echo "Now viewing data for Destination Port: $varPort";
echo "<table align='center'><tr><th colspan='2'>Source IP: $varIP <a href=http://utilities.mon.liquidweb.com/netdata/whoislookup.php?formIPaddr=".$varIP." target=_blank>Whois</a></tr></th><tr><th>Destination IPs</th><th>Netblock</tr>"; echo "<table align='center'><tr><th colspan='2'>Source IP: $varIP <a href=http://DOMAIN.com/netdata/whoislookup.php?formIPaddr=".$varIP." target=_blank>Whois</a></tr></th><tr><th>Destination IPs</th><th>Netblock</tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["dst_ip"]."</td><td><a href=https://billing.int.liquidweb.com/mysql/content/admin/netblock/assignment/search.mhtml?customer=".$row["dst_ip"]."&submit=Search target=_blank>Netblock</a></tr>"; echo "<tr><td>".$row["dst_ip"]."</td><td><a href=https://DOMAIN.com/ips/assignment/search.mhtml?customer=".$row["dst_ip"]."&submit=Search target=_blank>Internal IP</a></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {

View File

@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Inbound Traffic Graphs</h3> <h3>Inbound Traffic Graphs</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -23,10 +23,10 @@
<?php <?php
//Include DB connection info //Include DB connection info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -37,7 +37,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);

View File

@ -27,7 +27,6 @@
<li><a href="mapping.php">Traffic Map</a></li> <li><a href="mapping.php">Traffic Map</a></li>
</ul> </ul>
</li> </li>
<li><a href="https://noc.liquidweb.com/blackhole/" target="_blank">NOC Nullrouter</a></li>
</ul> </ul>
</nav> </nav>
</body> </body>

View File

@ -86,7 +86,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
<div name=content> <div name=content>
@ -100,11 +100,11 @@
//Set MySQL connection variables //Set MySQL connection variables
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Query //Query
$sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `dst_port` = '22' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY src_ip ORDER BY COUNT(DISTINCT(dst_ip)) DESC LIMIT 10"; $sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `dst_port` = '22' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY src_ip ORDER BY COUNT(DISTINCT(dst_ip)) DESC LIMIT 10";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results, display them in a table //If there are results, display them in a table
if ($result->num_rows >0) { if ($result->num_rows >0) {
@ -112,7 +112,7 @@
echo "<br>"; echo "<br>";
echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>"; echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["src_ip"]."</td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://utilities.mon.liquidweb.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://utilities.mon.liquidweb.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=22 target=_blank>List</a></td></tr>"; echo "<tr><td>".$row["src_ip"]."</td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://DOMAIN.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://DOMAIN.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=22 target=_blank>List</a></td></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {
@ -122,9 +122,9 @@
?> ?>
</div> </div>
<div id=col2> <div id=col2>
Total Connections, every 30 minutes for the past 24hrs. Total Connections, every 30 minutes for the past 24hrs.
<br> <br>
<img src="graph/30min24hr.php?port=22"> <img src="graph/30min24hr.php?port=22">
</div> </div>
<!--Perform the MySQL query to get the source IPs, and geolocate them using the Pear Net::GeoIP class --> <!--Perform the MySQL query to get the source IPs, and geolocate them using the Pear Net::GeoIP class -->

View File

@ -17,13 +17,13 @@
<script type='text/javascript'> <script type='text/javascript'>
//This javascript will load when the page loads. //This javascript will load when the page loads.
jQuery(document).ready( function($){ jQuery(document).ready( function($){
//Initialize the Google Maps //Initialize the Google Maps
var geocoder; var geocoder;
var map; var map;
var markersArray = []; var markersArray = [];
var infos = []; var infos = [];
geocoder = new google.maps.Geocoder(); geocoder = new google.maps.Geocoder();
var myOptions = { var myOptions = {
zoom: 2, zoom: 2,
@ -33,7 +33,7 @@
//Load the Map into the map_canvas div //Load the Map into the map_canvas div
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var mcOptions = {gridSize: 50, maxZoom: 14}; var mcOptions = {gridSize: 50, maxZoom: 14};
//Initialize a variable that the auto-size the map to whatever you are plotting //Initialize a variable that the auto-size the map to whatever you are plotting
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();
//Initialize the encoded string //Initialize the encoded string
@ -44,7 +44,7 @@
encodedString = document.getElementById("encodedString").value; encodedString = document.getElementById("encodedString").value;
//Split the encoded string into an array the separates each location //Split the encoded string into an array the separates each location
stringArray = encodedString.split("****"); stringArray = encodedString.split("****");
var x; var x;
for (x = 0; x < stringArray.length; x = x + 1) for (x = 0; x < stringArray.length; x = x + 1)
{ {
@ -84,13 +84,13 @@
infos.length = 0; infos.length = 0;
} }
} }
}); });
</script> </script>
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Source IP Address Mapping</h3> <h3>Source IP Address Mapping</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -101,10 +101,10 @@
<?php <?php
//Include DB Connection Info //Include DB Connection Info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -115,7 +115,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -149,23 +149,23 @@
}else{ }else{
$varPort = 0; $varPort = 0;
} }
//Connect to DB to pull IPs //Connect to DB to pull IPs
// Create connection // Create connection
$conn1 = new mysqli($servername, $username, $password, $dbname); $conn1 = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query1 = "SELECT src_ip FROM rawdata WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 900) GROUP BY src_ip"; $query1 = "SELECT src_ip FROM rawdata WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 900) GROUP BY src_ip";
$iplist = mysqli_query($conn1, $query1); $iplist = mysqli_query($conn1, $query1);
echo "Now Viewing data for Destination port: $varPort"; echo "Now Viewing data for Destination port: $varPort";
//Initialize your first couple variables //Initialize your first couple variables
$encodedString = ""; //This is the string that will hold all your location data $encodedString = ""; //This is the string that will hold all your location data
$x = 0; //This is a trigger to keep the string tidy $x = 0; //This is a trigger to keep the string tidy
//Multiple rows are returned //Multiple rows are returned
while ($row = mysqli_fetch_array($iplist)) while ($row = mysqli_fetch_array($iplist))
{ {

View File

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Source IP Search</h3> <h3>Source IP Search</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -16,10 +16,10 @@
<?php <?php
//Include DB Connection Info //Include DB Connection Info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -30,7 +30,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -65,27 +65,27 @@
if(isset($_GET['formIP'])) { if(isset($_GET['formIP'])) {
$varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP); $varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP);
} }
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Check Connection //Check Connection
if ($conn2->connect_error) { if ($conn2->connect_error) {
die("Connection Failed: " . $conn2->connect_error); die("Connection Failed: " . $conn2->connect_error);
} }
//Query //Query
$sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `src_ip` = '".$varIP."' AND `dst_port` = '".$varPort."'"; $sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `src_ip` = '".$varIP."' AND `dst_port` = '".$varPort."'";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results, display them in a table //If there are results, display them in a table
if ($result->num_rows >0) { if ($result->num_rows >0) {
echo "Now viewing data for IP: $varIP for Destination Port: $varPort"; echo "Now viewing data for IP: $varIP for Destination Port: $varPort";
echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>"; echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["src_ip"]."</a></td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://utilities.mon.liquidweb.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://utilities.mon.liquidweb.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>"; echo "<tr><td>".$row["src_ip"]."</a></td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://DOMAIN.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://DOMAIN.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {

View File

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Source IPs by Destination</h3> <h3>Source IPs by Destination</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -16,10 +16,10 @@
<?php <?php
//Include DB Connection Info //Include DB Connection Info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -30,7 +30,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -65,27 +65,27 @@
if(isset($_GET['formIP'])) { if(isset($_GET['formIP'])) {
$varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP); $varIP = filter_var(trim($_GET['formIP']), FILTER_VALIDATE_IP);
} }
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Check Connection //Check Connection
if ($conn2->connect_error) { if ($conn2->connect_error) {
die("Connection Failed: " . $conn2->connect_error); die("Connection Failed: " . $conn2->connect_error);
} }
//Query //Query
$sql = "SELECT src_ip, dst_ip FROM `rawdata` WHERE `dst_ip` = '".$varIP."' AND `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 86400) GROUP BY src_ip ORDER BY src_ip;"; $sql = "SELECT src_ip, dst_ip FROM `rawdata` WHERE `dst_ip` = '".$varIP."' AND `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 86400) GROUP BY src_ip ORDER BY src_ip;";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results of the query, display them. //If there are results of the query, display them.
if ($result->num_rows >0) { if ($result->num_rows >0) {
echo "Now viewing data for Destination Port: $varPort"; echo "Now viewing data for Destination Port: $varPort";
echo "<table align='center'><tr><th colspan='2'>Destination IP: $varIP <a href=https://billing.int.liquidweb.com/mysql/content/admin/netblock/assignment/search.mhtml?customer=".$varIP."&submit=Search target=_blank>Netblock</a></tr></th><tr><th>Source IPs</th><th>Whois</tr>"; echo "<table align='center'><tr><th colspan='2'>Destination IP: $varIP <a href=https://DOMAIN.com/ips/assignment/search.mhtml?customer=".$varIP."&submit=Search target=_blank>Netblock</a></tr></th><tr><th>Source IPs</th><th>Whois</tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["src_ip"]."</td><td><a href=http://utilities.mon.liquidweb.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></tr>"; echo "<tr><td>".$row["src_ip"]."</td><td><a href=http://DOMAIN.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {

View File

@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Top Destination IPs</h3> <h3>Top Destination IPs</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -24,10 +24,10 @@
<?php <?php
//Include DB Connection Info //Include DB Connection Info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -38,7 +38,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -69,11 +69,11 @@
} }
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Query //Query
$sql = "SELECT dst_ip, COUNT(DISTINCT(src_ip)), COUNT(dst_ip) FROM `rawdata` WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY dst_ip ORDER BY COUNT(DISTINCT(src_ip)) DESC LIMIT 50"; $sql = "SELECT dst_ip, COUNT(DISTINCT(src_ip)), COUNT(dst_ip) FROM `rawdata` WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY dst_ip ORDER BY COUNT(DISTINCT(src_ip)) DESC LIMIT 50";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results, display them in a table //If there are results, display them in a table
if ($result->num_rows >0) { if ($result->num_rows >0) {
@ -81,7 +81,7 @@
echo "<br>"; echo "<br>";
echo "<table align='center'><tr><th>Destination IP</th><th># of sources</th><th># of connections</th><th>Destination Netblock</th><th>Source IPs</th></tr>"; echo "<table align='center'><tr><th>Destination IP</th><th># of sources</th><th># of connections</th><th>Destination Netblock</th><th>Source IPs</th></tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["dst_ip"]."</td><td>".$row["COUNT(DISTINCT(src_ip))"]."</td><td>".$row["COUNT(dst_ip)"]."</td><td><a href=https://billing.int.liquidweb.com/mysql/content/admin/netblock/assignment/search.mhtml?customer=".$row["dst_ip"]."&submit=Search target=_blank>Netblock</a></td><td><a href=http://utilities.mon.liquidweb.com/netdata/sourceips.php?formIP=".$row["dst_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>"; echo "<tr><td>".$row["dst_ip"]."</td><td>".$row["COUNT(DISTINCT(src_ip))"]."</td><td>".$row["COUNT(dst_ip)"]."</td><td><a href=https://DOMAIN.com/ips/assignment/search.mhtml?customer=".$row["dst_ip"]."&submit=Search target=_blank>Netblock</a></td><td><a href=http://DOMAIN.com/netdata/sourceips.php?formIP=".$row["dst_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {

View File

@ -12,7 +12,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>Top Source IPs</h3> <h3>Top Source IPs</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>
@ -23,10 +23,10 @@
<?php <?php
//Include DB Connection Info //Include DB Connection Info
include("includes/db_config.php"); include("includes/db_config.php");
// Create connection // Create connection
$conn = new mysqli($servername, $username, $password, $dbname); $conn = new mysqli($servername, $username, $password, $dbname);
//Create dropdown //Create dropdown
$query = "SELECT port, svc_name FROM commonports ORDER BY port"; $query = "SELECT port, svc_name FROM commonports ORDER BY port";
$tbllist = mysqli_query($conn, $query); $tbllist = mysqli_query($conn, $query);
@ -37,7 +37,7 @@
$name=$row["svc_name"]; $name=$row["svc_name"];
$options.="<option value=\"$id\">$id - $name</option>"; $options.="<option value=\"$id\">$id - $name</option>";
} }
//Check Connection //Check Connection
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error); die("Connection Failed: " . $conn->connect_error);
@ -68,11 +68,11 @@
} }
// Create connection // Create connection
$conn2 = new mysqli($servername, $username, $password, $dbname); $conn2 = new mysqli($servername, $username, $password, $dbname);
//Query //Query
$sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY src_ip ORDER BY COUNT(DISTINCT(dst_ip)) DESC LIMIT 50"; $sql = "SELECT src_ip, COUNT(DISTINCT(dst_ip)), COUNT(src_ip) FROM `rawdata` WHERE `dst_port` = '".$varPort."' AND time > (UNIX_TIMESTAMP() - 1800) GROUP BY src_ip ORDER BY COUNT(DISTINCT(dst_ip)) DESC LIMIT 50";
$result = $conn2->query($sql); $result = $conn2->query($sql);
//If there are results, display them in a table //If there are results, display them in a table
if ($result->num_rows >0) { if ($result->num_rows >0) {
@ -80,7 +80,7 @@
echo "<br>"; echo "<br>";
echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>"; echo "<table align='center'><tr><th>Source IP</th><th># of targets</th><th># of connections</th><th>Source Whois</th><th>Destination IPs</th></tr>";
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["src_ip"]."</td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://utilities.mon.liquidweb.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://utilities.mon.liquidweb.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>"; echo "<tr><td>".$row["src_ip"]."</td><td>".$row["COUNT(DISTINCT(dst_ip))"]."</td><td>".$row["COUNT(src_ip)"]."</td><td><a href=http://DOMAIN.com/netdata/whoislookup.php?formIPaddr=".$row["src_ip"]." target=_blank>Whois</a></td><td><a href=http://DOMAIN.com/netdata/destinationips.php?formIP=".$row["src_ip"]."&formPort=$varPort target=_blank>List</a></td></tr>";
} }
echo "</table>"; echo "</table>";
} else { } else {

View File

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<div class=header> <div class=header>
<h2>LiquidWeb Traffic Monitoring</h2> <h2>Traffic Monitoring</h2>
<h3>IP WhoIs Lookup</h3> <h3>IP WhoIs Lookup</h3>
<?php include("includes/menu.php"); ?> <?php include("includes/menu.php"); ?>
</div> </div>