dev_list = create_device_list(DEVICE_MAC_LIST)
# Traverse every node
# Check that the node is not a smarthome device
- for node in nodes:
+ for node in list(nodes):
neighbors = G[node] #G.neighbors(node)
#print "Neighbors: ", neighbors, "\n"
# Skip if the node is a smarthome device
ip_src = layers[JSON_KEY_IP][JSON_KEY_IP_SRC]
ip_dst = layers[JSON_KEY_IP][JSON_KEY_IP_DST]
# Categorize source and destination IP addresses: local vs. non-local
- ip_re = re.compile(r'\b192.168.[0-9.]+')
+ #ip_re = re.compile(r'\b192.168.[0-9.]+')
+ ip_re = re.compile(r'\b192.168.1.[0-9.]+')
src_is_local = ip_re.search(ip_src)
dst_is_local = ip_re.search(ip_dst)
# Store protocol into the set (source)
# Create an exclusion list
exc_list = create_device_list(EXCLUSION_MAC_LIST)
# First parse the file once, constructing a map that contains information about individual devices' DNS resolutions.
- device_dns_mappings = parser.parse_dns.parse_json_dns(file_path) # "./json/eth1.dump.json"
+ device_dns_mappings = parser.parse_dns.parse_json_dns(file_path)
# Init empty graph
G = nx.DiGraph()
# Mapping from edge to a set of protocols
# Mapping from edge to traffic volume
edge_to_vol = dict()
# Parse file again, this time constructing a graph of device<->server and device<->device communication.
+ i = 0
with open(file_path) as jf:
# Read JSON; data becomes reference to root JSON object (or in our case json array)
data = json.load(jf)