capture.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:wifimitm 作者: mvondracek 项目源码 文件源码
def __init__(self, interface: WirelessInterface, capture_file: Optional[BinaryIO] = None):
        """
        :type capture_file: Optional[BinaryIO]
        :param capture_file: file for writing packet capture

        :type interface: WirelessInterface
        :param interface: wireless interface for capture
        """
        self.state = self.State.STARTED
        self.flags = self.__initial_flags()
        self.stats = self.__initial_stats()

        self.interface = interface  # type: WirelessInterface
        self.capture_file = capture_file
        # If `capture_file` was None, dumpcap will create capture file in /tmp. `self.tmp_capture_file_path` is set
        # during `self.update`.
        self.tmp_capture_file_path = None

        cmd = ['dumpcap',
               '-i', self.interface.name]
        stdout = None
        if self.capture_file:
            # If `capture_file` was provided, set dumpcap to write raw packet data to stdout...
            cmd.append('-w')
            cmd.append('-')
            # ... and redirect dumpcap's stdout to provided `capture_file`.
            stdout = self.capture_file
        super().__init__(cmd, stdout=stdout)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号