Author: pirogue Purpose: 折线图和饼图 Site: http://pirogue.org Created: 2018-08-27 18:29:06 """ from dbs.dal.LogOperate import LogOp import datetime import sys if sys.version[0] == '2': reload(sys) sys.setdefaultencoding("utf-8") else: from importlib import reload nums = LogOp() # sourceDataz = [ # { "month": 'Jan', "attack": 0, "white": 0 }, # { "month": 'Feb', "attack": 0, "white": 0 }, # { "month": 'Mar', "attack": 0, "white": 0 }, # { "month": 'Apr', "attack": 0, "white": 0 }, # { "month": 'May', "attack": 0, "white": 0 }, # { "month": 'Jun', "attack": 0, "white": 0 }, # { "month": 'Jul', "attack": 0, "white": 0 }, # { "month": 'Aug', "attack": 0, "white": 0 }, # { "month": 'Sep', "attack": 0, "white": 0 }, # { "month": 'Oct', "attack": 0, "white": 0 }, # { "month": 'Nov', "attack": 0, "white": 0 }, # { "month": 'Dec', "attack": 0, "white": 0 }, # ]
Author: pirogue Purpose: 解析客户端请求过来的日志 Site: http://pirogue.org Created: 2018-08-03 18:00:23 """ from dbs.dal.LogOperate import LogOp from service.emailservice import send_mail, switches from service.whiteipservice import whiteips from service.whiteportservice import whiteports from util.task import sched from datetime import datetime import datetime as datetimes import uuid loginst = LogOp() def parserlog(jsonlog): # 接收客户端post过来的数据格式化 if jsonlog: if jsonlog.has_key("dst_host"): dst_host = jsonlog["dst_host"] # print type(dst_host) else: dst_host = '' if jsonlog.has_key("dst_port"): dst_port = jsonlog["dst_port"] else: dst_port = 0
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Author: pirogue Purpose: 日志列表展示 Site: http://pirogue.org Created: 2018-08-06 17:25:24 """ from dbs.dal.LogOperate import LogOp import sys reload(sys) sys.setdefaultencoding('utf8') logselect = LogOp() def listpage(param): if param.has_key("white") and param.has_key("page"): page = param["page"] # print page page_list = [] second_page_list = [] for i in logselect.page_select_white(page): dict_param = {"id":i.id,"dst_host":i.dst_host,"dst_port":i.dst_port,"honeycred":i.honeycred,"local_time":i.local_time.strftime("%Y-%m-%d %H:%M:%S"),"hostname":i.hostname,\ "password":i.password,"path":i.path,"skin":i.skin,"useragent":i.useragent,"username":i.username,"session":i.session,"localversion":i.localversion,\ "remoteversion":i.remoteversion,"df":i.df,"idid":i.idid,"inin":i.inin,"lenlen":i.lenlen,"mac":i.mac,"outout":i.outout,"prec":i.prec,\ "proto":i.proto,"res":i.res,"syn":i.syn,"tos":i.tos,"ttl":i.ttl,"urgp":i.urgp,"window":i.window,"logtype":i.logtype,\ "node_id":i.node_id,"src_host":i.src_host,"src_port":i.src_port} page_list.append(dict_param)