FlowAnalyzer 0.2.8__py3-none-any.whl → 0.2.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,9 +81,15 @@ class FlowAnalyzer:
81
81
  for packet in data:
82
82
  packet = packet["_source"]["layers"]
83
83
  time_epoch = float(packet["frame.time_epoch"][0]) if packet.get("frame.time_epoch") else None
84
- full_request = (
85
- packet["tcp.reassembled.data"][0] if packet.get("tcp.reassembled.data") else packet["tcp.payload"][0]
86
- )
84
+
85
+ if packet.get("tcp.reassembled.data"):
86
+ full_request = packet["tcp.reassembled.data"][0]
87
+ elif packet.get("tcp.payload"):
88
+ full_request = packet["tcp.payload"][0]
89
+ else:
90
+ # exported_pdu.exported_pdu
91
+ full_request = packet["exported_pdu.exported_pdu"][0]
92
+
87
93
  frame_num = int(packet["frame.number"][0]) if packet.get("frame.number") else None
88
94
  request_in = int(packet["http.request_in"][0]) if packet.get("http.request_in") else frame_num
89
95
  full_uri = (
@@ -140,7 +146,7 @@ class FlowAnalyzer:
140
146
  # sourcery skip: replace-interpolation-with-fstring, use-fstring-for-formatting
141
147
  # tshark -r {} -Y "{}" -T json -e http.request_number -e http.response_number -e http.request_in -e tcp.reassembled.data -e frame.number -e tcp.payload -e frame.time_epoch -e http.request.full_uri > output.json
142
148
  command = (
143
- 'tshark -r {} -Y "{}" -T json '
149
+ 'tshark -r {} -Y "(tcp.reassembled_in) or ({})" -T json '
144
150
  '-e http.request_number '
145
151
  '-e http.response_number '
146
152
  '-e http.request_in '
@@ -148,6 +154,7 @@ class FlowAnalyzer:
148
154
  '-e frame.number '
149
155
  '-e tcp.payload '
150
156
  '-e frame.time_epoch '
157
+ '-e exported_pdu.exported_pdu '
151
158
  '-e http.request.full_uri '
152
159
  '> output.json'.format(
153
160
  fileName, display_filter
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FlowAnalyzer
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: FlowAnalyzer是一个流量分析器,用于解析和处理tshark导出的JSON数据文件
5
5
  Home-page: https://github.com/Byxs20/FlowAnalyzer
6
6
  Author: Byxs20
@@ -33,6 +33,8 @@ pip3 install FlowAnalyzer -i https://pypi.org/simple
33
33
 
34
34
  # Usage
35
35
 
36
+ 请务必添加 `tshark.exe` 到环境变量,否则找不到会出错!
37
+
36
38
  ```
37
39
  $ git clone https://github.com/Byxs20/FlowAnalyzer.git
38
40
  $ cd ./FlowAnalyzer/
@@ -0,0 +1,8 @@
1
+ FlowAnalyzer/FlowAnalyzer.py,sha256=DjZFYHsI84E_wFJ3aoXttsBgRhLg1i7WP1jfKw46Z3E,10350
2
+ FlowAnalyzer/__init__.py,sha256=vfiHONPTrvjUU3MwhjFOEo3sWfzlhkA6gOLn_4UJ7sg,70
3
+ FlowAnalyzer/logging_config.py,sha256=e-73IByM1TuE2G1isOBvtIcr9XztWqPkGN-VsNEFbvY,671
4
+ FlowAnalyzer-0.2.9.dist-info/LICENSE,sha256=ybAV0ECduYBZCpjkHyNALVWRRmT_eM0BDgqUszhwEFU,1080
5
+ FlowAnalyzer-0.2.9.dist-info/METADATA,sha256=GfmORi_8E-2jABeKp1L1qk53fUZ8_99SASa9RLKokpg,10302
6
+ FlowAnalyzer-0.2.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
7
+ FlowAnalyzer-0.2.9.dist-info/top_level.txt,sha256=2MtvAF6dEe_eHipw_6G5pFLb2uOCbGnlH0bC4iBtm5A,13
8
+ FlowAnalyzer-0.2.9.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- FlowAnalyzer/FlowAnalyzer.py,sha256=vpKwZ-OMtKSQBsQKiAtc9MX4laQHfMNxB99bLVmWxVI,10072
2
- FlowAnalyzer/__init__.py,sha256=vfiHONPTrvjUU3MwhjFOEo3sWfzlhkA6gOLn_4UJ7sg,70
3
- FlowAnalyzer/logging_config.py,sha256=e-73IByM1TuE2G1isOBvtIcr9XztWqPkGN-VsNEFbvY,671
4
- FlowAnalyzer-0.2.8.dist-info/LICENSE,sha256=ybAV0ECduYBZCpjkHyNALVWRRmT_eM0BDgqUszhwEFU,1080
5
- FlowAnalyzer-0.2.8.dist-info/METADATA,sha256=duuhrPGvfKYJronaPUiRXRhhrD_cZ4538FpINGTHcFg,10224
6
- FlowAnalyzer-0.2.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
7
- FlowAnalyzer-0.2.8.dist-info/top_level.txt,sha256=2MtvAF6dEe_eHipw_6G5pFLb2uOCbGnlH0bC4iBtm5A,13
8
- FlowAnalyzer-0.2.8.dist-info/RECORD,,