예제 #1
0
    def __init__(self, interface, logger, base_configs=None):
        """See base class documentation
        """
        self._base_configs = None
        self._capture_file_path = ""
        self._interface = ""
        self._logger = logger
        self._process = None
        self._temp_capture_file_path = ""

        if interface == "":
            raise sniffer.InvalidDataError("Empty interface provided")
        self._interface = interface
        self._base_configs = base_configs

        try:
            utils.exe_cmd("ifconfig", self._interface, "down")
            utils.exe_cmd("iwconfig", self._interface, "mode", "monitor")
            utils.exe_cmd("ifconfig", self._interface, "up")
        except Exception as err:
            raise sniffer.ExecutionError(err)
예제 #2
0
    def __init__(self, interface, logger, base_configs=None):
        """See base class documentation
        """
        self._base_configs = None
        self._capture_file_path = ""
        self._interface = ""
        self._logger = logger
        self._process = None
        self._temp_capture_file_path = ""

        if interface == "":
            raise sniffer.InvalidDataError("Empty interface provided")
        self._interface = interface
        self._base_configs = base_configs

        try:
            subprocess.check_call(['ifconfig', self._interface, 'down'])
            subprocess.check_call(
                ['iwconfig', self._interface, 'mode', 'monitor'])
            subprocess.check_call(['ifconfig', self._interface, 'up'])
        except Exception as err:
            raise sniffer.ExecutionError(err)