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


Python arch.get_if_raw_hwaddr方法代碼示例

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


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

示例1: __attrs_post_init__

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def __attrs_post_init__(self):
        """Initializes attributes after attrs __init__.

        These attributes do not change during the life of the object.

        """
        logger.debug('Creating new DHCPCAP obj.')
        if self.iface is None:
            self.iface = conf.iface
        if self.client_mac is None:
            _, client_mac = get_if_raw_hwaddr(self.iface)
            self.client_mac = str2mac(client_mac)
        if self.prl is None:
            self.prl = PRL
        if self.xid is None:
            self.xid = gen_xid()
        logger.debug('Modifying Lease obj, setting iface.')
        self.lease.interface = self.iface 
開發者ID:juga0,項目名稱:dhcpcanon,代碼行數:20,代碼來源:dhcpcap.py

示例2: reset

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def reset(self, iface=None, client_mac=None, xid=None, scriptfile=None):
        """Reset object attributes when state is INIT."""
        logger.debug('Reseting attributes.')
        if iface is None:
            iface = conf.iface
        if client_mac is None:
            # scapy for python 3 returns byte, not tuple
            tempmac = get_if_raw_hwaddr(iface)
            if isinstance(tempmac, tuple) and len(tempmac) == 2:
                mac = tempmac[1]
            else:
                mac = tempmac
            client_mac = str2mac(mac)
        self.client = DHCPCAP(iface=iface, client_mac=client_mac, xid=xid)
        if scriptfile is not None:
            self.script = ClientScript(scriptfile)
        else:
            self.script = None
        self.time_sent_request = None
        self.discover_attempts = 0
        self.request_attempts = 0
        self.current_state = STATE_PREINIT
        self.offers = list() 
開發者ID:juga0,項目名稱:dhcpcanon,代碼行數:25,代碼來源:dhcpcapfsm.py

示例3: dhcp_request

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def dhcp_request(iface=None,**kargs):
    if conf.checkIPaddr != 0:
        warning("conf.checkIPaddr is not 0, I may not be able to match the answer")
    if iface is None:
        iface = conf.iface
    fam,hw = get_if_raw_hwaddr(iface)
    return srp1(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)
                 /BOOTP(chaddr=hw)/DHCP(options=[("message-type","discover"),"end"]),iface=iface,**kargs) 
開發者ID:medbenali,項目名稱:CyberScan,代碼行數:10,代碼來源:dhcp.py

示例4: if_hwaddr

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def if_hwaddr(iff):
    return str2mac(get_if_raw_hwaddr(iff)[1]) 
開發者ID:rpp0,項目名稱:scapy-fakeap,代碼行數:4,代碼來源:rpyutils.py

示例5: dhcp_request

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def dhcp_request(iface=None, **kargs):
    """Send a DHCP discover request and return the answer"""
    if conf.checkIPaddr:
        warning(
            "conf.checkIPaddr is enabled, may not be able to match the answer"
        )
    if iface is None:
        iface = conf.iface
    fam, hw = get_if_raw_hwaddr(iface)
    return srp1(Ether(dst="ff:ff:ff:ff:ff:ff") / IP(src="0.0.0.0", dst="255.255.255.255") / UDP(sport=68, dport=67) /  # noqa: E501
                BOOTP(chaddr=hw) / DHCP(options=[("message-type", "discover"), "end"]), iface=iface, **kargs)  # noqa: E501 
開發者ID:secdev,項目名稱:scapy,代碼行數:13,代碼來源:dhcp.py

示例6: get_my_addr

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def get_my_addr(self, iface):
		family, hwaddr = get_if_raw_hwaddr(iface)
		hwaddr = binascii.hexlify(hwaddr)
		hwaddr = ':'.join(hwaddr[i:i+2] for i in range(0,12,2))
		return hwaddr 
開發者ID:hash3liZer,項目名稱:WiFiBroot,代碼行數:7,代碼來源:pmkid.py

示例7: dhcp_request

# 需要導入模塊: from scapy import arch [as 別名]
# 或者: from scapy.arch import get_if_raw_hwaddr [as 別名]
def dhcp_request(iface=None,**kargs):
    if conf.checkIPaddr != 0:
        warning("conf.checkIPaddr is not 0, I may not be able to match the answer")
    if iface is None:
        iface = conf.iface
    hw = get_if_raw_hwaddr(iface)
    return srp1(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)
                 /BOOTP(chaddr=hw)/DHCP(options=[("message-type","discover"),"end"]),iface=iface,**kargs) 
開發者ID:entynetproject,項目名稱:arissploit,代碼行數:10,代碼來源:dhcp.py


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