Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 281 lines (258 sloc) 8.439 kb
06c3b72 @xme added files
authored
1 <html>
2 <head>
3 <?
4 $formAuto = $_GET["formAuto"];
5 if ($formAuto == "on") {
6 echo '<META HTTP-EQUIV="refresh" CONTENT="60">';
7 }
8 ?>
9 <SCRIPT type="text/javascript" src="js/jquery.js"></SCRIPT>
10 <SCRIPT type="text/javascript" src="js/jquery.cookie.js"></SCRIPT>
11 <SCRIPT type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></SCRIPT>
12 <link type="text/css" href="css/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
13 <link type="text/css" href="css/tables.css" rel="Stylesheet" />
14 <style type="text/css" media="screen">
15 .column { width: 400px; float: left; padding-bottom: 200px; }
16 .tablecolumn { width: 600px; float: left; padding-bottom: 200px; }
17 .portlet { margin: 0 1em 1em 0; }
18 .portlet-header {
19 font-size:13px; margin: 0.3em;
20 padding-bottom: 4px; padding-left: 0.2em; }
21 .portlet-header .ui-icon { float: right; }
22 .portlet-content { padding: 0.4em; }
23 .ui-sortable-placeholder {
24 border: 1px dotted black;
25 visibility: visible !important;
26 height: 200px !important; }
27 .ui-sortable-placeholder * { visibility: hidden; }
28
29 body { font: 62.5% "Trebuchet MS", sans-serif; }
30 </style>
31
32 <script type="text/javascript">
33
34 // function that writes the list order to a cookie
35 function saveOrder() {
36 $(".column").each(function(index, value){
37 var colid = value.id;
38 var cookieName = "cookie-" + colid;
39 // Get the order for this column.
40 var order = $('#' + colid).sortable("toArray");
41 // For each portlet in the column
42 for ( var i = 0, n = order.length; i < n; i++ ) {
43 // Determine if it is 'opened' or 'closed'
44 var v = $('#' + order[i] ).find('.portlet-content').is(':visible');
45 // Modify the array we're saving to indicate what's open and
46 // what's not.
47 order[i] = order[i] + ":" + v;
48 }
49 $.cookie(cookieName, order, { path: "/", expiry: new Date(2012, 1, 1)});
50 });
51 }
52
53 // function that restores the list order from a cookie
54 function restoreOrder() {
55 $(".column").each(function(index, value) {
56 var colid = value.id;
57 var cookieName = "cookie-" + colid
58 var cookie = $.cookie(cookieName);
59 if ( cookie == null ) { return; }
60 var IDs = cookie.split(",");
61 for (var i = 0, n = IDs.length; i < n; i++ ) {
62 var toks = IDs[i].split(":");
63 if ( toks.length != 2 ) {
64 continue;
65 }
66 var portletID = toks[0];
67 var visible = toks[1]
68 var portlet = $(".column")
69 .find('#' + portletID)
70 .appendTo($('#' + colid));
71 if (visible === 'false') {
72 portlet.find(".ui-icon").toggleClass("ui-icon-minus");
73 portlet.find(".ui-icon").toggleClass("ui-icon-plus");
74 portlet.find(".portlet-content").hide();
75 }
76 }
77 });
78 }
79
80
81 $(document).ready( function () {
82 $(".column").sortable({
83 connectWith: ['.column'],
84 stop: function() { saveOrder(); }
85 });
86
87 $(".portlet")
88 .addClass("ui-widget ui-widget-content")
89 .addClass("ui-helper-clearfix ui-corner-all")
90 .find(".portlet-header")
91 .addClass("ui-widget-header ui-corner-all")
92 .prepend('<span class="ui-icon ui-icon-minus"></span>')
93 .end()
94 .find(".portlet-content");
95
96 restoreOrder();
97
98 $(".portlet-header .ui-icon").click(function() {
99 $(this).toggleClass("ui-icon-minus");
100 $(this).toggleClass("ui-icon-plus");
101 $(this).parents(".portlet:first").find(".portlet-content").toggle();
102 saveOrder(); // This is important
103 });
104 $(".portlet-header .ui-icon").hover(
105 function() {$(this).addClass("ui-icon-hover"); },
106 function() {$(this).removeClass('ui-icon-hover'); }
107 );
108 });
109
110 </script>
111 </head>
112
113 <body>
114 <?
115 $secPeriods = array("1800", "3600", "10800", "43200",
116 "86400", "604800", "2592000", "31536000");
117 $namePeriods = array("30 minutes", "1 hour", "3 hours", "12 hours",
118 "1 day", "7 days", "1 month", "1 year");
119 $formPeriod = $_GET["formPeriod"];
120 if (!in_array($formPeriod, $secPeriods)) {
121 # Set default period - 1h
122 $formPeriod = "3600";
123 }
124 ?>
125 <form action="index.php" method="GET">
126 <table width="100%" align="top" >
127 <tr><td align="left"><h3>OSSEC Dashboard <font color="red">(Alpha)</font></h3></td>
128 <td align="right" valign="middle">
129 <select name="formPeriod">
130 <?
131 for ($i = 0; $i < count($secPeriods); $i++) {
132 echo '<option ';
133 if ($secPeriods[$i] == $formPeriod) {
134 echo 'selected ';
135 }
136 echo 'value="' . $secPeriods[$i] . '">' . $namePeriods[$i] . '</option>';
137 }
138 echo '</select><input type="submit" value="Go">';
139 echo '<br><input type="checkbox" name="formAuto"';
140 if ($formAuto == "on") { echo " checked"; }
141 echo '>Auto-reload';
142 if ($formAuto == "on") { echo '<div id="javascript_countdown_time"></div>'; }
143 ?>
144 </td></tr></table>
145 </form>
146 <script>
147 var javascript_countdown = function () {
148 var time_left = 60; //number of seconds for countdown
149 var output_element_id = 'javascript_countdown_time';
150 var keep_counting = 1;
151 var no_time_left_message = 'No time left for JavaScript countdown!';
152
153 function countdown() {
154 if(time_left < 2) {
155 keep_counting = 0;
156 }
157
158 time_left = time_left - 1;
159 }
160
161 function add_leading_zero(n) {
162 if(n.toString().length < 2) {
163 return '0' + n;
164 } else {
165 return n;
166 }
167 }
168
169 function format_output() {
170 var hours, minutes, seconds;
171 seconds = time_left % 60;
172 minutes = Math.floor(time_left / 60) % 60;
173 hours = Math.floor(time_left / 3600);
174
175 seconds = add_leading_zero( seconds );
176 minutes = add_leading_zero( minutes );
177 hours = add_leading_zero( hours );
178
179 /* return hours + ':' + minutes + ':' + seconds; */
180 return time_left + ' seconds';
181 }
182
183 function show_time_left() {
184 document.getElementById(output_element_id).innerHTML = format_output();//time_left;
185 }
186
187 function no_time_left() {
188 document.getElementById(output_element_id).innerHTML = no_time_left_message;
189 }
190
191 return {
192 count: function () {
193 countdown();
194 show_time_left();
195 },
196 timer: function () {
197 javascript_countdown.count();
198
199 if(keep_counting) {
200 setTimeout("javascript_countdown.timer();", 1000);
201 } else {
202 no_time_left();
203 }
204 },
205 init: function (t, element_id) {
206 time_left = t;
207 output_element_id = element_id;
208 javascript_countdown.timer();
209 }
210 };
211 }();
212
213 //time to countdown in seconds, and element ID
214 javascript_countdown.init(180, 'javascript_countdown_time');
215 </script>
216 <hr>
217 <div class="column" id="col1">
218 <div class="portlet" id="top10alerts">
219 <div class="portlet-header">Top-1O Alerts</div>
220 <div class="portlet-content">
221 <p align="center">
222 <? include("content/top10alerts.php"); ?>
223 </p>
224 </div>
225 </div>
226 <div class="portlet" id="top10suspicious">
227 <div class="portlet-header">Top-10 Suspicious</div>
228 <div class="portlet-content">
229 <p align="center">
230 <? include("content/top10suspicious.php"); ?>
231 </p>
232 </div>
233 </div>
234 </div>
235 <div class="column" id="col2">
236 <div class="portlet" id="top10agents.php">
237 <div class="portlet-header">Top-10 Agents</div>
238 <div class="portlet-content">
239 <p align="center">
240 <? include("content/top10agents.php"); ?>
241 </p>
242 </div>
243 </div>
244 <div class="portlet" id="top10locations">
245 <div class="portlet-header">Top-10 Locations</div>
246 <div class="portlet-content">
247 <p align="center">
248 <? include("content/top10locations.php"); ?>
249 </p>
250 </div>
251 </div>
252 </div>
253 <div class="column" id="col3">
254 <div class="portlet" id="top10attackers">
255 <div class="portlet-header">Top-10 Attackers</div>
256 <div class="portlet-content">
257 <p align="center">
258 <? include("content/top10attackers.php"); ?>
259 </p>
260 </div>
261 </div>
262 <div class="portlet" id="timeline">
263 <div class="portlet-header">Events Timeline</div>
264 <div class="portlet-content">
265 <p align="center">
266 <? include("content/timeline.php"); ?>
267 </p>
268 </div>
269 </div>
c2c6370 @xme Some fixes
authored
270 <div class="portlet" id="trendlevel">
271 <div class="portlet-header">Trend Level</div>
272 <div class="portlet-content">
273 <p align="center">
274 <? include("content/trendlevel.php"); ?>
275 </p>
276 </div>
277 </div>
06c3b72 @xme added files
authored
278 </div>
279 </body>
280 </html>
Something went wrong with that request. Please try again.