@@ -9,8 +9,8 @@ def __init__(self, pcap=None, list_of_packets=None, policy='first_ip', window_si
99 self .filter = filter_ip
1010 self .number_of_ip = number_of_ip
1111 self .list_of_packets = list_of_packets
12- assert self .get_number_of_ip () == 1 , "La classe non e' ancora implementata per riconoscere piu' attacanti "
13- assert self .get_window_size () > 0 , "Dimensioni della finestra non valide "
12+ assert self .get_number_of_ip () == 1 , "Multiple attackers are not supported (yet) "
13+ assert self .get_window_size () > 0 , "Invalid window size (it must be >=1) "
1414
1515 def compute_attacker (self ):
1616 policy = self .get_policy ()
@@ -19,18 +19,18 @@ def compute_attacker(self):
1919 elif (policy == "max_in_window" ):
2020 ip = self .max_in_window_policy ()
2121 else :
22- print ("Selezionare una policy." )
22+ print ("Please select a policy." )
2323 return ip
2424
2525 def first_ip_policy (self ):
26- assert self .list_of_packets is not None or self .pcap is not None , "Assegnare un pcap o una lista di pacchetti "
27- print ("\n " + "Calcolo attaccante " + "\n " )
26+ assert self .list_of_packets is not None or self .pcap is not None , "No PCAP or packets list has been provided "
27+ print ("\n " + "Processing attacker information " + "\n " )
2828 if (self .get_list_of_packets () is not None ):
2929 pkts = self .get_list_of_packets ()
3030 elif (self .get_pcap () is not None ):
3131 pkts = rdpcap (self .get_pcap ())
3232 else :
33- print ("Assegnare un pcap o una lista di pacchetti ." )
33+ print ("No PCAP or packets list has been provided ." )
3434 return []
3535 ip_list = []
3636 for i in range (0 , len (pkts ) - 1 ):
@@ -45,14 +45,14 @@ def first_ip_policy(self):
4545 return ip_list
4646
4747 def max_in_window_policy (self ):
48- assert self .list_of_packets is not None or self .pcap is not None , "Assegnare un pcap o una lista di pacchetti "
49- print ("\n " + "Calcolo attaccante " + "\n " )
48+ assert self .list_of_packets is not None or self .pcap is not None , "No PCAP or packets list has been provided "
49+ print ("\n " + "Processing attacker information " + "\n " )
5050 if (self .get_list_of_packets () is not None ):
5151 pkts = self .get_list_of_packets ()
5252 elif (self .get_pcap () is not None ):
5353 pkts = rdpcap (self .get_pcap ())
5454 else :
55- print ("Assegnare un pcap o una lista di pacchetti ." )
55+ print ("No PCAP or packets list has been provided ." )
5656 return []
5757 ip_dict = {}
5858 if (len (pkts ) >= self .get_window_size ()):
@@ -71,7 +71,7 @@ def max_in_window_policy(self):
7171 else :
7272 pass
7373 else :
74- print ("Fornita una finestra troppo piccola. " )
74+ print ("Window size is too small " )
7575 return []
7676
7777 def find_max_between_IP (ip_dict ):
@@ -103,7 +103,7 @@ def get_filter(self):
103103 return self .filter
104104
105105 def add_ip_to_filter (self , list_of_ip ):
106- assert isinstance (list_of_ip , list ), "Inserire gli ip in una lista. "
106+ assert isinstance (list_of_ip , list ), "IPs must be added to the filter in the form of a list "
107107 for ip in list_of_ip :
108108 self .filter .append (ip )
109109
0 commit comments