xbase-util 0.8.3__tar.gz → 0.8.5__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.5}/PKG-INFO +1 -1
- {xbase_util-0.8.3 → xbase_util-0.8.5}/setup.py +1 -1
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/common_util.py +22 -26
- xbase_util-0.8.5/xbase_util/test.py +21 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/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.5}/README.md +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/setup.cfg +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/add_column_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/dangerous_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/bean/ConfigBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/bean/CurrentConfigBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/bean/FlowBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/bean/TaskTemplateBean.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/bean/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/dao/ConfigDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/dao/CurrentConfigDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/dao/FlowDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/dao/TaskTemplateDao.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/dao/__init__.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/db/initsqlite3.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/es_db_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/esreq.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/geo_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/handle_features_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/packet_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/pcap_util.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util/xbase_constant.py +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util.egg-info/SOURCES.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util.egg-info/dependency_links.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util.egg-info/not-zip-safe +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util.egg-info/top_level.txt +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util_assets/GeoLite2-City.mmdb +0 -0
- {xbase_util-0.8.3 → xbase_util-0.8.5}/xbase_util_assets/arkimeparse.js +0 -0
@@ -3,6 +3,7 @@ import json
|
|
3
3
|
import logging
|
4
4
|
import os
|
5
5
|
import re
|
6
|
+
from collections import Counter
|
6
7
|
from datetime import datetime
|
7
8
|
from logging.handlers import TimedRotatingFileHandler
|
8
9
|
from urllib.parse import urlparse, parse_qs
|
@@ -68,43 +69,38 @@ def parse_expression(expression):
|
|
68
69
|
return None
|
69
70
|
|
70
71
|
|
71
|
-
def get_cookie_end_with_semicolon_count(
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
if
|
76
|
-
|
77
|
-
|
78
|
-
return -1
|
79
|
-
return count
|
72
|
+
def get_cookie_end_with_semicolon_count(all_packets):
|
73
|
+
headers = [item['req_header'] + item['res_header'] for item in all_packets]
|
74
|
+
c = 0
|
75
|
+
for header in headers:
|
76
|
+
lines = [item for item in header.split('\r\n') if 'Cookie:' in item and item.strip().endswith(';')]
|
77
|
+
c += len(lines)
|
78
|
+
return c
|
80
79
|
|
81
80
|
|
82
|
-
def get_ua_duplicate_count(
|
81
|
+
def get_ua_duplicate_count(all_packets):
|
82
|
+
headers = [item['req_header'] + item['res_header'] for item in all_packets]
|
83
83
|
ua_list = []
|
84
|
-
for
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
return sum(count)
|
84
|
+
for header in headers:
|
85
|
+
lines = [item for item in header.split('\r\n') if 'User-Agent:' in item]
|
86
|
+
ua_list.extend(lines)
|
87
|
+
counter = Counter(ua_list)
|
88
|
+
pairs = sum(count // 2 for count in counter.values())
|
89
|
+
print(pairs)
|
90
|
+
return pairs
|
92
91
|
|
93
92
|
|
94
|
-
def get_res_status_code_list(
|
93
|
+
def get_res_status_code_list(all_packets):
|
95
94
|
value_res = []
|
96
|
-
res = []
|
97
95
|
num_1 = 0
|
98
96
|
num_2 = 0
|
99
97
|
num_3 = 0
|
100
98
|
num_4 = 0
|
101
99
|
num_5 = 0
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
if m:
|
107
|
-
value_res.append(int(m.group(0)))
|
100
|
+
for item in all_packets:
|
101
|
+
match = re.search(r'HTTP/\d\.\d (\d{3})', item['res_header'])
|
102
|
+
if match:
|
103
|
+
value_res.append(int(match.group(1)))
|
108
104
|
for value in value_res:
|
109
105
|
if 0 <= value < 200:
|
110
106
|
num_1 = num_1 + 1
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import re
|
2
|
+
from collections import Counter
|
3
|
+
|
4
|
+
import numpy as np
|
5
|
+
from scapy.packet import Raw
|
6
|
+
from scapy.utils import rdpcap
|
7
|
+
|
8
|
+
from xbase_util.common_util import get_res_status_code_list
|
9
|
+
from xbase_util.pcap_util import reassemble_tcp_pcap, reassemble_session_pcap
|
10
|
+
from xbase_util.xbase_constant import res_status_code_pattern
|
11
|
+
|
12
|
+
if __name__ == '__main__':
|
13
|
+
packets_scapy = reassemble_tcp_pcap(rdpcap("gzip2.pcap"))
|
14
|
+
skey = '10.28.7.16:54398'
|
15
|
+
streams = b""
|
16
|
+
for pkt in packets_scapy:
|
17
|
+
if Raw in pkt:
|
18
|
+
streams += pkt[Raw].load
|
19
|
+
text_data = streams.decode('ascii', errors='ignore')
|
20
|
+
all_packets = reassemble_session_pcap(packets_scapy, skey=skey)
|
21
|
+
|
@@ -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
|