Commit 28804449 authored by Luke Stuart's avatar Luke Stuart Committed by Ted Trask

Weblog Updates including Squark support and revamped analysis.

parent 9377ebd8
APP_NAME=weblog
PACKAGE=acf-$(APP_NAME)
VERSION=0.5.9
VERSION=0.6.0
CRON_FILE=weblogimport
......
#!/bin/bash
mkdir /etc/weblog
touch /etc/weblog/goodwords
touch /etc/weblog/badwords
touch /etc/weblog/ignorewords
This diff is collapsed.
......@@ -4,7 +4,7 @@ require("viewfunctions")
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
#content table td { white-space: nowrap; padding-right:20px; border-bottom:1px solid #999; }
#content table td { white-space: normal; padding-right:20px; border-bottom:1px solid #999; }
#content table tr.mark { background: #E9E9E9; }
</style>
......
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
<%
local order = {"auditstart", "auditend", "historydays", "watchdays", "purgedays", "window", "shorturi", "shortreason", "groupby"}
displayform(form, order, nil, page_info)
local order = {"auditstart", "auditend", "badyesno", "sortby", "minimumscore", "window", "shorturi", "shortreason", "historydays", "watchdays", "purgedays" }
displayform(form, order, nil, page_info)
%>
......@@ -50,37 +50,63 @@ function deletewatchlistentry(self)
end
function viewweblog(self)
return self.model.getweblog(self.clientdata.clientuserid, self.clientdata.starttime, self.clientdata.endtime, self.clientdata.clientip, clientdata.focus)
return self.model.getweblog(self.clientdata.activelog, self.clientdata.clientuserid, self.clientdata.starttime, self.clientdata.endtime, self.clientdata.clientip, self.clientdata.badyesno, self.clientdata.deniedyesno, self.clientdata.bypassyesno, self.clientdata.score, self.clientdata.urisearch, self.clientdata.sortby, self.clientdata.selected, clientdata.focus)
end
function downloadweblog(self)
self.conf.viewtype = "stream"
local retval = viewweblog(self)
local file = cfe({ type="longtext", value="", label=retval.value.clientuserid.value .. ".log" })
local content = {"sourcename\tclientip\tclientuserid\tlogdatetime\turi\tbytes\treason\tscore"}
local file = cfe({ type="longtext", value="", label=retval.value.clientuserid.value .. ".csv" })
local content = {"clientuserid,clientip,logdatetime,uri,bytes,reason,score,reason,badyesno,deniedyesno,bypassyesno"}
for i,log in ipairs(retval.value.log.value) do
content[#content+1] = string.format("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t",
log.sourcename, log.clientip, log.clientuserid, log.logdatetime,
log.uri, log.bytes, log.reason or "", log.score or "0")
content[#content+1] = string.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,",
log.clientuserid, log.clientip, log.logdatetime, log.uri, log.bytes, log.reason, log.score or "0", log.reason, log.badyesno, log.deniedyesno, log.bypassyesno )
end
file.value = table.concat(content, "\n")
return file
end
function viewblocklog(self)
return self.model.getblocklog(self.clientdata.clientuserid, self.clientdata.starttime, self.clientdata.endtime, self.clientdata.clientip, clientdata.focus)
function downloadlogview(self)
thisdate=os.date()
self.conf.viewtype = "stream"
local retval = viewweblog(self)
local file = cfe({ type="longtext", value="", label="Weblog-resnet-"..thisdate..".tab" })
local content = {"clientuserid\tclientip\tlogdatetime\turi\tbytes\treason\tscore\treason\tbadyesno\tdeniedyesno\tbypassyesno"}
for i,log in ipairs(retval.value.log.value) do
content[#content+1] = string.format("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t",
log.clientuserid, log.clientip, log.logdatetime, log.uri, log.bytes, log.reason, log.score or "0", log.reason, log.badyesno, log.deniedyesno, log.bypassyesno )
end
file.value = table.concat(content, "\n")
return file
end
function viewusagestats(self)
return self.model.getusagestats()
function downloadselected(self)
thisdate=os.date()
self.conf.viewtype = "stream"
local retval = viewselected(self)
local file = cfe({ type="longtext", value="", label="Weblog-resnet-selected-"..thisdate..".tab" })
local content = {"clientuserid\tclientip\tlogdatetime\turi\tbytes\treason\tscore\treason\tbadyesno\tdeniedyesno\tbypassyesno"}
for i,log in ipairs(retval.value.log.value) do
content[#content+1] = string.format("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t",
log.clientuserid, log.clientip, log.logdatetime, log.uri, log.bytes, log.reason, log.score or "0", log.reason, log.badyesno, log.deniedyesno, log.bypassyesno )
end
file.value = table.concat(content, "\n")
return file
end
function viewauditstats(self)
return self.model.getauditstats()
function checkselected(self)
self.conf.viewtype = "silent"
return self.model.editselected(self.clientdata.chkdata)
--return file
end
function clearselected(self)
return self:redirect_to_referrer(self.model.clearselected())
end
function completeaudit(self)
return self:redirect_to_referrer(self.model.completeaudit(self.clientdata.auditend))
function viewselected(self)
--return self.model.getselected(self.clientdata.csvdata, self.clientdata.starttime, self.clientdata.endtime)
return self.model.getweblog(self.clientdata.activelog, self.clientdata.clientuserid, self.clientdata.starttime, self.clientdata.endtime, self.clientdata.clientip, self.clientdata.badyesno, self.clientdata.deniedyesno, self.clientdata.bypassyesno, self.clientdata.score, self.clientdata.urisearch, self.clientdata.sortby, self.clientdata.getselected, clientdata.focus)
end
function adhocquery(self)
......@@ -120,3 +146,18 @@ end
function createdatabase(self)
return controllerfunctions.handle_form(self, self.model.getnewdatabase, self.model.create_database, self.clientdata, "Create", "Create New Database", "Database Created")
end
function listfiles(self)
return self.model.listfiles(self)
end
function createfile(self)
return controllerfunctions.handle_form(self, self.model.getnewfile, self.model.createfile, self.clientdata, "Create", "Create New Weblog File", "Weblog File Created")
end
function editfile(self)
return controllerfunctions.handle_form(self, function() return self.model.readfile(self.clientdata.filename) end, self.model.updatefile, self.clientdata, "Save", "Edit Weblog File", "Weblog File Saved" )
end
function deletefile(self)
return self:redirect_to_referrer(self.model.deletefile(self.clientdata.filename))
end
../filedetails-html.lsp
\ No newline at end of file
<% local view, viewlibrary, page_info, session = ...
require("viewfunctions")
%>
<% displaycommandresults({"editfile", "deletefile", "startstop"}, session) %>
<% displaycommandresults({"createfile"}, session, true) %>
<H1>File List</H1>
<DL>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD>
<TD style="white-space:nowrap;text-align:left;" class="header">File</TD>
</TR>
<% for i,file in ipairs(view.value) do %>
<TR>
<TD style="padding-right:20px;white-space:nowrap;">
<% if viewlibrary.check_permission("editfile") then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editfile?filename="..file.."&redir="..page_info.orig_action, label="Edit "} %>
<% end %>
<% if viewlibrary.check_permission("deletefile") then %>
<%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletefile?filename="..file, label="Delete "} %>
<% end %>
</TD>
<TD style="white-space:nowrap;"><%= html.html_escape(file) %></TD>
</TR>
<% end %>
</TABLE>
</DL>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createfile") then
local createform = viewlibrary.dispatch_component("createfile", nil, true) %>
<H2><%= html.html_escape(createform.label) %></H2>
<%
createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createfile"
displayform(createform)
end %>
<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("startstop") then
viewlibrary.dispatch_component("startstop")
end %>
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
%>
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
#content table td { white-space: normal; padding-right:20px; border-bottom:1px solid #999; }
#content table tr.mark { background: #E9E9E9; }
</style>
<H1>Maintenance</H1>
<% displayformstart(form, page_info) %>
<% displayformitem(form.value.query, "query") %>
<% displayformend(form) %>
<H2>Purge Database Operations</H2>
<H3>Analysis Operations</H3>
<H4>Actions</H4>
This diff is collapsed.
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
%>
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
#content table td { white-space: normal; padding-right:20px; border-bottom:1px solid #999; }
#content table tr.mark { background: #E9E9E9; }
</style>
<H1>Summary</H1>
<H2>Last 24 Hours</H2>
<H2>Last 7 Days</H2>
<H2>Last 30 Days</
<% displayformstart(form, page_info) %>
<% displayformitem(form.value.query, "query") %>
<% displayformend(form) %>
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#audit").tablesorter({headers: {1:{sorter:'digit'}, 2:{sorter:'digit'}}});
});
</script>
<% displaycommandresults({"completeaudit"}, session) %>
<H1>Audit Parameters</H1>
<DL>
<% displayitem(data.value.auditstart) %>
<% displayitem(data.value.auditend) %>
</DL>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<TABLE id="audit" class="tablesorter"><THEAD>
<TR style="font-weight:bold;">
<TH><% if data.value.groupby.value == "clientip" then %>Client IP<% else %>User ID<% end %></TH>
<TH>Blocks</TH>
<TH>Maximum Score</TH>
</TR>
</THEAD><TBODY>
<% for i,stat in ipairs(data.value.stats.value) do %>
<TR><TD><%= html.link{value = "viewblocklog?"..data.value.groupby.value.."="..stat[data.value.groupby.value], label=stat[data.value.groupby.value]} %></TD>
<TD><%= html.html_escape(stat.numblock) %></TD>
<TD><%= html.html_escape(stat.maxscore) %></TD></TR>
<% end %>
</TBODY></TABLE>
<% if data.errtxt then %>
<p class='error'><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value.stats.value == 0 then %>
<p>No blocks, try adjusting the audit dates</p>
<% end %>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/completeaudit") %>">
<DT>Complete Audit</DT>
<DD><input class="submit" type="submit" value="Complete"></DD>
</form>
</DL>
<% local data, viewlibrary, page_info, session = ... %>
<% if data.value.focus.value ~= "" then %>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
if ($("#focus").length) {
var top = $("#focus").offset().top;
$("html,body").scrollTop(top);
}
});
</script>
<% end %>
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
#content table td { border-bottom: none; white-space: nowrap; padding-right:20px; }
#content table tr.mark { background: #E9E9E9; }
#content table tr.markfocus { background: #E9E966; }
#content table tr.focus { background: #E9E900; }
#content table tr.bypass { background: #eaa; }
#content table td.reason { color: #000; padding-left: 20px; border-bottom:1px solid #999; }
</style>
<H1>Search Parameters</H1>
<DL>
<% if data.errtxt then %><p class="error"><%= html.html_escape(data.errtxt) %></p><% end %>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST">
<DT>Start Time</DT>
<DD><input class="text" type="text" name="starttime" value="<%= html.html_escape(data.value.starttime.value) %>" >
<p><%= html.html_escape(data.value.starttime.value) %></p>
<% if data.value.starttime.errtxt then %><p class="error"><%= html.html_escape(data.value.starttime.errtxt) %></p><% end %>
</DD>
<DT>User ID</DT>
<DD><input class="text" type="text" name="clientuserid" value="<%= html.html_escape(data.value.clientuserid.value) %>" >
<p><%= html.html_escape(data.value.clientuserid.value) %></p>
<% if data.value.clientuserid.errtxt then %><p class="error"><%= html.html_escape(data.value.clientuserid.errtxt) %></p><% end %>
</DD>
<DT>Client IP</DT>
<DD><input class="text" type="text" name="clientip" value="<%= html.html_escape(data.value.clientip.value) %>" >
<p><%= html.html_escape(data.value.clientip.value) %></p>
<% if data.value.clientip.errtxt then %><p class="error"><%= html.html_escape(data.value.clientip.errtxt) %></p><% end %>
</DD>
<DT>End Time</DT>
<DD><input class="text" type="text" name="endtime" value="<%= html.html_escape(data.value.endtime.value) %>" >
<p><%= html.html_escape(data.value.endtime.value) %></p>
<% if data.value.endtime.errtxt then %><p class="error"><%= html.html_escape(data.value.endtime.errtxt) %></p><% end %>
</DD>
<DT></DT><DD><input class="submit" type="submit" name="Update" value="Update"></DD>
</FORM>
</DL>
<%
local clientinfo = ""
if data.value.clientuserid.value ~= "" then
clientinfo = clientinfo .. "clientuserid="..data.value.clientuserid.value.."&"
end
if data.value.clientip.value ~= "" then
clientinfo = clientinfo .. "clientip="..data.value.clientip.value.."&"
end
%>
<H1><%= html.html_escape(data.label) %></H1>
<DL><TABLE>
<TR class="header">
<TD class="header">Timestamp</TD>
<TD class="header">Client IP</TD>
<TD class="header">User ID</TD>
<TD class="header">Size</TD>
<TD WIDTH="90%" class="header">URL</TD>
</TR>
<% for i,watch in ipairs(data.value.log.value) do %>
<% local a,b = math.modf((i/2))
local mark = ''
if (b == 0) then mark=mark..'class="mark"' end
if string.find(watch.uri, "GBYPASS=") then mark='class="bypass"' end
%>
<% local time = {}
time.year, time.month, time.day, time.hour, time.min, time.sec =
string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)")
time = os.time(time) %>
<TR <%= mark %>>
<TD <% if data.value.focus.value == watch.logdatetime then %> style="font-weight:bold;" id="focus" <% end %> ><%= html.link{value = "viewweblog?"..clientinfo..
"starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value)))..
"&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value)))..
"&focus="..watch.logdatetime,
label=watch.logdatetime} %></TD>
<TD <% if data.value.clientip.value == watch.clientip then %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientip) %></TD>
<TD <% if data.value.clientuserid.value == watch.clientuserid then %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientuserid) %></TD>
<TD><%= html.html_escape(watch.bytes) %></TD>
<TD title="<%= html.html_escape(watch.uri) %>" >
<%= html.link{value = watch.uri, label=watch.shorturi or watch.uri} %></TD>
</TR>
<TR <%= mark %>>
<TD class='reason' <% if (watch.shortreason and watch.shortreason ~= "") or (watch.reason and watch.reason ~= "") then %>
title="<%= html.html_escape(watch.reason) %>"<% end %> colspan=5>
<% if watch.score and watch.score ~= "0" then %><%= html.html_escape(watch.score) %> - <% end %>
<% if (watch.shortreason and watch.shortreason ~= "") then %>
<%= html.html_escape(watch.shortreason) %>
<% elseif (watch.reason and watch.reason ~= "") then %>
<%= html.html_escape(watch.reason) %>
<% end %>
</TD></TR>
<% end %>
</TABLE>
<% if data.errtxt then %>
<p class="error"><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value.log.value == 0 then %>
<p>No results, try adjusting search parameters</p>
<% end %>
<% if page_info.action == "viewweblog" then %>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/downloadweblog") %>" method="POST">
<input type="hidden" name="starttime" value="<%= html.html_escape(data.value.starttime.value) %>" >
<input type="hidden" name="clientuserid" value="<%= html.html_escape(data.value.clientuserid.value) %>" >
<input type="hidden" name="clientip" value="<%= html.html_escape(data.value.clientip.value) %>" >
<input type="hidden" name="endtime" value="<%= html.html_escape(data.value.endtime.value) %>" >
<DT>Download log</DT><DD><input class="submit" type="submit" name="Download" value="Download"></DD>
</FORM>
<% end %>
</DL>
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<% local subdata, pagedata = paginate(data.value, page_info.clientdata, 100) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<% displaypagination(pagedata, page_info) %>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;" class="header">Date</TD>
<TD style="padding-right:20px;white-space:nowrap;" class="header">Source</TD>
<TD style="padding-right:20px;white-space:nowrap;" class="header">Requests</TD>
<TD style="white-space:nowrap;" WIDTH="90%" class="header">Blocks</TD>
</TR>
<% for i,stat in ipairs(subdata) do %>
<TR>
<TD><%= html.html_escape(stat.date) %></TD>
<TD><%= html.html_escape(stat.sourcename) %></TD>
<TD><%= html.html_escape(stat.numrequest) %></TD>
<TD><%= html.html_escape(stat.numblock) %></TD>
</TR>
<% end %>
</TABLE>
<% if data.errtxt then %>
<p class='error'><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value == 0 then %>
<p>No usage stats found</p>
<% end %>
</DL>
......@@ -24,7 +24,7 @@
<% for i,watch in ipairs(data.value) do %>
<TR>
<TD><%= html.link{value = "deletewatchlistentry?clientuserid="..watch.clientuserid, label="Delete "} %></TD>
<TD><%= html.link{value = "viewblocklog?clientuserid="..watch.clientuserid, label=watch.clientuserid} %></TD>
<TD><%= html.link{value = "viewweblog?clientuserid="..watch.clientuserid, label=watch.clientuserid} %></TD>
<TD><%= html.html_escape(watch.expiredatetime) %></TD>
</TR>
<% end %>
......
weblog-viewblocklog-html.lsp
\ No newline at end of file
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions")%>
<% require("weblogviewfunctions")%>
<% if data.value.focus.value ~= "" then %>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
if ($("#focus").length) {
var top = $("#focus").offset().top;
$("html,body").scrollTop(top);
}
});
</script>
<% end %>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix)%>/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#loglist").tablesorter({headers: {0:{sorter: false},1:{sorter: false}, 2:{sorter: 'text'}, 6:{sorter: false}, 7:{sorter: false}, 8:{sorter: false}}});
});
function hideColumn(myCol) {
myCol.style.display = "none";
};
</script>
<% local subdata, pagedata = paginate(data.value.log.value, page_info.clientdata, 200) %>
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
#content table td { border-bottom: none; white-space: normal; padding-right:20px; }
#content table th { border-bottom: none; white-space: normal; vertical-align: middle; padding-right:15px }
#content table tr.mark { background: #E9E9E9; }
#content table tr.selected { background: #FC9A01; }
</style>
<H1>Search Parameters</H1>
<DL>
<% if data.errtxt then %><p class="error"><%= html.html_escape(data.errtxt) %></p><% end %>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST">
<DT>Active Weblog</DT>
<DD><select name="activelog">
<option value="pubweblog">Current</option>
<option value="pubweblog_history"<% if data.value.activelog.value == "pubweblog_history" then %> selected="selected" <% end %> >History</option>
</select>
</DD>
<DT>Start Time</DT>
<DD><input class="text" type="text" name="starttime" value="<%= html.html_escape(data.value.starttime.value) %>" >
<p><%= html.html_escape(data.value.starttime.value) %></p>
<% if data.value.starttime.errtxt then %><p class="error"><%= html.html_escape(data.value.starttime.errtxt) %></p><% end %>
</DD>
<DT>User ID</DT>
<DD><input class="text" type="text" name="clientuserid" value="<%= html.html_escape(data.value.clientuserid.value) %>" >
<p><%= html.html_escape(data.value.clientuserid.value) %></p>
<% if data.value.clientuserid.errtxt then %><p class="error"><%= html.html_escape(data.value.clientuserid.errtxt) %></p><% end %>
</DD>
<DT>Client IP</DT>
<DD><input class="text" type="text" name="clientip" value="<%= html.html_escape(data.value.clientip.value) %>" >
<p><%= html.html_escape(data.value.clientip.value) %></p>
<% if data.value.clientip.errtxt then %><p class="error"><%= html.html_escape(data.value.clientip.errtxt) %></p><% end %>
</DD>
<DT>End Time</DT>
<DD><input class="text" type="text" name="endtime" value="<%= html.html_escape(data.value.endtime.value) %>" >
<p><%= html.html_escape(data.value.endtime.value) %></p>
<% if data.value.endtime.errtxt then %><p class="error"><%= html.html_escape(data.value.endtime.errtxt) %></p><% end %>
</DD>
<DT>URI Contains</DT>
<DD><input class="text" type="text" name="urisearch" value="<%= html.html_escape(data.value.urisearch.value) %>" >
<P CLASS="descr">Retrieve records where the URI contains this word</P>
<p><%= html.html_escape(data.value.urisearch.value) %></p>
<% if data.value.urisearch.errtxt then %><p class="error"><%= html.html_escape(data.value.urisearch.errtxt) %></p><% end %>
</DD>
<DT>Minimum Score</DT>
<DD><input class="text" type="text" name="score" value="<%= html.html_escape(data.value.score.value) %>" >
<P CLASS="descr">Minimum score to search on</P>
<% if data.value.score.errtxt then %><p class="error"><%= html.html_escape(data.value.score.errtxt) %></p><% end %>
</DD>
<DT>Sort By</DT>
<DD><select name="sortby">
<option value="logdatetime"<% if data.value.log.value == "sortby" then %> selected="selected" <% end %> >Timestamp</option>
<option value="logdatetime DESC"<% if data.value.sortby.value == "logdatetime DESC" then %> selected="selected" <% end %> >Timestamp DESC</option>
<option value="clientuserid"<% if data.value.sortby.value == "clientuserid" then %> selected="selected" <% end %> >User ID</option>
<option value="clientuserid DESC"<% if data.value.sortby.value == "clientuserid DESC" then %> selected="selected" <% end %> >User ID DESC</option>
<option value="bytes"<% if data.value.sortby.value == "bytes" then %> selected="selected" <% end %> >Size</option>
<option value="bytes DESC"<% if data.value.sortby.value == "bytes DESC" then %> selected="selected" <% end %> >Size DESC</option>
<option value="score"<% if data.value.sortby.value == "score" then %> selected="selected" <% end %> >Score</option>
<option value="score DESC"<% if data.value.sortby.value == "score DESC" then %> selected="selected" <% end %> >Score DESC</option>
<option value="reason"<% if data.value.sortby.value == "reason" then %> selected="selected" <% end %> >Reason</option>
<option value="reason DESC"<% if data.value.sortby.value == "reason DESC" then %> selected="selected" <% end %> >Reason DESC</option>
</select>
</DD>
<DT>Show Suspect Records</DT>
<DD>
<input class="checkbox" type="checkbox" name="badyesno" value="1" <% if data.value.badyesno.value == "1" then %> checked <% end %>>
<P CLASS="descr">Show only URIs containing flagged words</P>
<% if data.value.badyesno.errtxt then %><p class="error"><%= html.html_escape(data.value.badyesno.errtxt) %></p><% end %>
</DD>
<DT>Show Denied URIs</DT>
<DD>
<input class="checkbox" type="checkbox" name="deniedyesno" value="1" <% if data.value.deniedyesno.value == "1" then %>checked<% end %>>
<% if data.value.deniedyesno.errtxt then %><p class="error"><%= html.html_escape(data.value.deniedyesno.errtxt) %></p><% end %>
<P CLASS="descr">Show only Denied URIs</P>
</DD>
<DT>Show Bypass Attempts</DT>
<DD>
<input class="checkbox" type="checkbox" name="bypassyesno" value="1" <% if data.value.bypassyesno.value == "1" then %>checked <% end %>>
<% if data.value.bypassyesno.errtxt then %><p class="error"><%= html.html_escape(data.value.bypassyesno.errtxt) %></p><% end %>
<P CLASS="descr">Show only Bypass attempts</P>
</DD>
<DT>Show Selected Records</DT>
<DD>
<input class="checkbox" type="checkbox" name="selected" value="true" <% if data.value.selected.value == "true" then %>checked <% end %>>
<% if data.value.selected.errtxt then %><p class="error"><%= html.html_escape(data.value.selected.errtxt) %></p><% end %>
<P CLASS="descr">Show only records that have been selected</P>
</DD>
<DT></DT><DD><input class="submit" type="submit" name="Update" value="Update"></DD>
</FORM>
</DL>
<%
local clientinfo = ""
if data.value.clientuserid.value ~= "" then
clientinfo = clientinfo .. "clientuserid="..data.value.clientuserid.value.."&"
end
if data.value.clientip.value ~= "" then
clientinfo = clientinfo .. "clientip="..data.value.clientip.value.."&"
end
%>
<% displaypagination(pagedata, page_info) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<TABLE id="loglist" class="tablesorter">
<THEAD>
<TR style=font-weight:bold;>
<TH><input type="checkbox" id="chkHead" /></TH>
<TH style="width:0%; display:none"></TH>
<TH>Timestamp</TH>
<TH>Client IP</TH>
<TH>User ID</TH>
<TH>Size</TH>
<TH style=font-weight:bold >Sus</TH>
<TH style=font-weight:bold >Den</TH>
<TH style=font-weight:bold >Byp</TH>
<TH>Score</TH>
<TH>Reason</TH>
<TH WIDTH="90%">URL</TH>
<TH>Bad Words</TH>
</TR>
</THEAD>
<TBODY>
<FORM action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/checkselected") %>" name="markselected" onsubmit="return false" method="POST">
<input type="hidden" id="chkdata" name="chkdata" value="chkdata"></FORM>
<% for i,watch in ipairs(subdata) do
local a,b = math.modf((i/2))
local mark = ''
if (b == 0) and watch.selected ~= "t" then mark=' class="mark"' end
if watch.selected == "t" then mark=' class="selected"' end
local time = {}
time.year, time.month, time.day, time.hour, time.min, time.sec =
string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)")
time = os.time(time) %>
<TR<%= mark %>>
<TD><input class="chktbl" type="checkbox" value="true" <% if watch.selected == "t" then %> checked <% end %>></TD>
<TD style="width:0%; display:none"><%= html.html_escape(watch.id) %></TD>
<TD <% if data.value.focus.value == watch.logdatetime then %> style="font-weight:bold;" id="focus" <% end %> ><%= html.link{value = "viewweblog?"..clientinfo..
"starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value)))..
"&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value)))..
"&focus="..watch.logdatetime,
label=watch.logdatetime} %></TD>
<TD <% if data.value.clientip.value == watch.clientip then %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientip) %></TD>
<TD <% if data.value.clientuserid.value == watch.clientuserid then %> style="font-weight:bold;" <% end %> ><%= html.html_escape(watch.clientuserid) %></TD>
<TD><%= html.html_escape(watch.bytes) %></TD>
<TD WIDTH="2%"><% if watch.badyesno == "1" then %><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/dodgy.gif' width='13' height='13'><% end %></TD>
<TD WIDTH="2%"><% if watch.deniedyesno ~= "0" then %> <IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/denied.gif' width='13' height='13'><% end %></TD>
<TD WIDTH="2%"><% if watch.bypassyesno ~= "0" then %> <IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/bypass.gif' width='13' height='13'><% end %></TD>
<TD><%= html.html_escape(watch.score) %></TD>
<TD><%= html.html_escape(watch.reason) %></TD>
<TD style="word-wrap: break-word" width="500"><% highlight_uri=html.html_escape(watch.uri)
if watch.wordloc ~= nil then
if string.find(watch.wordloc,"|") then
badwords = split(watch.wordloc,"|")
for key,wrd in pairs(badwords) do
highlight_uri = string.highlight(highlight_uri, wrd, "yellow","red")
end
else
highlight_uri = string.highlight(highlight_uri, watch.wordloc, "yellow","red")
end
end %>
<%= highlight_uri %></TD>
<TD><%= watch.wordloc %></TD>
</TR>
<% end %>
</TBODY>
</TABLE>
<% displaypagination(pagedata, page_info) %>
<% if data.errtxt then %>
<p class="error"><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value.log.value == 0 then %>
<p>No results, try adjusting search parameters</p>