def __init__(self, filename, path, option="Tor"): self.directory = os.path.join(path, "Report") if not os.path.exists(self.directory): os.makedirs(self.directory) self.filename = os.path.join(self.directory, filename+"_"+option) self.styles = { 'graph': { 'label': 'PcapGraph', 'fontsize': '16', 'fontcolor': 'black', 'bgcolor': 'grey', 'rankdir': 'BT', 'dpi':'600' }, 'nodes': { 'fontname': 'Helvetica', 'shape': 'circle', 'fontcolor': 'black', 'color': ' black', 'style': 'filled', 'fillcolor': 'yellow', } } self.sessions = memory.packet_db.keys() device_details_fetch.fetchDeviceDetails("ieee").fetch_info() if option == "Malicious" or option == "All": self.mal_identify = malicious_traffic_identifier.maliciousTrafficIdentifier() if option == "Tor" or option == "All": self.tor_identify = tor_traffic_handle.torTrafficHandle().tor_traffic_detection() self.draw_graph(option)
def __init__(self, filename, path, option="Tor", to_ip="All", from_ip="All"): self.directory = os.path.join(path, "Report") if not os.path.exists(self.directory): os.makedirs(self.directory) options = option + "_" + to_ip.replace(".", "-") + "_" + from_ip.replace(".", "-") self.filename = os.path.join(self.directory, filename+"_"+options) self.styles = { 'graph': { 'label': 'PcapGraph', 'fontsize': '16', 'fontcolor': 'black', 'bgcolor': 'grey', 'rankdir': 'LR', # BT 'dpi':'300', 'size': '10, 10', 'overlap': 'scale' }, 'nodes': { 'fontname': 'Helvetica', 'shape': 'circle', 'fontcolor': 'black', 'color': ' black', 'style': 'filled', 'fillcolor': 'yellow', 'fixedsize': 'true', 'width': '3', 'height': '3' } } self.sessions = memory.packet_db.keys() #device_details_fetch.fetchDeviceDetails("ieee").fetch_info() if option == "Malicious" or option == "All": self.mal_identify = malicious_traffic_identifier.maliciousTrafficIdentifier() if option == "Tor" or option == "All": self.tor_identify = tor_traffic_handle.torTrafficHandle().tor_traffic_detection() self.draw_graph(option, to_ip, from_ip)
def test_malicious_traffic_identifier(): pcap_reader.PcapEngine(sys.path[0]+'examples/test.pcap', "scapy") communication_details_fetch.trafficDetailsFetch("sock") malicious_traffic_identifier.maliciousTrafficIdentifier() if memory.possible_mal_traffic: assert True