xbase-util 0.6.7__tar.gz → 0.6.8__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. {xbase_util-0.6.7 → xbase_util-0.6.8}/PKG-INFO +1 -1
  2. {xbase_util-0.6.7 → xbase_util-0.6.8}/setup.py +1 -1
  3. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/packet_util.py +21 -20
  4. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util.egg-info/PKG-INFO +1 -1
  5. {xbase_util-0.6.7 → xbase_util-0.6.8}/README.md +0 -0
  6. {xbase_util-0.6.7 → xbase_util-0.6.8}/setup.cfg +0 -0
  7. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/__init__.py +0 -0
  8. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/add_column_util.py +0 -0
  9. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/dangerous_util.py +0 -0
  10. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/__init__.py +0 -0
  11. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/bean/ConfigBean.py +0 -0
  12. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/bean/CurrentConfigBean.py +0 -0
  13. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/bean/FlowBean.py +0 -0
  14. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/bean/TaskTemplateBean.py +0 -0
  15. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/bean/__init__.py +0 -0
  16. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/dao/ConfigDao.py +0 -0
  17. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/dao/CurrentConfigDao.py +0 -0
  18. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/dao/FlowDao.py +0 -0
  19. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/dao/TaskTemplateDao.py +0 -0
  20. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/dao/__init__.py +0 -0
  21. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/db/initsqlite3.py +0 -0
  22. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/es_db_util.py +0 -0
  23. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/esreq.py +0 -0
  24. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/geo_util.py +0 -0
  25. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/handle_features_util.py +0 -0
  26. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/pcap_util.py +0 -0
  27. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/segment.py +0 -0
  28. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/xbase_constant.py +0 -0
  29. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util/xbase_util.py +0 -0
  30. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util.egg-info/SOURCES.txt +0 -0
  31. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util.egg-info/dependency_links.txt +0 -0
  32. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util.egg-info/not-zip-safe +0 -0
  33. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util.egg-info/top_level.txt +0 -0
  34. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util_assets/GeoLite2-City.mmdb +0 -0
  35. {xbase_util-0.6.7 → xbase_util-0.6.8}/xbase_util_assets/arkimeparse.js +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xbase_util
3
- Version: 0.6.7
3
+ Version: 0.6.8
4
4
  Summary: 网络安全基础工具
5
5
  Home-page: https://gitee.com/jimonik/xbase_util.git
6
6
  Author: xyt
@@ -3,7 +3,7 @@ from distutils.core import setup
3
3
  from setuptools import find_packages
4
4
 
5
5
  setup(name="xbase_util",
6
- version="0.6.7",
6
+ version="0.6.8",
7
7
  description="网络安全基础工具",
8
8
  long_description="包含提取,预测,训练的基础工具",
9
9
  author="xyt",
@@ -65,6 +65,11 @@ res_pattern = re.compile(r"HTTP/\d\.\d \d{3}.*", re.DOTALL)
65
65
  req_body_pattern = re.compile(
66
66
  r"(GET|POST|HEAD|PUT|DELETE|OPTIONS|PATCH) \/[^\s]* HTTP\/\d\.\d[\s\S]*?(?=HTTP/\d\.\d)", re.DOTALL)
67
67
 
68
+ http_version = re.compile(r"HTTP\/(\d\.\d)")
69
+ http_req_method = re.compile(r"(GET|POST|HEAD|PUT|DELETE|OPTIONS|PATCH) \/[^\s]* HTTP\/\d\.\d")
70
+ http_req_path = re.compile(r"(?:GET|POST|HEAD|PUT|DELETE|OPTIONS|PATCH)\s+(\/[^\s]*)\s+HTTP\/\d\.\d")
71
+ res_status_code_pattern = re.compile(r"HTTP\/\d\.\d\s+(\d{3})\s+.*")
72
+
68
73
 
69
74
  def get_all_packets_by_reg(packets):
70
75
  http_Req_Raw = {}
@@ -117,17 +122,15 @@ def get_detail_by_package(publicField, req_header, req_body, res_header, res_bod
117
122
  res_field = copy.deepcopy(publicField)
118
123
  res_field["initRTT"] = firstOrZero(res_field.get("initRTT", 0))
119
124
  res_field["length"] = firstOrZero(res_field.get("length", 0))
120
- request_lines = req_header.strip().split("\n")
121
- http_request_lines = [item for item in request_lines if "HTTP" in item]
122
- if len(http_request_lines) != 0:
123
- first_line = http_request_lines[0].split(" ")
124
- res_field['http.clientVersion'] = str(first_line[2]).replace("\n", "").replace("\r", "")
125
- res_field['http.path'] = first_line[1]
126
- res_field['http.method'] = first_line[0]
127
- else:
128
- res_field['http.clientVersion'] = ''
129
- res_field['http.path'] = ''
130
- res_field['http.method'] = ''
125
+
126
+ http_version_res = http_version.findall(req_header)
127
+ res_field['http.clientVersion'] = http_version_res[0] if len(http_version_res) > 0 else ""
128
+ http_method = http_req_method.findall(req_header)
129
+ http_path = http_req_path.findall(req_header)
130
+ res_field['http.clientVersion'] = http_version_res[0] if len(http_version_res) > 0 else ""
131
+ res_field['http.method'] = http_method[0] if len(http_method) > 0 else ""
132
+ res_field['http.path'] = http_path[0] if len(http_path) > 0 else ""
133
+ request_lines = req_header.splitlines()
131
134
  res_field['http.request-referer'] = get_header_value(header_set=request_lines, value="Referer")
132
135
  res_field['http.request-content-type'] = get_header_value(header_set=request_lines,
133
136
  value="Content-Type")
@@ -139,15 +142,13 @@ def get_detail_by_package(publicField, req_header, req_body, res_header, res_bod
139
142
  res_field['plain_body_src'] = req_body
140
143
  if content_type_is_plain(res_header):
141
144
  res_field['plain_body_dst'] = res_body
142
- response_lines = res_body.strip().split("\n")
143
- http_response_lines = [item for item in response_lines if "HTTP" in item]
144
- if len(http_response_lines) != 0:
145
- first_line = http_response_lines[0].strip().split(" ")
146
- res_field['http.statuscode'] = first_line[1]
147
- res_field['http.serverVersion'] = first_line[0].split("/")[1]
148
- else:
149
- res_field['http.statuscode'] = ""
150
- res_field['http.serverVersion'] = ""
145
+
146
+ http_server_version_res = http_version.findall(res_header)
147
+ res_field['http.serverVersion'] = http_server_version_res[0] if len(http_server_version_res) > 0 else ""
148
+
149
+ status_code = res_status_code_pattern.findall(res_header)
150
+ res_field['http.statuscode'] = status_code[0] if len(status_code) > 0 else ""
151
+ response_lines = res_header.striplines()
151
152
  res_field['http.response-server'] = get_header_value(header_set=response_lines, value="Server")
152
153
  res_field['http.response-content-type'] = get_header_value(header_set=response_lines,
153
154
  value="Content-Type")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xbase-util
3
- Version: 0.6.7
3
+ Version: 0.6.8
4
4
  Summary: 网络安全基础工具
5
5
  Home-page: https://gitee.com/jimonik/xbase_util.git
6
6
  Author: xyt
File without changes
File without changes