xbase-util 0.2.6__tar.gz → 0.2.7__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {xbase_util-0.2.6 → xbase_util-0.2.7}/PKG-INFO +1 -1
- {xbase_util-0.2.6 → xbase_util-0.2.7}/setup.py +1 -1
- xbase_util-0.2.7/xbase_util/es_db_util.py +32 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util.egg-info/PKG-INFO +1 -1
- xbase_util-0.2.6/xbase_util/es_db_util.py +0 -29
- {xbase_util-0.2.6 → xbase_util-0.2.7}/README.md +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/setup.cfg +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/__init__.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/__init__.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/bean/ConfigBean.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/bean/CurrentConfigBean.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/bean/FlowBean.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/bean/TaskTemplateBean.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/bean/__init__.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/dao/ConfigDao.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/dao/CurrentConfigDao.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/dao/FlowDao.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/dao/TaskTemplateDao.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/dao/__init__.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/db/initsqlite3.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/esreq.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/geo_util.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/handle_features_util.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/pcap_util.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/xbase_constant.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util/xbase_util.py +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util.egg-info/SOURCES.txt +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util.egg-info/dependency_links.txt +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util.egg-info/not-zip-safe +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util.egg-info/top_level.txt +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util_assets/GeoLite2-City.mmdb +0 -0
- {xbase_util-0.2.6 → xbase_util-0.2.7}/xbase_util_assets/arkimeparse.js +0 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
import os.path
|
2
|
+
|
3
|
+
|
4
|
+
class EsDb:
|
5
|
+
def __init__(self, req):
|
6
|
+
self.req = req
|
7
|
+
self.internals = {}
|
8
|
+
print("初始化:Elasticsearch DB")
|
9
|
+
|
10
|
+
def get_file_by_file_id(self, node, num, prefix=None):
|
11
|
+
key = f'{node}!{num}'
|
12
|
+
if key in self.internals:
|
13
|
+
return self.internals[key]
|
14
|
+
res = self.req.search_file(f"{node}-{num}")
|
15
|
+
try:
|
16
|
+
hits = res.json()['hits']['hits']
|
17
|
+
if len(hits) > 0:
|
18
|
+
self.internals[key] = hits[0]['_source']
|
19
|
+
file = hits[0]['_source']
|
20
|
+
if prefix is None:
|
21
|
+
return file
|
22
|
+
prefix_res = prefix
|
23
|
+
if not prefix.endswith('/'):
|
24
|
+
prefix_res = f"{prefix}/"
|
25
|
+
origin_path = file['name']
|
26
|
+
basename = os.path.basename(origin_path)
|
27
|
+
result_path = f"{prefix_res}{basename}"
|
28
|
+
file['name'] = result_path
|
29
|
+
return file
|
30
|
+
except Exception as e:
|
31
|
+
print(f"获取es文件失败:{res.text}获取es文件失败")
|
32
|
+
return None
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import os.path
|
2
|
-
|
3
|
-
|
4
|
-
class EsDb:
|
5
|
-
def __init__(self, req):
|
6
|
-
self.req = req
|
7
|
-
self.internals = {}
|
8
|
-
print("初始化:Elasticsearch DB")
|
9
|
-
|
10
|
-
def get_file_by_file_id(self, node, num, prefix=None):
|
11
|
-
key = f'{node}!{num}'
|
12
|
-
if key in self.internals:
|
13
|
-
return self.internals[key]
|
14
|
-
res = self.req.search_file(f"{node}-{num}").json()
|
15
|
-
hits = res['hits']['hits']
|
16
|
-
if len(hits) > 0:
|
17
|
-
self.internals[key] = hits[0]['_source']
|
18
|
-
file = hits[0]['_source']
|
19
|
-
if prefix is None:
|
20
|
-
return file
|
21
|
-
prefix_res = prefix
|
22
|
-
if not prefix.endswith('/'):
|
23
|
-
prefix_res = f"{prefix}/"
|
24
|
-
origin_path = file['name']
|
25
|
-
basename = os.path.basename(origin_path)
|
26
|
-
result_path = f"{prefix_res}{basename}"
|
27
|
-
file['name'] = result_path
|
28
|
-
return file
|
29
|
-
return None
|
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
|
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
|