當前位置: 首頁>>代碼示例>>Python>>正文


Python conf.promisc方法代碼示例

本文整理匯總了Python中scapy.config.conf.promisc方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.promisc方法的具體用法?Python conf.promisc怎麽用?Python conf.promisc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scapy.config.conf的用法示例。


在下文中一共展示了conf.promisc方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import promisc [as 別名]
def __init__(self, type = ETH_P_ALL, filter=None, promisc=None, iface=None, nofilter=0):
        self.type = type
        self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
        self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 0)
        _flush_fd(self.ins)
        if iface:
            self.ins.bind((iface, type))
        if not nofilter:
            if conf.except_filter:
                if filter:
                    filter = "(%s) and not (%s)" % (filter, conf.except_filter)
                else:
                    filter = "not (%s)" % conf.except_filter
            if filter is not None:
                attach_filter(self.ins, filter)
        self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 2**30)
        self.outs = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
        self.outs.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2**30)
        if promisc is None:
            promisc = conf.promisc
        self.promisc = promisc
        if self.promisc:
            if iface is None:
                self.iff = get_if_list()
            else:
                if iface.__class__ is list:
                    self.iff = iface
                else:
                    self.iff = [iface]
            for i in self.iff:
                set_promisc(self.ins, i) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:33,代碼來源:linux.py

示例2: close

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import promisc [as 別名]
def close(self):
        if self.closed:
            return
        self.closed=1
        if self.promisc:
            for i in self.iff:
                set_promisc(self.ins, i, 0)
        SuperSocket.close(self) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:10,代碼來源:linux.py

示例3: close

# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import promisc [as 別名]
def close(self):
        if self.promisc:
            for i in self.iff:
                set_promisc(self.ins, i, 0)
        SuperSocket.close(self) 
開發者ID:gpwclark,項目名稱:dash-hack,代碼行數:7,代碼來源:linux.py


注:本文中的scapy.config.conf.promisc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。