cli/streamingphish/streamingphish/trainer.py
def _load_training_data(self):
        """
        Load the phishing domains and benign domains from disk into python lists.

        Args:
            None, all artifacts available as class attributes.

        Returns:
            training_data (dictionary):  Keys are domain names and values
                are labels (0 = benign, 1 = phishing).
        """
        training_data = OrderedDict()

        # Load domains from all the text files in the benign folder.
        tqdm.tqdm.write("[*] Loading benign data.")
        benign_path = self._phish_config.config['data']['benign_dir']
        for root, dirs, files in os.walk(benign_path):
            files = [f for f in files if not f[0] == "."]
            for f in files:
                with open(os.path.join(root, f)) as infile:
                    for item in infile.readlines():
                        # Safeguard to prevent adding duplicate data to training set.
                        if item not in training_data:
                            training_data[item.strip('\n')] = 0

        # Load domains from all the text files in the malicious folder
        # (this is our 'positive' class).
        tqdm.tqdm.write("[*] Loading malicious data.")
        malicious_path = self._phish_config.config['data']['malicious_dir']
        for root, dirs, files in os.walk(malicious_path):
            files = [f for f in files if not f[0] == "."]
            for f in files:
                with open(os.path.join(root, f)) as infile:
                    for item in infile.readlines():
                        # Safeguard to prevent adding duplicate data to training set.
                        if item not in training_data:
                            training_data[item.strip('\n')] = 1

        tqdm.tqdm.write("[+] Completed loading training data.")
        return training_data

        Load the phishing domains and benign domains from disk into python lists.

        Args:
            None, all artifacts available as class attributes.

        Returns:
            training_data (dictionary):  Keys are domain names and values
                are labels (0 = benign, 1 = phishing).
        
Load the phishing domains and benign domains from disk into python lists.
Args:
None, all artifacts available as class attributes.

training_data (dictionary):  Keys are domain names and values
are labels (0 = benign, 1 = phishing).
Load the phishing domains and benign domains from disk into python lists . Args : None all artifacts available as class attributes . training_data ( dictionary ) : Keys are domain names and values are labels ( 0 = benign 1 = phishing ) .
def _load_training_data(self):
        training_data = OrderedDict()
        tqdm.tqdm.write("[*] Loading benign data.")
        benign_path = self._phish_config.config['data']['benign_dir']
        for root, dirs, files in os.walk(benign_path):
            files = [f for f in files if not f[0] == "."]
            for f in files:
                with open(os.path.join(root, f)) as infile:
                    for item in infile.readlines():
                        if item not in training_data:
                            training_data[item.strip('\n')] = 0
        tqdm.tqdm.write("[*] Loading malicious data.")
        malicious_path = self._phish_config.config['data']['malicious_dir']
        for root, dirs, files in os.walk(malicious_path):
            files = [f for f in files if not f[0] == "."]
            for f in files:
                with open(os.path.join(root, f)) as infile:
                    for item in infile.readlines():
                        if item not in training_data:
                            training_data[item.strip('\n')] = 1
        tqdm.tqdm.write("[+] Completed loading training data.")
        return training_data
def _load_training_data ( self ) : training_data = OrderedDict ( ) tqdm . tqdm . write ( "[*] Loading benign data." ) benign_path = self . _phish_config . config [ 'data' ] [ 'benign_dir' ] for root , dirs , files in os . walk ( benign_path ) : files = [ f for f in files if not f [ 0 ] == "." ] for f in files : with open ( os . path . join ( root , f ) ) as infile : for item in infile . readlines ( ) : if item not in training_data : training_data [ item . strip ( '\n' ) ] = 0 tqdm . tqdm . write ( "[*] Loading malicious data." ) malicious_path = self . _phish_config . config [ 'data' ] [ 'malicious_dir' ] for root , dirs , files in os . walk ( malicious_path ) : files = [ f for f in files if not f [ 0 ] == "." ] for f in files : with open ( os . path . join ( root , f ) ) as infile : for item in infile . readlines ( ) : if item not in training_data : training_data [ item . strip ( '\n' ) ] = 1 tqdm . tqdm . write ( "[+] Completed loading training data." ) return training_data
Load the phishing domains and benign domains from disk into python lists.
Load the phishing domains and benign domains from disk into python lists .
"""
        Load the phishing domains and benign domains from disk into python lists.

        Args:
            None, all artifacts available as class attributes.

        Returns:
            training_data (dictionary):  Keys are domain names and values
                are labels (0 = benign, 1 = phishing).
        """ # Load domains from all the text files in the benign folder. # Safeguard to prevent adding duplicate data to training set. # Load domains from all the text files in the malicious folder # (this is our 'positive' class). # Safeguard to prevent adding duplicate data to training set.
self