Skip to content

Commit

Permalink
fix mac address confusion with L2 vs L3 routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivas11789 committed May 8, 2019
1 parent 865a5bb commit c10a5e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
8 changes: 6 additions & 2 deletions Source/Module/pcap_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ def analyse_packet_data(self):
# Refer https://github.com/KimiNewt/pyshark/issues/264
#memory.packet_db[source_private_ip]["Payload"].append(packet.get_raw_packet())
else:
memory.packet_db[source_private_ip]["Ethernet"]["src"] = packet["Ether"].src
memory.packet_db[source_private_ip]["Ethernet"]["dst"] = packet["Ether"].dst
if private_source:
memory.packet_db[source_private_ip]["Ethernet"]["src"] = packet["Ether"].src
memory.packet_db[source_private_ip]["Ethernet"]["dst"] = packet["Ether"].dst
else:
memory.packet_db[source_private_ip]["Ethernet"]["src"] = packet["Ether"].dst
memory.packet_db[source_private_ip]["Ethernet"]["dst"] = packet["Ether"].src

if "TCP" in packet:
memory.packet_db[source_private_ip]["Payload"].append(str(packet["TCP"].payload))
Expand Down
21 changes: 14 additions & 7 deletions Source/Module/plot_lan_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if curr_node != destination:
Expand Down Expand Up @@ -174,7 +175,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if port == "80" and curr_node != destination:
Expand Down Expand Up @@ -216,7 +218,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if port == "443" and curr_node != destination:
Expand Down Expand Up @@ -258,7 +261,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""


Expand Down Expand Up @@ -302,7 +306,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if session in memory.possible_mal_traffic and curr_node != destination:
Expand Down Expand Up @@ -342,7 +347,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if protocol == "ICMP" and curr_node != destination:
Expand Down Expand Up @@ -382,7 +388,8 @@ def draw_graph(self,option="All"):
destination = memory.lan_hosts[memory.packet_db[session]["Ethernet"]["dst"]]["node"]
dlabel = ""
else:
destination = map_dst+"\n"+memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination = memory.packet_db[session]["Ethernet"]["dst"].replace(":",".")
destination += "\n"+"PossibleGateway"
dlabel = ""

if port == "53" and curr_node != destination:
Expand Down

0 comments on commit c10a5e3

Please sign in to comment.