public function display()
 {
     /*CHART*/
     $chart = new VerticalBarChart(4500, 350);
     $dataSet = new XYDataSet();
     foreach ($this->data as $key => $datum) {
         $dataSet->addPoint(new Point($datum['client_ip'], $datum['frequency']));
     }
     $chart->setDataSet($dataSet);
     $chart->getPlot()->setLogoFileName("");
     //clear the image logo
     $chart->setTitle("");
     //clear the image title
     $chart->render("front-end/images/client_request_vertical_bar_plot.png");
     /*CHART*/
     $session = SessionFactory::create();
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     $selectedDate = $session->get("selected-date");
     $title = "<h3>Bar Graph IP requests for the day: " . $selectedDate . " </h3>";
     $dom->whereIdIs("body-title")->insertNode($title);
     $graph = '<div style="text-align: center;">
     			<img src="front-end/images/client_request_vertical_bar_plot.png" alt="" border="0">
     			</div>';
     $dom->whereIdIs("squidDataContainer")->insertNode($graph);
     $dom->display();
 }
Ejemplo n.º 2
0
$serie2->addPoint(new Point("{$month} 21, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "21", $year), 2)));
$serie2->addPoint(new Point("{$month} 22, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "22", $year), 2)));
$serie2->addPoint(new Point("{$month} 23, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "23", $year), 2)));
$serie2->addPoint(new Point("{$month} 24, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "24", $year), 2)));
$serie2->addPoint(new Point("{$month} 25, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "25", $year), 2)));
$serie2->addPoint(new Point("{$month} 26, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "26", $year), 2)));
$serie2->addPoint(new Point("{$month} 27, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "27", $year), 2)));
$serie2->addPoint(new Point("{$month} 28, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "28", $year), 2)));
$serie2->addPoint(new Point("{$month} 29, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "29", $year), 2)));
$serie2->addPoint(new Point("{$month} 30, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "30", $year), 2)));
$serie2->addPoint(new Point("{$month} 31, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "31", $year), 2)));
$dataSet = new XYSeriesDataSet();
$dataSet->addSerie("OPD", $serie1);
$dataSet->addSerie("IPD", $serie2);
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphCaptionRatio(0.35);
$chart->setTitle("Registration Census for {$month} {$year}");
$chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Registration Census for <?php 
echo $month;
echo $year;
?>
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
	<img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyRegistration.png" style="border: 1px solid gray;"/>
Ejemplo n.º 3
0
$db_query = "SELECT source_ip, COUNT(source_ip)\n  FROM connections\n  WHERE proto = 'icmp'\n  GROUP BY source_ip\n  ORDER BY COUNT(source_ip) DESC\n  LIMIT 10 ";
$rows = R::getAll($db_query);
if (count($rows)) {
    //We create a new vertical bar chart,a new pie chart and initialize the dataset
    $chart = new VerticalBarChart(600, 300);
    $pie_chart = new PieChart(600, 300);
    $dataSet = new XYDataSet();
    //For every row returned from the database we add a new point to the dataset
    foreach ($rows as $row) {
        $dataSet->addPoint(new Point($row['source_ip'], $row['COUNT(source_ip)']));
    }
    //We set the bar chart's dataset and render the graph
    $chart->setDataSet($dataSet);
    $chart->setTitle("Number of ICMP connections per unique IP (Top 10)");
    //For this particular graph we need to set the corrent padding
    $chart->getPlot()->setGraphPadding(new Padding(5, 40, 75, 50));
    //top, right, bottom, left | defaults: 5, 30, 50, 50
    $chart->render("generated-graphs/icmp_connections_per_ip.png");
    //We set the pie chart's dataset and render the graph
    $pie_chart->setDataSet($dataSet);
    $pie_chart->setTitle("Number of ICMP connections per unique IP (Top 10)");
    $pie_chart->render("generated-graphs/icmp_connections_per_ip_pie.png");
}
//-----------------------------------------------------------------------------------------------------------------
//CONNECTIONS BY DESTINATION PORTS
//-----------------------------------------------------------------------------------------------------------------
$db_query = "SELECT dest_port, COUNT(dest_port), proto\n  FROM connections\n  GROUP BY dest_port\n  ORDER BY COUNT(dest_port) DESC ";
$rows = R::getAll($db_query);
if (count($rows)) {
    //We create a new vertical bar chart,a new pie chart and initialize the dataset
    $chart = new VerticalBarChart(600, 300);
    $nbcategories = CountCategories();
    //donnes du graphique
    $chartCat = new VerticalBarChart(425, 300);
    $dataSetCat = new XYDataSet();
    $y = $year;
    if ($nbcategories > 0) {
        for ($n = 1; $n <= $nbcategories; $n++) {
            $categories = mysqli_fetch_array(statSessionCategory($n, $y, $epn));
            //debug($categories);
            $particip = round($categories['presents'] / $categories['inscrits'] * 100, 2) . " %";
            $dataSetCat->addPoint(new Point($categories['label_categorie'], $particip));
        }
        //creation du graphique
        $chartCat->setDataSet($dataSetCat);
        $chartCat->setTitle("Participation par categories en %");
        $chartCat->getPlot()->getPalette()->setBarColor(array(new Color(1, 105, 201)));
        $chartCat->render("img/chart/" . $year . "/categorieSession.png");
    }
    ?>


<!-- Mettre en evidence frequentation participation -->
<div class="box box-primary">
          <div class="box-header"><i class="fa fa-bar-chart-o"></i><h3 class="box-title">Fréquentation des sessions (année <?php 
    echo $year;
    ?>
)</h3></div>
	<div class="box-body">
		<table class="table"> 
				<thead><tr>
					<th>Titre</th> 
 public function printTop10Urls()
 {
     $db_query = "SELECT url, COUNT(url) AS count\n          FROM connections\n          WHERE url <> ''\n          GROUP BY url\n          ORDER BY COUNT(url) DESC\n          LIMIT 10";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart and initialize the dataset
         $chart = new VerticalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //We create a skeleton for the table
         $counter = 1;
         echo '<h3>Top 10 urls</h3>';
         echo '<p>The following table displays the top 10 urls used by attackers.</p>';
         echo '<p><a href="include/export.php?type=Urls">CSV of all urls</a><p>';
         echo '<table><thead>';
         echo '<tr class="dark">';
         echo '<th>ID</th>';
         echo '<th>Url</th>';
         echo '<th>Count</th>';
         echo '</tr></thead><tbody>';
         //For every row returned from the database we add a new point to the dataset,
         //and create a new table row with the data as columns
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point($row['url'], $row['count']));
             echo '<tr class="light word-break">';
             echo '<td>' . $counter . '</td>';
             echo '<td>' . xss_clean($row['url']) . '</td>';
             echo '<td>' . $row['count'] . '</td>';
             echo '</tr>';
             $counter++;
         }
         //Close tbody and table element, it's ready.
         echo '</tbody></table>';
         //We set the bar chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(TOP_10_URLS);
         //For this particular graph we need to set the corrent padding
         $chart->getPlot()->setGraphPadding(new Padding(5, 40, 120, 50));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render("generated-graphs/top10_urls.png");
         echo '<p>This vertical bar chart visualizes the top 10 urls used by attackers.</p>';
         echo '<img src="generated-graphs/top10_urls.png">';
         echo '<hr /><br />';
     }
 }
 /**
  * Función que genera la gráfica con el promedio de los
  * errores cometidos por los alumnos. Va a mostrarse
  * en el panel del profesor.
  * 
  */
 public function generarGraficaMediaErrores()
 {
     $chart = new \VerticalBarChart(800, 350);
     $serie_errores_unitarios = new \XYDataSet();
     $serie_errores_excepcion = new \XYDataSet();
     $num_alumnos_por_intento = array();
     $alumnos_tabla = TableRegistry::get("Alumnos");
     $alumnos = $alumnos_tabla->find('all');
     $intento_realizado = false;
     foreach ($alumnos as $alumno) {
         $intentos_tabla = TableRegistry::get("Intentos");
         $intentos = $intentos_tabla->find('all')->where(['tarea_id' => $_SESSION["lti_idTarea"], 'alumno_id' => $alumno->id]);
         foreach ($intentos as $intento) {
             $intento_realizado = true;
             $clave = "Intento " . $intento->numero_intento;
             if (array_key_exists($clave, $num_alumnos_por_intento)) {
                 $num_alumnos_por_intento[$clave] += 1;
             } else {
                 $num_alumnos_por_intento[$clave] = 1;
             }
             // Errores
             $num_errores_unitarios = 0;
             $num_errores_excepcion = 0;
             $errores_tabla = TableRegistry::get("Errores");
             $errores = $errores_tabla->find('all')->where(['intento_id' => $intento->id])->toArray();
             foreach ($errores as $error) {
                 if ($error->tipo_error == "failure") {
                     $num_errores_unitarios++;
                 } else {
                     $num_errores_excepcion++;
                 }
             }
             $point_error_unitario = $serie_errores_unitarios->getPointWithX($clave);
             if ($point_error_unitario != null) {
                 $point_error_unitario->setY(round(($point_error_unitario->getY() + $num_errores_unitarios) / $num_alumnos_por_intento[$clave]), 2);
             } else {
                 $serie_errores_unitarios->addPoint(new \Point($clave, $num_errores_unitarios));
             }
             $point_error_excepcion = $serie_errores_excepcion->getPointWithX($clave);
             if ($point_error_excepcion != null) {
                 $point_error_excepcion->setY(round(($point_error_excepcion->getY() + $num_errores_excepcion) / $num_alumnos_por_intento[$clave]), 2);
             } else {
                 $serie_errores_excepcion->addPoint(new \Point($clave, $num_errores_excepcion));
             }
         }
     }
     if ($intento_realizado) {
         $dataSet = new \XYSeriesDataSet();
         $dataSet->addSerie("Unitarios", $serie_errores_unitarios);
         $dataSet->addSerie("Excepciones", $serie_errores_excepcion);
         $chart->setDataSet($dataSet);
         $chart->getPlot()->setGraphCaptionRatio(0.75);
         $chart->setTitle("Promedio de errores cometidos por intento");
         $chart->render("img/" . $_SESSION["lti_idTarea"] . "-prof-promedioErroresUnitariosExcepciones.png");
     }
 }
 public function printShockpotGeoData()
 {
     $db_query = "SELECT source_ip, COUNT(source_ip) AS count\n          FROM connections\n          GROUP BY source_ip\n          ORDER BY COUNT(source_ip) DESC\n          LIMIT 10 ";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart, a new pie chart and initialize the dataset
         $verticalChart = new VerticalBarChart(600, 300);
         $pieChart = new PieChart(600, 300);
         $dataSet = new XYDataSet();
         //We create a "intensity" pie chart as well along with a dataset
         $intensityPieChart = new PieChart(600, 300);
         $intensityDataSet = new XYDataSet();
         //We create a new Google Map and initialize its columns,
         //where the decoded geolocation data will be entered in the format
         //of Lat(number), Lon(number) and IP(string)
         $gMapTop10 = new QMapGoogleGraph();
         $gMapTop10->addColumns(array(array('number', 'Lat'), array('number', 'Lon'), array('string', 'IP')));
         //We create a new Intensity Map and initialize its columns,
         //where the decoded geolocation data will be entered in the format
         //of Country(2 letter string), #Probes(number)
         $intensityMap = new QIntensitymapGoogleGraph();
         $intensityMap->addDrawProperties(array("title" => 'IntensityMap'));
         $intensityMap->addColumns(array(array('string', '', 'Country'), array('number', '#Probes', 'a')));
         //We create a temporary table in the database where we will store the IPs along with their #probes
         //and the corresponding country code, otherwise the Intensity Map won't work, because we need to
         //GROUP BY country code and SUM the #Probers per country
         $temp_table = 'CREATE TEMPORARY TABLE temp_ip (ip TEXT, counter INTEGER, country TEXT)';
         R::exec($temp_table);
         //We create a dummy counter to use for the markers' tooltip inside Google Map like: IP 3/10
         //We use the same counter for the IP <table> as well
         $counter = 1;
         //We create a skeleton for the table
         echo '<p>The following table displays the top 10 IP addresses connected to the system (ordered by volume of connections).</p>';
         echo '<table><thead>';
         echo '<tr class="dark">';
         echo '<th>ID</th>';
         echo '<th>IP Address</th>';
         echo '<th>Probes</th>';
         echo '<th>City</th>';
         echo '<th>Region</th>';
         echo '<th>Country Name</th>';
         echo '<th>Code</th>';
         echo '<th>Latitude</th>';
         echo '<th>Longitude</th>';
         echo '<th>Hostname</th>';
         echo '<th colspan="9">IP Lookup</th>';
         echo '</tr></thead><tbody>';
         //We need to add data on the correct Map columns. The columns are always 0 or 1 or 2 for every repetition
         //so we can hardcode it into our code, but we need a way to automatically increase the row index. So we
         //create a dummy index variable to be increased after every repetition (as many db results we have)
         $col = 0;
         //For every row returned from the database...
         foreach ($rows as $row) {
             //We create a new GeoDataObject which geolocates the IP address
             $geodata = new GeoDataObject($this, $row['source_ip']);
             //We prepare the label for our vertical bar chart and add the point
             $label = $row['source_ip'] . " - " . $geodata->countryCode;
             $dataSet->addPoint(new Point($label, $row['count']));
             //We next prepare the marker's tooltip inside Google Map
             $tooltip = "<strong>TOP {$counter}/10:</strong> " . $row['source_ip'] . "<br />" . "<strong>Probes:</strong> " . $row['count'] . "<br />" . "<strong>City:</strong> " . $geodata->city . "<br />" . "<strong>Region:</strong> " . $geodata->region . "<br />" . "<strong>Country:</strong> " . $geodata->countryName . "<br />" . "<strong>Latitude:</strong> " . $geodata->latitude . "<br />" . "<strong>Longitude:</strong> " . $geodata->longitude . "<br />";
             //And add the marker to the map
             $gMapTop10->setValues(array(array($col, 0, (double) $geodata->latitude), array($col, 1, (double) $geodata->longitude), array($col, 2, $tooltip)));
             //We prepare the data that will be inserted in our temporary table
             $ip = $row['source_ip'];
             $ip_count = $row['count'];
             $country_code = $geodata->countryCode;
             $country_query = "INSERT INTO temp_ip VALUES('{$ip}', '{$ip_count}', '{$country_code}')";
             R::exec($country_query);
             //For every row returned from the database we create a new table row with the data as columns
             echo '<tr class="light">';
             echo '<td>' . $counter . '</td>';
             echo '<td>' . $row['source_ip'] . '</td>';
             echo '<td>' . $row['count'] . '</td>';
             echo '<td>' . $geodata->city . '</td>';
             echo '<td>' . $geodata->region . '</td>';
             echo '<td>' . $geodata->countryName . '</td>';
             echo '<td>' . $geodata->countryCode . '</td>';
             echo '<td>' . $geodata->latitude . '</td>';
             echo '<td>' . $geodata->longitude . '</td>';
             echo '<td>' . get_host($row['source_ip']) . '</td>';
             echo '<td class="icon"><a href="http://www.dshield.org/ipinfo.html?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/dshield.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.ipvoid.com/scan/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ipvoid.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.robtex.com/ip/' . $row['source_ip'] . '.html" target="_blank"><img class="icon" src="images/robtex.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.fortiguard.com/ip_rep/index.php?data=' . $row['source_ip'] . '&lookup=Lookup" target="_blank"><img class="icon" src="images/fortiguard.ico"/></a></td>';
             echo '<td class="icon"><a href="http://labs.alienvault.com/labs/index.php/projects/open-source-ip-reputation-portal/information-about-ip/?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/alienvault.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.reputationauthority.org/lookup.php?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/watchguard.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.mcafee.com/threat-intelligence/ip/default.aspx?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/mcafee.ico"/></a></td>';
             echo '<td class="icon"><a href="http://www.ip-adress.com/ip_tracer/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ip_tracer.png"/></a></td>';
             echo '<td class="icon"><a href="https://www.virustotal.com/en/ip-address/' . $row['source_ip'] . '/information/" target="_blank"><img class="icon" src="images/virustotal.ico"/></a></td>';
             echo '</tr>';
             //Lastly, we increase the index used by maps to indicate the next row,
             //and the dummy counter that indicates the next IP index (out of 10)
             $col++;
             $counter++;
         }
         //Close tbody and table element, it's ready.
         echo '</tbody></table>';
         echo '<hr /><br />';
         //While still inside the if(count($rows)) clause (otherwise the dataSet will be empty),
         //we set the bar chart's dataset, render the graph and display it (we're inside html code!)
         $verticalChart->setDataSet($dataSet);
         $verticalChart->setTitle(NUMBER_OF_CONNECTIONS_PER_UNIQUE_IP_CC);
         //For this particular graph we need to set the corrent padding
         $verticalChart->getPlot()->setGraphPadding(new Padding(5, 50, 100, 50));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $verticalChart->render("generated-graphs/connections_per_ip_geo.png");
         echo '<p>The following vertical bar chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>';
         echo '<img src="generated-graphs/connections_per_ip_geo.png">';
         //We set the pie chart's dataset, render the graph and display it (we're inside html code!)
         $pieChart->setDataSet($dataSet);
         $pieChart->setTitle(NUMBER_OF_CONNECTIONS_PER_UNIQUE_IP_CC);
         $pieChart->render("generated-graphs/connections_per_ip_geo_pie.png");
         echo '<p>The following pie chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>';
         echo '<img src="generated-graphs/connections_per_ip_geo_pie.png">';
         echo '<hr /><br />';
         //Charts are ready, so is Google Map, let's render it below
         echo '<p>The following zoomable world map marks the geographic locations of the top 10 IPs according to their latitude and longitude values. ' . 'Click on them to get the full information available from the database.<p>';
         //echo '<div align=center>';
         echo $gMapTop10->render();
         //echo '</div>';
         echo '<br/><hr /><br />';
         //Lastly, we prepare the data for the Intesity Map
         $db_query_map = "SELECT country, SUM(counter) AS sum\n              FROM temp_ip\n              GROUP BY country\n              ORDER BY SUM(counter) DESC ";
         //LIMIT 10 ";
         $rows = R::getAll($db_query_map);
         if (count($rows)) {
             $col = 0;
             //Dummy row index
             //For every row returned from the database add the values to Intensity Map's table and intensityPieChart
             foreach ($rows as $row) {
                 $countryProbes = $row['country'] . " - " . $row['sum'];
                 $intensityDataSet->addPoint(new Point($countryProbes, $row['sum']));
                 $intensityMap->setValues(array(array($col, 0, (string) $row['country']), array($col, 1, (int) $row['sum'])));
                 $col++;
             }
         }
         //Intensity Map is ready, render it
         echo '<p>The following Intensity Map shows the volume of attacks per country by summarising probes originating from the same nation, using the same IP or not.</p>';
         echo $intensityMap->render();
         echo '<br/>';
         //We set the "intensity" pie chart's dataset, render the graph and display it (we're inside html code!)
         $intensityPieChart->setDataSet($intensityDataSet);
         $intensityPieChart->setTitle(NUMBER_OF_CONNECTIONS_PER_COUNTRY);
         $intensityPieChart->render("generated-graphs/connections_per_country_pie.png");
         echo '<p>The following pie chart visualizes the volume of attacks per country by summarising probes originating from the same nation, using the same IP or not.</p>';
         echo '<img src="generated-graphs/connections_per_country_pie.png">';
         if (GEO_METHOD == 'LOCAL') {
             echo '<hr /><small><a href="http://www.maxmind.com">http://www.maxmind.com</a></small><br />';
         } else {
             if (GEO_METHOD == 'GEOPLUGIN') {
                 echo '<hr /><small><a href="http://www.geoplugin.com/geolocation/" target="_new">IP Geolocation</a> by <a href="http://www.geoplugin.com/" target="_new">geoPlugin</a></small><br />';
             } else {
                 //TODO
             }
         }
     }
     //END IF
 }
Ejemplo n.º 8
0
 public function printTop10FailedInput()
 {
     $db_query = "SELECT input, COUNT(input)\n          FROM input\n          WHERE success = 0\n          GROUP BY input\n          ORDER BY COUNT(input) DESC\n          LIMIT 10";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart and initialize the dataset
         $chart = new VerticalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //We create a skeleton for the table
         $counter = 1;
         echo '<h3>Top 10 failed input</h3>';
         echo '<p>The following table displays the top 10 failed commands entered by attackers in the honeypot system.</p>';
         echo '<p><a href="include/export.php?type=FailedInput">CSV of all failed commands</a><p>';
         echo '<table><thead>';
         echo '<tr class="dark">';
         echo '<th>ID</th>';
         echo '<th>Input (fail)</th>';
         echo '<th>Count</th>';
         echo '</tr></thead><tbody>';
         //For every row returned from the database we add a new point to the dataset,
         //and create a new table row with the data as columns
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point($row['input'], $row['COUNT(input)']));
             echo '<tr class="light word-break">';
             echo '<td>' . $counter . '</td>';
             echo '<td>' . xss_clean($row['input']) . '</td>';
             echo '<td>' . $row['COUNT(input)'] . '</td>';
             echo '</tr>';
             $counter++;
         }
         //Close tbody and table element, it's ready.
         echo '</tbody></table>';
         //We set the bar chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(TOP_10_FAILED_INPUT);
         //For this particular graph we need to set the corrent padding
         $chart->getPlot()->setGraphPadding(new Padding(5, 40, 120, 50));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render(DIR_ROOT . "/generated-graphs/top10_failed_input.png");
         echo '<p>This vertical bar chart visualizes the top 10 failed commands entered by attackers in the honeypot system.</p>';
         echo '<img src="generated-graphs/top10_failed_input.png">';
         echo '<hr /><br />';
     }
 }
Ejemplo n.º 9
0
            $data9 = mysql_fetch_assoc($hasil9);
            $jam = $data9['jam'];
            $jumlahjam = $data9['jumlahjam'];
            $dataSet9->addPoint(new Point("{$a}", $jumlahjam));
        }
        $chart9->setDataSet($dataSet9);
        $chart9->setTitle("Most visited Hours");
        $chart9->render("mosthours.png");
        $admin .= '<img alt="Jumlah Kunjungan Jam"  src="mosthours.png"/>';
        /************************/
        $dataSet5 = new XYSeriesDataSet();
        $dataSet5->addSerie("Kunjungan", $serie1);
        $dataSet5->addSerie("Halaman", $serie2);
        $dataSet5->addSerie("Hits", $serie3);
        $chart5->setDataSet($dataSet5);
        $chart5->getPlot()->setGraphCaptionRatio(0.65);
        $chart5->setTitle("Statistik Kunjungan Tanggal");
        $chart5->render("jumlahkunjungan.png");
        $admin .= '<img alt="Jumlah Kunjungan"  src="jumlahkunjungan.png"/>';
        $query8 = "SELECT dateflag,count(distinct(ip)) AS kunjungan,count(distinct(filename)) AS filename,count(*) AS hits FROM statistiksitus WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}'group by dateflag asc";
        $hasil8 = mysql_query($query8);
        $admin .= '
<div class="row">
<div class="col-md-3">';
        $admin .= '<table class="table table-nonfluid">
<tr><td colspan="6" align="center" class="bg-primary"><b>Statistik Per Tanggal</b></td></tr>
  <tr align="center">
    <td><b>Date</b></td>
    <td><b>Visited</b></td>
    <td><b>Pages</b></td>
    <td><b>Hits</b></td>
 public function createShellshockAttacksFromSameIP()
 {
     $db_query = "SELECT source_ip, COUNT(source_ip) AS count\n          FROM connections\n          WHERE is_shellshock = 'true'\n          GROUP BY source_ip\n          ORDER BY COUNT(source_ip) DESC\n          LIMIT 20 ";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart and initialize the dataset
         $chart = new VerticalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //For every row returned from the database we add a new point to the dataset
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point($row['source_ip'], $row['count']));
         }
         //We set the bar chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(SHELLSHOCK_ATTACKS_FROM_SAME_IP);
         //For this particular graph we need to set the corrent padding
         $chart->getPlot()->setGraphPadding(new Padding(5, 45, 80, 50));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render("generated-graphs/shellshocks_attacks_from_same_ip.png");
     }
 }
          <div class="box-header"><i class="fa fa-bar-chart-o"></i><h3 class="box-title">Nombre d'heures de r&eacute;servation par jour pour le mois de <?php 
echo getMonth($month);
?>
  </h3></div>
<div class="box-body">
           <?php 
for ($i = 1; $i <= $nb_jour; ++$i) {
    $result = getStatResaByDay($year . '-' . $month . '-' . $i, $epn);
    //debug($result['duree']);
    $dataSet3->addPoint(new Point($i, $result['duree']));
    $maxBound[$i] = $result['duree'];
}
$maxValue = ceil(max($maxBound) / 60);
$chart3->setDataSet($dataSet3);
$chart3->setTitle("Detail des heures pour " . getMonth($month) . " " . $year . " ");
$chart3->getPlot()->getPalette()->setBarColor(array(new Color(128, 195, 28)));
$chart3->getPlot()->setLabelGenerator(new TimeLabelGenerator());
// arrondir la valeur maximale supérieure
$chart3->getBound()->setUpperBound($maxValue * 60);
//  $chart3->getTics()->quantizeTics(12);
$chart3->render("img/chart/" . $year . "/" . $namepn . "_resa-Mensuelle-" . $month . ".png");
?>
   <!-- rendu du graphique sous forme d'image-->      
	<img src="img/chart/<?php 
echo $year;
?>
/<?php 
echo $namepn;
?>
_resa-Mensuelle-<?php 
echo $month;
Ejemplo n.º 12
0
 public function createSuccessfulLoginsFromSameIP()
 {
     $db_query = "SELECT sessions.ip, COUNT(sessions.ip)\n          FROM sessions INNER JOIN auth ON sessions.id = auth.session\n          WHERE auth.success = 1\n          GROUP BY sessions.ip\n          ORDER BY COUNT(sessions.ip) DESC\n          LIMIT 20 ";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart and initialize the dataset
         $chart = new VerticalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //For every row returned from the database we add a new point to the dataset
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point($row['ip'], $row['COUNT(sessions.ip)']));
         }
         //We set the bar chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(SUCCESSFUL_LOGINS_FROM_SAME_IP);
         //For this particular graph we need to set the corrent padding
         $chart->getPlot()->setGraphPadding(new Padding(5, 45, 80, 50));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render(DIR_ROOT . "/generated-graphs/logins_from_same_ip.png");
     }
 }
Ejemplo n.º 13
0
            case "09":
                $matches[$curTimestamp]['month'] = 'S';
                break;
            case "10":
                $matches[$curTimestamp]['month'] = 'O';
                break;
            case "11":
                $matches[$curTimestamp]['month'] = 'N';
                break;
            case "12":
                $matches[$curTimestamp]['month'] = 'D';
                break;
        }
    }
    // done with this month
    $oldTimestamp = $curTimestamp;
}
$chart = new VerticalBarChart(1400, 550);
$dataSet = new XYDataSet();
$chart->getPlot()->setGraphPadding(new Padding(5, 25, 10, 25));
// add a data point for each month
foreach ($matches as $matchesPerMonth) {
    $dataSet->addPoint(new Point($matchesPerMonth['month'], $matchesPerMonth['matches']));
}
$chart->setDataSet($dataSet);
// compute oldest month in a nice formatting for chart
$oldestMonth = substr($curTimestamp, 5);
$oldestMonth .= '/' . substr($curTimestamp, 0, 4);
$chart->setTitle('Official GU Matches [ ' . $oldestDate . ' - ' . $oldestMonth . ' ]');
// FIXME: Where should the graph be saved?
$chart->render(dirname(__FILE__) . '/img/matchesPerMonthBar.png');
Ejemplo n.º 14
0
     echo '<td><a href="http://www.dshield.org/ipinfo.html?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/dshield.ico"/></a>' . '<a href="http://www.ipvoid.com/scan/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ipvoid.png"/></a>' . '<a href="http://www.robtex.com/ip/' . $row['source_ip'] . '.html" target="_blank"><img class=icon" src="images/robtex.ico"/></a>' . '<a href="http://www.mcafee.com/threat-intelligence/ip/default.aspx?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/mcafee.ico"/></a>' . '<a href="http://www.ip-adress.com/ip_tracer/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ip_tracer.png"/></a>' . '<a href="https://www.virustotal.com/en/ip-address/' . $row['source_ip'] . '/information/" target="_blank"><img class="icon" src="images/virustotal.ico"/></a></td>';
     echo '</td></tr>';
     //Lastly, we increase the index used by maps to indicate the next row,
     //and the dummy counter that indicates the next IP index (out of 10)
     $col++;
     $counter++;
 }
 //Close tbody and table element, it's ready.
 echo '</tbody></table>';
 echo '<hr /><br />';
 //While still inside the if($result->num_rows > 0) clause (otherwise the dataSet will be empty),
 //we set the bar chart's dataset, render the graph and display it (we're inside html code!)
 $verticalChart->setDataSet($dataSet);
 $verticalChart->setTitle("Number of connections per unique IP (Top 10) + Country Codes");
 //For this particular graph we need to set the corrent padding
 $verticalChart->getPlot()->setGraphPadding(new Padding(5, 50, 100, 50));
 //top, right, bottom, left | defaults: 5, 30, 50, 50
 $verticalChart->render("generated-graphs/connections_per_ip_geo.png");
 echo '<p>The following vertical bar chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>';
 echo '<img src="generated-graphs/connections_per_ip_geo.png">';
 //We set the pie chart's dataset, render the graph and display it (we're inside html code!)
 $pieChart->setDataSet($dataSet);
 $pieChart->setTitle("Number of connections per unique IP (Top 10) + Country Codes");
 $pieChart->render("generated-graphs/connections_per_ip_geo_pie.png");
 echo '<p>The following pie chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>';
 echo '<img src="generated-graphs/connections_per_ip_geo_pie.png">';
 echo '<hr /><br />';
 //Charts are ready, so is Google Map, let's render it below
 echo '<p>The following zoomable world map marks the geographic locations of the top 10 IPs according to their latitude and longitude values. ' . 'Click on them to get the full information available from the database.<p>';
 //echo '<div align=center>';
 echo $gMapTop10->render();