X-Git-Url: http://plrg.eecs.uci.edu/git/?p=pingpong.git;a=blobdiff_plain;f=extract_from_tshark.py;h=5704a975bbf891678e75533a2d435b52a597969d;hp=7c1270fda73c82dc19aa4aeec704c532255cfa3d;hb=d4cc1378fd51bb35671f962a182bddf978201dca;hpb=f3b9bcd6ed5b269ac1c26d98424d2bb13a89ccb0 diff --git a/extract_from_tshark.py b/extract_from_tshark.py index 7c1270f..5704a97 100644 --- a/extract_from_tshark.py +++ b/extract_from_tshark.py @@ -36,6 +36,11 @@ json_key_frame_comment = json_key_frame + ".comment" json_key_frame_ts = json_key_frame + ".time_epoch" +JSON_KEY_ETH = "eth" +JSON_KEY_ETH_SRC = "eth.src" +JSON_KEY_ETH_DST = "eth.dst" + + def make_unique(key, dct): counter = 0 unique_key = key @@ -103,6 +108,9 @@ def change_file(fpath): # JV: Also include src so we can see what device initiates the traffic new_packet["src_ip"] = layers[json_key_ip][json_key_ip + ".src"] new_packet["src_port"] = int(layers[json_key_tcp][json_key_tcp + ".srcport"]) + #JV: Also include eth soure/destination info so that we can map traffic to physical device using MAC + new_packet[JSON_KEY_ETH_SRC] = layers[JSON_KEY_ETH][JSON_KEY_ETH_SRC] + new_packet[JSON_KEY_ETH_DST] = layers[JSON_KEY_ETH][JSON_KEY_ETH_DST] # Go through all HTTP fields and extract the ones that are needed http_data = layers[json_key_http]