Exemplo n.º 1
0
    "size": 40077,
    "result": 0,
    "subject": "Heloworld",
    "Eval":
    "BAYES_99;BM_PASS;CMD_CNT_00_10;CUR_CONN_00_01;DKIM_SUCCESS;DMARC_NON_ALIGNED;DOMAIN_QUARTER_CNT_20_40;DOMAIN_QUARTER_RCPT_CNT_10_50;DOMAIN_TODAY_CNT_1K_XX;DOMAIN_TODAY_RCPT_CNT_1K_XX;FP___MIME_BASE64_MIME_BASE64_NO_NAME_PTR_YES;GET_ERROR_HEADER_FIELD;HTML_BADTAG_00_10;HTML_HAS_COMMENT;HTML_MAX_CONJOINT_IMG_TAG_CNT_08;HTML_NONELEMENT_00_10;HTML_SET_STYLE;HTML_TAG_ATTRIBUTE_COLOR_BAD;HTML_TAG_EXIST_TBODY;HTML_TEXT_DISPLAY_NONE;HTML_TOTAL_IMG_TAG_CNT_32;IP_QUARTER_CNT_04_08;IP_TODAY_CNT_1K_2K;JPG_SVM_PROB_00_10;MIME_BASE64_NO_NAME;MIME_BASE64_TEXT;MIME_HTML_ONLY;NO_PLAIN_CONTENT_TYPE;PTR_YES;RCVD_IN_SORBS_SPAM;REGION_US_23;REPUTATION_NULL;RUSER_QUARTER_CNT_20_40;RUSER_QUARTER_RCPT_CNT_10_50;RUSER_TODAY_CNT_1K_XX;RUSER_TODAY_RCPT_CNT_1K_XX;SENDERREP_NULL;SPF_PASS;STEXT_SVM_PROB_00_10;SUBJECT_CNT_3000_XXXX;TEXT_HTML_CNT_01_03;TEXT_PLAIN_CNT_00_01;TOTAL_DISPLAY_NONE_TAG_CNT_01_03;TO_CC_BCC_CNT_00_02;URLREP_NULL;USER_SEND_INTERVAL_10_60;__MIME_BASE64",
    "Score": 12.59,
    "ip": "223.252.214.175",
    "optime": 1344,
    "destip": "183.57.48.35",
    "bindip": "106.2.96.53",
    "desc": "250 OK"
}
g_Scalesize = 0
g_GetInESTimestamp = ""
g_esconfig = ESconfig()
g_logobj = getlogInst()  # 日志对象


#g_logobj.setlevel(0)
def SetScaleSize(size):
    global g_esconfig
    #esconfig = ESconfig()
    g_esconfig.setsize(size)


def CreateIndex(index):
    try:
        iret = es.indices.create(index=index, ignore=400)
    except:
        pass
Exemplo n.º 2
0
#-*-coding:utf8 -*-
'''
    缓存配置,缓存服务挂掉时,程序里的数据,以及elasticsearch的搜索点
'''
import ConfigParser
import os
import pdb
import json
from Clogdata import Clogdata
from EShelplog import getlogInst
import os

g_loginst = getlogInst()
cf = ConfigParser.ConfigParser()
cf.read('config/ess.conf')


class ESconfig:
    def __init__(self):
        global cf
        secs = cf.sections()
        self.Scalesize = 0

    def setsize(self, size):
        self.Scalesize = size
        ret = cf.set("elasticsearchpara", "scalsize", size)
        with open("config/ess.conf", "w+") as f:
            cf.write(f)

    def getsize(self):
        temp = cf.get("elasticsearchpara", "scalsize")
Exemplo n.º 3
0
#!/usr/bin/python
#-*- coding:utf-8 -*-
import urllib2
import re
#import chardet
import codecs
from dbmange import Mysql
import pdb
from EShelplog import getlogInst
g_logisnt=getlogInst()

# CHN country mapping
CHN_CITY = {
    "河北":0,"山西":1,"辽宁":2,"吉林":3,"黑龙江":4,"江苏":5,"浙江":6,"安徽":7,"福建":8,"江西":9,"山东":10,"河南":11,
    "湖北":12,"湖南":13,"广东":14,"海南":15,"四川":16,"贵州":17,"云南":18,"陕西":19,"甘肃":20,"青海":21,"台湾":22,
    "北京":23,"天津":24,"上海":25,"重庆":26,
    "广西壮族":27,"内蒙古":28,"西藏":29,"宁夏回族":30,"新疆维吾尔":31,
    "香港":32,"澳门":33
}
def initIpMapping(mysqlinst):
    sqlstr="create table if not exists ipmappings (ipDomain varchar(255) not NULL primary key, ipcountry varchar(255) not NULL, des varchar(255) not NULL) DEFAULT CHARSET=utf8;"
    iret=1
    pdb.set_trace()
    try:
        iret = mysqlinst.insertOne(sqlstr)
        str1="insert into ipmappings (ipDomain,ipcountry,des) values ('8.8.8.8', '美国', '这是一个美国的免费的DNS服务器的地址')"
        str2="insert into ipmappings (ipDomain,ipcountry,des) values ('127.0.0.1', '本地地址', '这是本机器的回环网络地址,常做测试使用')"
        str3 = "insert into ipmappings (ipDomain,ipcountry,des) values ('0.0.0.0','Error','这是IP地址的中的保留地址,常作为源地址')"
        str4 = "insert into ipmappings (ipDomain,ipcountry,des) values ('255.255.255.255','广播地址','这是广播地址,不参与通信')"
        iret = mysqlinst.insertOne(str1)
        iret = mysqlinst.insertOne(str2)