xbase-util 0.8.3__tar.gz → 0.8.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {xbase_util-0.8.3 → xbase_util-0.8.4}/PKG-INFO +1 -1
- {xbase_util-0.8.3 → xbase_util-0.8.4}/setup.py +1 -1
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/common_util.py +5 -8
- xbase_util-0.8.4/xbase_util/test.py +40 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util.egg-info/PKG-INFO +1 -1
- xbase_util-0.8.3/xbase_util/test.py +0 -8
- {xbase_util-0.8.3 → xbase_util-0.8.4}/README.md +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/setup.cfg +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/add_column_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/dangerous_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/bean/ConfigBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/bean/CurrentConfigBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/bean/FlowBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/bean/TaskTemplateBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/bean/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/dao/ConfigDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/dao/CurrentConfigDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/dao/FlowDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/dao/TaskTemplateDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/dao/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/db/initsqlite3.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/es_db_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/esreq.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/geo_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/handle_features_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/packet_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/pcap_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util/xbase_constant.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util.egg-info/SOURCES.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util.egg-info/dependency_links.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util.egg-info/not-zip-safe +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util.egg-info/top_level.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util_assets/GeoLite2-City.mmdb +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.4}/xbase_util_assets/arkimeparse.js +0 -0
@@ -91,20 +91,17 @@ def get_ua_duplicate_count(text_data):
|
|
91
91
|
return sum(count)
|
92
92
|
|
93
93
|
|
94
|
-
def get_res_status_code_list(
|
94
|
+
def get_res_status_code_list(all_packets):
|
95
95
|
value_res = []
|
96
|
-
res = []
|
97
96
|
num_1 = 0
|
98
97
|
num_2 = 0
|
99
98
|
num_3 = 0
|
100
99
|
num_4 = 0
|
101
100
|
num_5 = 0
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
if m:
|
107
|
-
value_res.append(int(m.group(0)))
|
101
|
+
for item in all_packets:
|
102
|
+
match = re.search(r'HTTP/\d\.\d (\d{3})', item['res_header'])
|
103
|
+
if match:
|
104
|
+
value_res.append(int(match.group(1)))
|
108
105
|
for value in value_res:
|
109
106
|
if 0 <= value < 200:
|
110
107
|
num_1 = num_1 + 1
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import re
|
2
|
+
|
3
|
+
import numpy as np
|
4
|
+
from scapy.packet import Raw
|
5
|
+
from scapy.utils import rdpcap
|
6
|
+
|
7
|
+
from xbase_util.common_util import get_res_status_code_list
|
8
|
+
from xbase_util.pcap_util import reassemble_tcp_pcap, reassemble_session_pcap
|
9
|
+
from xbase_util.xbase_constant import res_status_code_pattern
|
10
|
+
|
11
|
+
if __name__ == '__main__':
|
12
|
+
packets_scapy = reassemble_tcp_pcap(rdpcap("gzip2.pcap"))
|
13
|
+
skey = '10.28.7.16:54398'
|
14
|
+
streams = b""
|
15
|
+
for pkt in packets_scapy:
|
16
|
+
if Raw in pkt:
|
17
|
+
streams += pkt[Raw].load
|
18
|
+
text_data = streams.decode('ascii', errors='ignore')
|
19
|
+
all_packets = reassemble_session_pcap(packets_scapy, skey=skey)
|
20
|
+
if len(all_packets) != 0:
|
21
|
+
all_req_size = [item['req_size'] for item in all_packets if item['key'] == skey]
|
22
|
+
all_res_size = [item['res_size'] for item in all_packets if item['key'] != skey]
|
23
|
+
num_1, num_2, num_3, num_4, num_5 = get_res_status_code_list(all_packets)
|
24
|
+
# 获取请求头参数数量
|
25
|
+
req_header_count_list = [req['req_header'].count(":") for req in all_packets]
|
26
|
+
# 请求的时间间隔
|
27
|
+
request_flattened_time = [item['req_time'] for item in all_packets]
|
28
|
+
request_time_diffs = [request_flattened_time[i + 1] - request_flattened_time[i] for i in
|
29
|
+
range(len(request_flattened_time) - 1)]
|
30
|
+
request_mean_diff = round(np.nanmean(request_time_diffs), 5) or 0
|
31
|
+
request_variance_diff = round(np.nanvar(request_time_diffs), 5) or 0
|
32
|
+
# 响应的时间间隔
|
33
|
+
response_flattened_time = [item['res_time'] for item in all_packets]
|
34
|
+
response_time_diffs = [response_flattened_time[i + 1] - response_flattened_time[i] for i in
|
35
|
+
range(len(response_flattened_time) - 1)]
|
36
|
+
response_mean_diff = round(np.nanmean(response_time_diffs), 5) or 0
|
37
|
+
response_variance_diff = round(np.nanvar(response_time_diffs), 5) or 0
|
38
|
+
|
39
|
+
time_period = [(abs(item['res_time'] - item['req_time'])) for item in
|
40
|
+
all_packets if item['res_time'] != 0 and item['req_time'] != 0]
|
@@ -1,8 +0,0 @@
|
|
1
|
-
from scapy.utils import rdpcap
|
2
|
-
|
3
|
-
from xbase_util.pcap_util import reassemble_tcp_pcap, reassemble_session_pcap
|
4
|
-
|
5
|
-
if __name__ == '__main__':
|
6
|
-
packets = reassemble_tcp_pcap(rdpcap("gzip2.pcap"))
|
7
|
-
res=reassemble_session_pcap(packets, skey='10.28.7.16:54398')
|
8
|
-
print(res)
|
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
|
File without changes
|
File without changes
|
File without changes
|