Skip to content
Snippets Groups Projects
Commit ab468508 authored by root's avatar root
Browse files

ui bugfix: do generovanych grafu muze prijit velke mnozstvi dat,

pri defaultnich zobrazenich oriznu na 1000 radek. ostatni maji
zatim alertuji pres js
parent f271d6cd
Branches
Tags
No related merge requests found
...@@ -16,9 +16,14 @@ switch( $_GET['per']) { ...@@ -16,9 +16,14 @@ switch( $_GET['per']) {
} }
#sqli todo #sqli todo
#limits
$limit="";
#selector #selector
if(!IsSet($_GET['where'])) { if(!IsSet($_GET['where'])) {
$where="detected>from_unixtime(0)"; $where="1=1";
$limit="order by detected desc limit 1000";
} else { } else {
$where = base64_decode($_GET['where']); $where = base64_decode($_GET['where']);
} }
...@@ -51,7 +56,7 @@ $count_cols=count($cols); ...@@ -51,7 +56,7 @@ $count_cols=count($cols);
$data=array(); $data=array();
#casova posloupnost #casova posloupnost
# premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu # premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu
$q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, count(*) as count FROM events WHERE $where GROUP BY $query_cols, t;"; $q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, count(*) as count FROM events WHERE $where GROUP BY $query_cols, t $limit";
#var_dump($q); #var_dump($q);
$res = mysql_query($q, $db); $res = mysql_query($q, $db);
while ($tmp = mysql_fetch_assoc($res)) { while ($tmp = mysql_fetch_assoc($res)) {
......
...@@ -16,9 +16,14 @@ switch( $_GET['per']) { ...@@ -16,9 +16,14 @@ switch( $_GET['per']) {
} }
#sqli todo #sqli todo
#limits
$limit="";
#selector #selector
if(!IsSet($_GET['where'])) { if(!IsSet($_GET['where'])) {
$where="detected>from_unixtime(0)"; $where="1=1";
$limit="order by detected desc limit 1000";
} else { } else {
$where = base64_decode($_GET['where']); $where = base64_decode($_GET['where']);
} }
...@@ -51,7 +56,7 @@ $count_cols=count($cols); ...@@ -51,7 +56,7 @@ $count_cols=count($cols);
$data=array(); $data=array();
#casova posloupnost #casova posloupnost
# premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu # premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu
$q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, sum(attack_scale) as totalScale FROM events WHERE $where GROUP BY $query_cols, t;"; $q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, sum(attack_scale) as totalScale FROM events WHERE $where GROUP BY $query_cols, t $limit";
#var_dump($q); #var_dump($q);
$res = mysql_query($q, $db); $res = mysql_query($q, $db);
while ($tmp = mysql_fetch_assoc($res)) { while ($tmp = mysql_fetch_assoc($res)) {
......
...@@ -17,7 +17,8 @@ switch( $_GET['per']) { ...@@ -17,7 +17,8 @@ switch( $_GET['per']) {
#sqli todo #sqli todo
#selector #selector
$where="detected>from_unixtime(0)"; $where="1=1";
$limit="order by detected desc limit 1004";
$query_cols = "type"; $query_cols = "type";
...@@ -46,7 +47,7 @@ $count_cols=count($cols); ...@@ -46,7 +47,7 @@ $count_cols=count($cols);
$data=array(); $data=array();
#casova posloupnost #casova posloupnost
# premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu # premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu
$q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, count(*) as count FROM events WHERE $where GROUP BY $query_cols, t;"; $q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, count(*) as count FROM events WHERE $where GROUP BY $query_cols, t $limit";
#var_dump($q); #var_dump($q);
$res = mysql_query($q, $db); $res = mysql_query($q, $db);
while ($tmp = mysql_fetch_assoc($res)) { while ($tmp = mysql_fetch_assoc($res)) {
......
...@@ -17,7 +17,8 @@ switch( $_GET['per']) { ...@@ -17,7 +17,8 @@ switch( $_GET['per']) {
#sqli todo #sqli todo
#selector #selector
$where="detected>from_unixtime(0)"; $where="1=1";
$limit="order by detected desc limit 1003";
$query_cols = "type"; $query_cols = "type";
...@@ -46,7 +47,7 @@ $count_cols=count($cols); ...@@ -46,7 +47,7 @@ $count_cols=count($cols);
$data=array(); $data=array();
#casova posloupnost #casova posloupnost
# premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu # premapuju podle staticky alokovanych sloupcu, posilam to rovnou do grafu
$q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, sum(attack_scale) as totalScale FROM events WHERE $where GROUP BY $query_cols, t;"; $q = "SELECT unix_timestamp(detected)-(unix_timestamp(detected)%(3600*$agg)) as t, concat_ws('-',$query_cols) as col, sum(attack_scale) as totalScale FROM events WHERE $where GROUP BY $query_cols, t $limit";
#var_dump($q); #var_dump($q);
$res = mysql_query($q, $db); $res = mysql_query($q, $db);
while ($tmp = mysql_fetch_assoc($res)) { while ($tmp = mysql_fetch_assoc($res)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment