def validate(cls, value):
        mac_utils = MacAddressUtils()
        if mac_utils.is_valid_mac(value) is False:
            raise ValueError(
                'Invalid mac address format: expected format : or - separated, provided: {}'
                .format(value))

        return value
 def __init__(self, config: ConfigurationData, static_data: StaticData = None):
     self.config = config
     self.mac_utils = MacAddressUtils()
     self.static_data = static_data or StaticData()
 def __init__(self, config: ConfigurationData):
     self.config = config
     self.ip_utils = IpAddrUtils()
     self.mac_utils = MacAddressUtils()
 def __init__(self, *args, **kwargs):
     super(MacUtilsTests, self).__init__(*args, **kwargs)
     self.mac_utils = MacAddressUtils()
示例#5
0
 def __init__(self, *args, **kwargs):
     super(BasePacketParserTests, self).__init__(*args, **kwargs)
     self.ip_utils = IpAddrUtils()
     self.mac_utils = MacAddressUtils()
     self.config = CONFIGURATION_OBJ
     self.static_data = StaticData()
示例#6
0
 def __init__(self, config: ConfigurationData, static_data: StaticData = None):
     self.mac_utils = MacAddressUtils()
     self.ip_utils = IpAddrUtils()
     self.ether_type_data = StaticData.load_ether_types_data()
     self.config = config
     self.static_data = static_data or StaticData()
from pathlib import Path  # noqa
import os
import sys

sys.path.append(os.getcwd())

# pylint: disable=wrong-import-position
from core.lib.mac_utils import MacAddressUtils  # noqa
from core.lib.common import print_json  # noqa
from core.pandas_utils.split_csv_data import extract_data_as_separate_csv  # noqa

if __name__ == '__main__':
    scripts_dir_path = Path(os.path.abspath(__file__)).parent
    project_dir_path = scripts_dir_path.parent
    input_file_path = project_dir_path / 'fixtures/results/results.csv'
    result_dir_path = project_dir_path / 'fixtures/results/splitted/'
    summary = extract_data_as_separate_csv(
        file_path=input_file_path,
        result_folder=result_dir_path,
        filter_columns=['src_mac', 'dst_mac'],
        sort_by_columns=['timestamp'],
        transform_function=MacAddressUtils().int_to_mac)
    print_json(summary)
示例#8
0
 def __init__(self, *args, **kwargs):
     super(EthernetFrameParserTests, self).__init__(*args, **kwargs)
     self.eth_frame_parser = EthernetFrameParser(config=self.config)
     self.mac_utils = MacAddressUtils()
 def __init__(self, *args, **kwargs):
     super(DpktUtilsTest, self).__init__(*args, **kwargs)
     self.dpkt_utils = DpktUtils(config=CONFIGURATION_OBJ)
     self.mac_utils = MacAddressUtils()