| local http_status = {} |
| function p_http_status(pkt_length, pinfo, treeitem) |
| local status = tostring(treeitem:get_child_by_name("Status Code").value) |
| http_status[status] = (http_status[status] or 0) + 1 |
| end |
| function http_status_init() |
| register_postdissector(p_http_status) |
| end |
| function http_status_draw() |
| local file = io.open("http_status.csv", "w") |
| for k, v in pairs(http_status) do |
| file:write(k .. "," .. v .. "\n") |
| end |
| file:close() |
| end |
| import pyshark |
| cap = pyshark.FileCapture('traffic.pcap', display_filter='http.request') |
| status_codes = {} |
| for pkt in cap: |
| if 'http.response.code' in pkt: |
| code = pkt.http.response_code |
| status_codes[code] = status_codes.get(code, 0) + 1 |
| print(status_codes) # 輸出:{'200': 150, '404': 5} |
| 歡迎光臨 電子工程網 (http://www.4huy16.com/) | Powered by Discuz! X3.4 |