xbase-util 0.1.2__tar.gz → 0.1.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {xbase_util-0.1.2 → xbase_util-0.1.4}/PKG-INFO +1 -1
- {xbase_util-0.1.2 → xbase_util-0.1.4}/setup.py +1 -1
- xbase_util-0.1.4/xbase_util/db/__init__.py +0 -0
- xbase_util-0.1.4/xbase_util/db/bean/ConfigBean.py +103 -0
- xbase_util-0.1.4/xbase_util/db/bean/CurrentConfigBean.py +10 -0
- xbase_util-0.1.4/xbase_util/db/bean/FlowBean.py +10 -0
- xbase_util-0.1.4/xbase_util/db/bean/TaskTemplateBean.py +28 -0
- xbase_util-0.1.4/xbase_util/db/bean/__init__.py +3 -0
- xbase_util-0.1.4/xbase_util/db/dao/ConfigDao.py +172 -0
- xbase_util-0.1.4/xbase_util/db/dao/CurrentConfigDao.py +24 -0
- xbase_util-0.1.4/xbase_util/db/dao/FlowDao.py +59 -0
- xbase_util-0.1.4/xbase_util/db/dao/TaskTemplateDao.py +57 -0
- xbase_util-0.1.4/xbase_util/db/dao/__init__.py +0 -0
- xbase_util-0.1.4/xbase_util/db/initsqlite3.py +18 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/xbase_util.py +3 -3
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util.egg-info/PKG-INFO +1 -1
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util.egg-info/SOURCES.txt +13 -1
- {xbase_util-0.1.2 → xbase_util-0.1.4}/README.md +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/setup.cfg +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/__init__.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/es_db_util.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/esreq.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/geo_util.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/handle_features_util.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/pcap_util.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util/xbase_constant.py +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util.egg-info/dependency_links.txt +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util.egg-info/not-zip-safe +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util.egg-info/top_level.txt +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util_assets/GeoLite2-City.mmdb +0 -0
- {xbase_util-0.1.2 → xbase_util-0.1.4}/xbase_util_assets/arkimeparse.js +0 -0
File without changes
|
@@ -0,0 +1,103 @@
|
|
1
|
+
from sqlalchemy import Column, Integer, String, TEXT, Boolean
|
2
|
+
|
3
|
+
from xbase_util.db.bean import DbBase
|
4
|
+
|
5
|
+
|
6
|
+
class ConfigBean(DbBase):
|
7
|
+
__tablename__ = 'configs'
|
8
|
+
id = Column(Integer, primary_key=True)
|
9
|
+
description = Column(TEXT)
|
10
|
+
|
11
|
+
label_all_true = Column(Boolean, nullable=False)
|
12
|
+
label_is_output_unmatch = Column(Boolean, nullable=False)
|
13
|
+
label_duration = Column(Integer, nullable=False)
|
14
|
+
splitNumber = Column(Integer, nullable=False)
|
15
|
+
|
16
|
+
mapping_le_path = Column(String, nullable=False)
|
17
|
+
pcap_per_subsection = Column(Integer, nullable=False)
|
18
|
+
pcap_process = Column(Integer, nullable=False)
|
19
|
+
pcap_thread_in_process = Column(Integer, nullable=False)
|
20
|
+
replace_source = Column(TEXT, nullable=False) #用列表传
|
21
|
+
replace_destination = Column(String, nullable=False)
|
22
|
+
replace_mapping = Column(TEXT, nullable=False) #用列表传
|
23
|
+
replace_save_to = Column(String, nullable=False)
|
24
|
+
|
25
|
+
session_all_true = Column(Boolean, nullable=False)
|
26
|
+
session_start_time = Column(String, nullable=False)
|
27
|
+
session_end_time = Column(String, nullable=False)
|
28
|
+
session_expression = Column(String)
|
29
|
+
session_alive = Column(String)
|
30
|
+
catalogue = Column(String)
|
31
|
+
session_size = Column(Integer)
|
32
|
+
|
33
|
+
def to_dict(self):
|
34
|
+
return {
|
35
|
+
'id': self.id,
|
36
|
+
'description': self.description or "",
|
37
|
+
|
38
|
+
'label_all_true': self.label_all_true,
|
39
|
+
'label_is_output_unmatch': self.label_is_output_unmatch,
|
40
|
+
'label_duration': self.label_duration,
|
41
|
+
'splitNumber': self.splitNumber,
|
42
|
+
|
43
|
+
'mapping_le_path': self.mapping_le_path or "",
|
44
|
+
|
45
|
+
'pcap_per_subsection': self.pcap_per_subsection,
|
46
|
+
'pcap_process': self.pcap_process,
|
47
|
+
'pcap_thread_in_process': self.pcap_thread_in_process,
|
48
|
+
|
49
|
+
'replace_source': self.replace_source or "",
|
50
|
+
'replace_destination': self.replace_destination or "",
|
51
|
+
'replace_mapping': self.replace_mapping or "",
|
52
|
+
'replace_save_to': self.replace_save_to or "",
|
53
|
+
|
54
|
+
'session_all_true': self.session_all_true,
|
55
|
+
'session_start_time': self.session_start_time or "",
|
56
|
+
'session_end_time': self.session_end_time or "",
|
57
|
+
'session_expression': self.session_expression or "",
|
58
|
+
'session_alive': self.session_alive or "",
|
59
|
+
'session_size': self.session_size or "",
|
60
|
+
'catalogue': self.catalogue or "",
|
61
|
+
}
|
62
|
+
|
63
|
+
def to_session_dict(self):
|
64
|
+
return {
|
65
|
+
'id': self.id,
|
66
|
+
'session_all_true': self.session_all_true,
|
67
|
+
'session_start_time': self.session_start_time or "",
|
68
|
+
'session_end_time': self.session_end_time or "",
|
69
|
+
'session_expression': self.session_expression or "",
|
70
|
+
'session_alive': self.session_alive or "",
|
71
|
+
'session_size': self.session_size or "",
|
72
|
+
}
|
73
|
+
|
74
|
+
def to_pcap_dict(self):
|
75
|
+
return {
|
76
|
+
'id': self.id,
|
77
|
+
'pcap_per_subsection': self.pcap_per_subsection,
|
78
|
+
'pcap_process': self.pcap_process,
|
79
|
+
'pcap_thread_in_process': self.pcap_thread_in_process,
|
80
|
+
}
|
81
|
+
|
82
|
+
def to_label_dict(self):
|
83
|
+
return {
|
84
|
+
'id': self.id,
|
85
|
+
'label_all_true': self.label_all_true,
|
86
|
+
'label_is_output_unmatch': self.label_is_output_unmatch,
|
87
|
+
'label_duration': self.label_duration,
|
88
|
+
}
|
89
|
+
|
90
|
+
def to_mapping(self):
|
91
|
+
return {
|
92
|
+
'id': self.id,
|
93
|
+
'mapping_le_path': self.mapping_le_path or "",
|
94
|
+
}
|
95
|
+
|
96
|
+
def to_replace(self):
|
97
|
+
return {
|
98
|
+
'id': self.id,
|
99
|
+
'replace_source': self.replace_source or "",
|
100
|
+
'replace_destination': self.replace_destination or "",
|
101
|
+
'replace_mapping': self.replace_mapping or "",
|
102
|
+
'replace_save_to': self.replace_save_to or "",
|
103
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from sqlalchemy import Column, Integer, String, Boolean
|
2
|
+
|
3
|
+
from xbase_util.db.bean import DbBase
|
4
|
+
|
5
|
+
|
6
|
+
class TaskTemplateBean(DbBase):
|
7
|
+
__tablename__ = 'tasktemplatebean'
|
8
|
+
id = Column(Integer, primary_key=True)
|
9
|
+
|
10
|
+
config_id = Column(String)
|
11
|
+
flow_id = Column(String)
|
12
|
+
description = Column(String)
|
13
|
+
|
14
|
+
is_scheduled = Column(Boolean, default=False) # 是否为定时任务
|
15
|
+
scheduled_start_time = Column(String, nullable=True) # 定时任务的开始时间
|
16
|
+
scheduled_interval_minutes = Column(Integer, nullable=True) # 定时任务的执行间隔(以分钟为单位)
|
17
|
+
scheduled_period_minutes = Column(Integer, nullable=True) # 要获取的时间段(以分钟为单位)
|
18
|
+
|
19
|
+
def to_dict(self):
|
20
|
+
return {
|
21
|
+
"id": self.id,
|
22
|
+
"config_id": self.config_id,
|
23
|
+
"flow_id": self.flow_id,
|
24
|
+
"description": self.description,
|
25
|
+
"is_scheduled": self.is_scheduled,
|
26
|
+
"start_time": self.scheduled_start_time,
|
27
|
+
"interval_minutes": self.scheduled_interval_minutes,
|
28
|
+
}
|
@@ -0,0 +1,172 @@
|
|
1
|
+
import traceback
|
2
|
+
|
3
|
+
from xbase_util.db.bean.ConfigBean import ConfigBean
|
4
|
+
|
5
|
+
|
6
|
+
class ConfigDao:
|
7
|
+
def __init__(self,Session):
|
8
|
+
self.Session = Session
|
9
|
+
|
10
|
+
def add(self, id, description, label_all_true, label_is_output_unmatch,
|
11
|
+
label_duration,
|
12
|
+
mapping_le_path, pcap_per_subsection, pcap_process, pcap_thread_in_process,
|
13
|
+
replace_source, replace_destination, replace_mapping, replace_save_to, session_all_true, session_start_time,
|
14
|
+
session_end_time, session_expression, session_alive, session_size, splitNumber,catalogue
|
15
|
+
):
|
16
|
+
with self.Session() as session:
|
17
|
+
try:
|
18
|
+
if id is None:
|
19
|
+
bean = ConfigBean(
|
20
|
+
description=description,
|
21
|
+
label_all_true=label_all_true,
|
22
|
+
label_is_output_unmatch=label_is_output_unmatch,
|
23
|
+
label_duration=label_duration,
|
24
|
+
mapping_le_path=mapping_le_path,
|
25
|
+
pcap_per_subsection=pcap_per_subsection,
|
26
|
+
pcap_process=pcap_process,
|
27
|
+
pcap_thread_in_process=pcap_thread_in_process,
|
28
|
+
replace_source=replace_source,
|
29
|
+
replace_destination=replace_destination,
|
30
|
+
replace_mapping=replace_mapping,
|
31
|
+
replace_save_to=replace_save_to,
|
32
|
+
session_all_true=session_all_true,
|
33
|
+
session_start_time=session_start_time,
|
34
|
+
session_end_time=session_end_time,
|
35
|
+
session_expression=session_expression,
|
36
|
+
session_alive=session_alive,
|
37
|
+
session_size=session_size,
|
38
|
+
splitNumber=splitNumber,
|
39
|
+
catalogue=catalogue
|
40
|
+
)
|
41
|
+
session.add(bean)
|
42
|
+
session.commit()
|
43
|
+
return True
|
44
|
+
else:
|
45
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
46
|
+
if config is None:
|
47
|
+
return False
|
48
|
+
config.description = description
|
49
|
+
config.label_all_true = label_all_true
|
50
|
+
config.label_is_output_unmatch = label_is_output_unmatch
|
51
|
+
config.label_duration = label_duration
|
52
|
+
config.mapping_le_path = mapping_le_path
|
53
|
+
config.pcap_per_subsection = pcap_per_subsection
|
54
|
+
config.pcap_process = pcap_process
|
55
|
+
config.pcap_thread_in_process = pcap_thread_in_process
|
56
|
+
config.replace_source = replace_source
|
57
|
+
config.replace_destination = replace_destination
|
58
|
+
config.replace_mapping = replace_mapping
|
59
|
+
config.replace_save_to = replace_save_to
|
60
|
+
config.session_all_true = session_all_true
|
61
|
+
config.session_start_time = session_start_time
|
62
|
+
config.session_end_time = session_end_time
|
63
|
+
config.session_expression = session_expression
|
64
|
+
config.session_alive = session_alive
|
65
|
+
config.session_size = session_size
|
66
|
+
config.splitNumber = splitNumber
|
67
|
+
config.catalogue=catalogue
|
68
|
+
session.commit()
|
69
|
+
except Exception as e:
|
70
|
+
session.rollback()
|
71
|
+
traceback.print_exc()
|
72
|
+
print(e)
|
73
|
+
|
74
|
+
def get_config_file_list(self):
|
75
|
+
with self.Session() as session:
|
76
|
+
try:
|
77
|
+
config_list = session.query(ConfigBean).all()
|
78
|
+
return [d.to_dict() for d in config_list]
|
79
|
+
except Exception as e:
|
80
|
+
session.rollback()
|
81
|
+
print(e)
|
82
|
+
|
83
|
+
def remove_by_id(self, id):
|
84
|
+
with self.Session() as session:
|
85
|
+
try:
|
86
|
+
session.query(ConfigBean).filter(ConfigBean.id == id).delete()
|
87
|
+
session.commit()
|
88
|
+
except Exception as e:
|
89
|
+
session.rollback()
|
90
|
+
print(e)
|
91
|
+
|
92
|
+
def get_config_by_id(self, id):
|
93
|
+
with self.Session() as session:
|
94
|
+
try:
|
95
|
+
return session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
96
|
+
except Exception as e:
|
97
|
+
session.rollback()
|
98
|
+
print(e)
|
99
|
+
|
100
|
+
def set_config_session_by_id(self, id, session_all_true, session_start_time, session_end_time, session_expression,
|
101
|
+
session_alive, session_size):
|
102
|
+
with self.Session() as session:
|
103
|
+
try:
|
104
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
105
|
+
config.session_all_true = session_all_true
|
106
|
+
config.session_start_time = session_start_time
|
107
|
+
config.session_end_time = session_end_time
|
108
|
+
config.session_expression = session_expression
|
109
|
+
config.session_alive = session_alive
|
110
|
+
config.session_size = session_size
|
111
|
+
session.commit()
|
112
|
+
except Exception as e:
|
113
|
+
session.rollback()
|
114
|
+
print(e)
|
115
|
+
|
116
|
+
def set_config_pcap_by_id(self, id,
|
117
|
+
pcap_per_subsection,
|
118
|
+
pcap_process,
|
119
|
+
pcap_thread_in_process):
|
120
|
+
with self.Session() as session:
|
121
|
+
try:
|
122
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
123
|
+
config.pcap_per_subsection = pcap_per_subsection
|
124
|
+
config.pcap_process = pcap_process
|
125
|
+
config.pcap_thread_in_process = pcap_thread_in_process
|
126
|
+
session.commit()
|
127
|
+
except Exception as e:
|
128
|
+
session.rollback()
|
129
|
+
print(e)
|
130
|
+
|
131
|
+
def set_config_label_by_id(self, id,
|
132
|
+
label_all_true,
|
133
|
+
label_is_output_unmatch,
|
134
|
+
label_duration):
|
135
|
+
with self.Session() as session:
|
136
|
+
try:
|
137
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
138
|
+
config.label_all_true = label_all_true
|
139
|
+
config.label_is_output_unmatch = label_is_output_unmatch
|
140
|
+
config.label_duration = label_duration
|
141
|
+
session.commit()
|
142
|
+
except Exception as e:
|
143
|
+
session.rollback()
|
144
|
+
print(e)
|
145
|
+
|
146
|
+
def set_config_mapping_by_id(self, id, mapping_le_path):
|
147
|
+
with self.Session() as session:
|
148
|
+
try:
|
149
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
150
|
+
config.mapping_le_path = mapping_le_path
|
151
|
+
session.commit()
|
152
|
+
except Exception as e:
|
153
|
+
session.rollback()
|
154
|
+
print(e)
|
155
|
+
|
156
|
+
def set_config_replace_by_id(self, id, replace_source, replace_destination, replace_mapping, replace_save_to):
|
157
|
+
with self.Session() as session:
|
158
|
+
try:
|
159
|
+
config = session.query(ConfigBean).filter(ConfigBean.id == id).first()
|
160
|
+
config.replace_source = replace_source
|
161
|
+
config.replace_destination = replace_destination
|
162
|
+
config.replace_mapping = replace_mapping
|
163
|
+
config.replace_save_to = replace_save_to
|
164
|
+
session.commit()
|
165
|
+
except Exception as e:
|
166
|
+
session.rollback()
|
167
|
+
print(e)
|
168
|
+
# 修改脚本带redis获取状态
|
169
|
+
# 提异常,正常dns和异常都要,要新的黑白样本
|
170
|
+
# app
|
171
|
+
# capture
|
172
|
+
# 日报规范问题 [做了什么][完成的进度][遇到的问题][问题研究的进度和方案]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from xbase_util.db.bean.CurrentConfigBean import CurrentConfig
|
2
|
+
|
3
|
+
|
4
|
+
class CurrentConfigDao:
|
5
|
+
def __init__(self,Session):
|
6
|
+
self.Session = Session
|
7
|
+
|
8
|
+
def set_current_config(self, id, desc):
|
9
|
+
with self.Session() as session:
|
10
|
+
try:
|
11
|
+
session.query(CurrentConfig).delete()
|
12
|
+
session.add(CurrentConfig(config_id=id, description=desc))
|
13
|
+
session.commit()
|
14
|
+
except Exception as e:
|
15
|
+
session.rollback()
|
16
|
+
print(f"Error: {e}")
|
17
|
+
|
18
|
+
def get_current_config(self):
|
19
|
+
with self.Session() as session:
|
20
|
+
try:
|
21
|
+
return session.query(CurrentConfig).first()
|
22
|
+
except Exception as e:
|
23
|
+
session.rollback()
|
24
|
+
print(f"Error: {e}")
|
@@ -0,0 +1,59 @@
|
|
1
|
+
from xbase_util.db.bean.FlowBean import FlowBean
|
2
|
+
|
3
|
+
|
4
|
+
class FlowDao:
|
5
|
+
def __init__(self,Session):
|
6
|
+
self.Session = Session
|
7
|
+
|
8
|
+
def add_flow(self, description, step, flow_id=None):
|
9
|
+
with self.Session() as session:
|
10
|
+
try:
|
11
|
+
if flow_id is None:
|
12
|
+
flow = FlowBean(description=description, step=step)
|
13
|
+
session.add(flow)
|
14
|
+
else:
|
15
|
+
flow = session.query(FlowBean).filter_by(id=flow_id).first()
|
16
|
+
flow.description = description
|
17
|
+
flow.step = step
|
18
|
+
session.commit()
|
19
|
+
return True
|
20
|
+
except Exception as e:
|
21
|
+
session.rollback()
|
22
|
+
print(e)
|
23
|
+
return False
|
24
|
+
|
25
|
+
def get_flow_list(self):
|
26
|
+
with self.Session() as session:
|
27
|
+
try:
|
28
|
+
flows = session.query(FlowBean).all()
|
29
|
+
return [{
|
30
|
+
'id': item.id,
|
31
|
+
'description': item.description,
|
32
|
+
'step': item.step,
|
33
|
+
} for item in flows]
|
34
|
+
except Exception as e:
|
35
|
+
session.rollback()
|
36
|
+
print(e)
|
37
|
+
return []
|
38
|
+
|
39
|
+
def delete_by_id(self, id):
|
40
|
+
with self.Session() as session:
|
41
|
+
try:
|
42
|
+
flow = session.query(FlowBean).filter_by(id=id).first()
|
43
|
+
if flow:
|
44
|
+
session.delete(flow)
|
45
|
+
session.commit()
|
46
|
+
return True
|
47
|
+
except Exception as e:
|
48
|
+
session.rollback()
|
49
|
+
print(e)
|
50
|
+
return False
|
51
|
+
|
52
|
+
def get_flow_by_id(self, id):
|
53
|
+
with self.Session() as session:
|
54
|
+
try:
|
55
|
+
return session.query(FlowBean).filter_by(id=id).first()
|
56
|
+
except Exception as e:
|
57
|
+
session.rollback()
|
58
|
+
print(e)
|
59
|
+
return None
|
@@ -0,0 +1,57 @@
|
|
1
|
+
from xbase_util.db.bean.TaskTemplateBean import TaskTemplateBean
|
2
|
+
|
3
|
+
|
4
|
+
class TaskTemplateDao:
|
5
|
+
def __init__(self,Session):
|
6
|
+
self.Session = Session
|
7
|
+
|
8
|
+
def addTemplate(self, data):
|
9
|
+
with self.Session() as session:
|
10
|
+
try:
|
11
|
+
b = TaskTemplateBean()
|
12
|
+
b.config_id = data.config_id
|
13
|
+
b.flow_id = data.flow_id
|
14
|
+
b.description = data.description
|
15
|
+
b.is_scheduled = data.is_scheduled
|
16
|
+
b.scheduled_start_time = data.scheduled_start_time
|
17
|
+
b.scheduled_interval_minutes = data.scheduled_interval_minutes
|
18
|
+
b.scheduled_period_minutes = data.scheduled_period_minutes
|
19
|
+
session.add(b)
|
20
|
+
session.commit()
|
21
|
+
except Exception as e:
|
22
|
+
print(e)
|
23
|
+
session.rollback()
|
24
|
+
|
25
|
+
def changeTemplate(self, data):
|
26
|
+
with self.Session() as session:
|
27
|
+
try:
|
28
|
+
bean = session.query(TaskTemplateBean).first()
|
29
|
+
bean.config_id = data.config_id
|
30
|
+
bean.flow_id = data.flow_id
|
31
|
+
bean.description = data.description
|
32
|
+
session.commit()
|
33
|
+
except Exception as e:
|
34
|
+
print(e)
|
35
|
+
session.rollback()
|
36
|
+
|
37
|
+
def get_list(self):
|
38
|
+
with self.Session() as session:
|
39
|
+
try:
|
40
|
+
temp_list = session.query(TaskTemplateBean).all()
|
41
|
+
return temp_list
|
42
|
+
except Exception as e:
|
43
|
+
session.rollback()
|
44
|
+
print(e)
|
45
|
+
return []
|
46
|
+
|
47
|
+
def delete_template(self, id):
|
48
|
+
with self.Session() as session:
|
49
|
+
try:
|
50
|
+
bean = session.query(TaskTemplateBean).filter_by(id=id).first()
|
51
|
+
session.delete(bean)
|
52
|
+
session.commit()
|
53
|
+
return True
|
54
|
+
except Exception as e:
|
55
|
+
session.rollback()
|
56
|
+
print(e)
|
57
|
+
return False
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from sqlalchemy import create_engine
|
2
|
+
from sqlalchemy.orm import sessionmaker
|
3
|
+
from xbase_util.db.bean import DbBase
|
4
|
+
from xbase_util.db.dao.ConfigDao import ConfigDao
|
5
|
+
from xbase_util.db.dao.CurrentConfigDao import CurrentConfigDao
|
6
|
+
from xbase_util.db.dao.FlowDao import FlowDao
|
7
|
+
from xbase_util.db.dao.TaskTemplateDao import TaskTemplateDao
|
8
|
+
|
9
|
+
|
10
|
+
def initSqlite3(path: str):
|
11
|
+
engine = create_engine(path, echo=False)
|
12
|
+
DbBase.metadata.create_all(engine)
|
13
|
+
Session = sessionmaker(bind=engine)
|
14
|
+
flowDao = FlowDao(Session)
|
15
|
+
configDao = ConfigDao(Session)
|
16
|
+
currentConfigDao = CurrentConfigDao(Session)
|
17
|
+
taskTemplateDao = TaskTemplateDao(Session)
|
18
|
+
return flowDao, configDao, currentConfigDao, taskTemplateDao
|
@@ -230,7 +230,7 @@ def get_dns_domain(packets):
|
|
230
230
|
return domain_name
|
231
231
|
|
232
232
|
|
233
|
-
def extract_session_fields(
|
233
|
+
def extract_session_fields(origin_list, geoUtil):
|
234
234
|
res = []
|
235
235
|
for item in origin_list:
|
236
236
|
_source = item.get("_source", {})
|
@@ -243,8 +243,8 @@ def extract_session_fields(cls, origin_list, geoUtil):
|
|
243
243
|
uri = http.get('uri', [])
|
244
244
|
uri_length = [len(u) for u in uri]
|
245
245
|
uri_depth = [get_uri_depth(u) for u in uri]
|
246
|
-
uri_filename_length = [
|
247
|
-
uri_params = [
|
246
|
+
uri_filename_length = [get_uri_filename_length(u) for u in uri]
|
247
|
+
uri_params = [get_url_param_count(u) for u in uri]
|
248
248
|
res.append(geoUtil.get_geo_by_ip({
|
249
249
|
"id": item["_id"],
|
250
250
|
"node": _source.get("node", ""),
|
@@ -14,4 +14,16 @@ xbase_util.egg-info/dependency_links.txt
|
|
14
14
|
xbase_util.egg-info/not-zip-safe
|
15
15
|
xbase_util.egg-info/top_level.txt
|
16
16
|
xbase_util/../xbase_util_assets/GeoLite2-City.mmdb
|
17
|
-
xbase_util/../xbase_util_assets/arkimeparse.js
|
17
|
+
xbase_util/../xbase_util_assets/arkimeparse.js
|
18
|
+
xbase_util/db/__init__.py
|
19
|
+
xbase_util/db/initsqlite3.py
|
20
|
+
xbase_util/db/bean/ConfigBean.py
|
21
|
+
xbase_util/db/bean/CurrentConfigBean.py
|
22
|
+
xbase_util/db/bean/FlowBean.py
|
23
|
+
xbase_util/db/bean/TaskTemplateBean.py
|
24
|
+
xbase_util/db/bean/__init__.py
|
25
|
+
xbase_util/db/dao/ConfigDao.py
|
26
|
+
xbase_util/db/dao/CurrentConfigDao.py
|
27
|
+
xbase_util/db/dao/FlowDao.py
|
28
|
+
xbase_util/db/dao/TaskTemplateDao.py
|
29
|
+
xbase_util/db/dao/__init__.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|