网站统计 - 特殊处理

pull/581/head
Mr Chen 12 months ago
parent c70e4d1412
commit c874ea44eb
  1. 5
      class/core/db.py
  2. 16
      plugins/webstats/index.py
  3. 21
      plugins/webstats/js/stats.js
  4. 16
      plugins/webstats/webstats_index.py

@ -42,8 +42,13 @@ class Sql():
self.__DB_CONN = sqlite3.connect(self.__DB_FILE)
self.__DB_CONN.text_factory = str
except Exception as ex:
# print(mw.getTracebackInfo())
return "error: " + str(ex)
def changeTextFactoryToBytes(self):
self.__DB_CONN.text_factory = bytes
return True
def autoTextFactory(self):
if sys.version_info[0] == 3:
self.__DB_CONN.text_factory = lambda x: str(

@ -791,7 +791,23 @@ def getLogsList():
attacHistoryLogHack(conn, domain, query_date)
conn.changeTextFactoryToBytes()
clist = conn.limit(limit).order('time desc').inquiry()
for x in range(len(clist)):
req_line = clist[x]
for cx in req_line:
v = req_line[cx]
if type(v) == bytes:
try:
clist[x][cx] = v.decode('utf-8')
except Exception as e:
v = str(v)
v = v.replace("b'",'').strip("'")
clist[x][cx] = v
else:
clist[x][cx] = v
# print(clist)
count_key = "count(*) as num"
count = conn.field(count_key).limit('').order('').inquiry()

@ -2257,11 +2257,13 @@ function wsTableLogRequest(page){
}
$('#logs_search').attr('req','start');
// wsPost('get_logs_list', '' ,args, function(rdata){
wsPostCallbak('get_logs_list', '' ,args, function(rdata){
$('#logs_search').attr('req','end');
var rdata = $.parseJSON(rdata.data);
var list = '';
var data = rdata.data.data;
console.log(data);
if (data.length > 0){
for(i in data){
@ -2346,20 +2348,23 @@ function wsTableLogRequest(page){
var index = $(this).attr('data-id');
var res = data[index];
var request_headers = res.request_headers;
var req_data = $.parseJSON(request_headers);
var req_data_html = res.method +' ' + res.uri + '<br/>';
for (var d in req_data) {
if (d == 'payload'){
req_data_html += '<b style="color:red;">'+d +"</b>:"+req_data[d]+"<br/>";
} else{
req_data_html += d+":"+req_data[d]+"<br/>";
try {
var req_data = $.parseJSON(request_headers);
for (var d in req_data) {
if (d == 'payload'){
req_data_html += '<b style="color:red;">'+d +"</b>:"+req_data[d]+"<br/>";
} else{
req_data_html += d+":"+req_data[d]+"<br/>";
}
}
} catch (error) {
req_data_html += request_headers;
}
layer.open({
type: 1,
title: "【"+res.domain + "】HTTP详情",

@ -791,8 +791,22 @@ def get_logs_list(args):
attacHistoryLogHack(conn, domain, query_date)
conn.changeTextFactoryToBytes()
clist = conn.limit(limit).order('time desc').inquiry()
# print(clist)
for x in range(len(clist)):
req_line = clist[x]
for cx in req_line:
v = req_line[cx]
if type(v) == bytes:
try:
clist[x][cx] = v.decode('utf-8')
except Exception as e:
v = str(v)
v = v.replace("b'",'').strip("'")
clist[x][cx] = v
else:
clist[x][cx] = v
count_key = "count(*) as num"
count = conn.field(count_key).limit('').order('').inquiry()
# print(count)

Loading…
Cancel
Save