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


Python socket.SIO_RCVALL屬性代碼示例

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


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

示例1: wait_for_connection

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def wait_for_connection(self):
        import socket
        import sys
        # Create a TCP/IP socket
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.server_address = ('localhost', self.port)
        #print('starting up on %s port %s' % self.server_address, file=sys.stderr)
        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        #self.sock.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
        self.sock.bind(self.server_address)
        self.sock.listen(10)
        #self.sock.setblocking(0)
        while self.closed is False:
            try:
                connection, client_address = self.sock.accept()
                if self.debug:
                    print("Accepted connection.")
                thread.start_new_thread(self.serve,(connection, client_address))
            except Exception as e:
                print(e)
                raise
        self.sock.close()
        self.closed = True 
開發者ID:jahuth,項目名稱:convis,代碼行數:25,代碼來源:png.py

示例2: close

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def close(self):
        if not self.closed and self.promisc:
            self.ins.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)
        super(L3WinSocket, self).close() 
開發者ID:secdev,項目名稱:scapy,代碼行數:6,代碼來源:native.py

示例3: main

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def main(argv):
    global BIND

    if len(argv) < 3:
        print('Usage: ./udp-scan.py <bind-ip> <target-subnet>')
        sys.exit(1)

    bindAddr = sys.argv[1]
    subnet = sys.argv[2]

    sockProto = None
    if os.name == 'nt':
        sockProto = socket.IPPROTO_IP
    else:
        sockProto = socket.IPPROTO_ICMP

    sniffer = socket.socket(socket.AF_INET, socket.SOCK_RAW, sockProto)
    if DEBUG: print('[.] Binding on {}:0'.format(bindAddr))
    sniffer.bind((bindAddr, 0))

    # Include IP headers in the capture
    sniffer.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)

    # In Windows, set up promiscous mode.
    if os.name == 'nt':
        try:
            sniffer.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
        except socket.error, e:
            print('[!] Could not set promiscous mode ON: "{}"'.format(str(e)))

    # Sending thread 
開發者ID:StevenDias33,項目名稱:Offensive-Security-Certified-Professional,代碼行數:33,代碼來源:host-scanner-via-udp.py

示例4: listen_raw

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def listen_raw():
    # http://stackoverflow.com/questions/1117958/how-do-i-use-raw-socket-in-python
    HOST = socket.gethostbyname(socket.gethostname())
    s = socket.socket(socket.AF_INET, socket.SOCK_RAW)
    # s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    # s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
    s.bind((HOST, PORT))
    # s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)
    while True:
        x = s.recvfrom(2048)
        print(x)
    s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)


# def main(args):
#     cmd = '{} -m src.udp.udp_listener -f start_udp_listener -b {}'.format(args.python_cmd, args.buffer_size)
#     out_queue, in_queue = mu.run_command_in_new_thread(
#         cmd, read_stderr=False, read_stdin=False, stdout_func=reading_from_rendering_stdout_func)
#
#
#     while True:
#         stdout_print('listening to stdin!')
#         line = sys.stdin.read()
#         if line != '':
#             stdout_print('UDP listener: received "{}"'.format(line))
#             if line == 'stop':
#                 stdout_print('Stop listening')
#                 udp_listening = False
#
#     # except:
#     #     print(traceback.format_exc())
#
# 
開發者ID:pelednoam,項目名稱:mmvt,代碼行數:36,代碼來源:udp_listener.py

示例5: open

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def open(self):
        try:
            if CONFIG["GLOBALS"]["PLATFORM"] == "Windows":
                from socket import SIO_RCVALL, RCVALL_ON
                self.s = socket(AF_INET, SOCK_RAW, IPPROTO_IP)
                host = gethostbyname(gethostname())
                self.s.bind((host, 0))
                # enable promisc
                self.s.ioctl(SIO_RCVALL, RCVALL_ON)
            else:
                self.s = socket(PF_PACKET, SOCK_RAW, self.ETH_P_ALL)
                # set interface
                self.s.bind((self.interface, self.ETH_P_ALL))
                # enable promisc
                import fcntl
                self.ifr = Ifreq()
                ifname = create_string_buffer(self.interface.encode(CONFIG["GLOBALS"]["CODEC"]))
                self.ifr.ifr_ifrn = ifname.value
                fcntl.ioctl(self.s.fileno(), self.SIOCGIFFLAGS, self.ifr)  # G for Get
                self.ifr.ifr_flags |= self.IFF_PROMISC
                fcntl.ioctl(self.s.fileno(), self.SIOCSIFFLAGS, self.ifr)  # S for Set
            self.maxsize = 1500
        except Exception as e:
            raise SessionException("session/eth: cant open session: %s" % e)
        else:
            self.is_open = True 
開發者ID:ernw,項目名稱:dizzy,代碼行數:28,代碼來源:eth.py

示例6: close

# 需要導入模塊: import socket [as 別名]
# 或者: from socket import SIO_RCVALL [as 別名]
def close(self):
        if CONFIG["GLOBALS"]["PLATFORM"] == "Windows":
            self.s.ioctl(SIO_RCVALL, RCVALL_OFF)
        else:
            self.ifr.ifr_flags &= ~self.IFF_PROMISC
            import fcntl
            fcntl.ioctl(self.s.fileno(), self.SIOCSIFFLAGS, self.ifr)
        self.is_open = False 
開發者ID:ernw,項目名稱:dizzy,代碼行數:10,代碼來源:eth.py


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