2013-10-24 3 views

ответ

5

Функция sniff() в Scapy имеет параметр таймаута. Вы можете предоставить таймаут в секундах.

Другие варианты опций: печать sniff.__doc__.

[email protected]:~$ scapy 
>>> print sniff.__doc__ 
Sniff packets 
sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + 
     L2ListenSocket args) -> list of packets 

    count: number of packets to capture. 0 means infinity 
    store: wether to store sniffed packets or discard them 
    prn: function to apply to each packet. If something is returned, 
     it is displayed. Ex: 
     ex: prn = lambda x: x.summary() 
lfilter: python function applied to each packet to determine 
     if further action may be done 
     ex: lfilter = lambda x: x.haslayer(Padding) 
offline: pcap file to read packets from, instead of sniffing them 
timeout: stop sniffing after a given time (default: None) 
L2socket: use the provided L2socket 
opened_socket: provide an object ready to use .recv() on 
stop_filter: python function applied to each packet to determine 
      if we have to stop the capture after this packet 
      ex: stop_filter = lambda x: x.haslayer(TCP) 
+0

Да, я знаю о таймауте, но я спрашивал себя, есть ли способ, чтобы он блокировался, когда ничего не происходит после его собственного запрограммированного времени. – yoyo

+0

Насколько я знаю, тайм-аут - это ваш единственный вариант. Все остальное требует получения пакета. – RyPeck

+0

Да, я так думаю, после некоторых исследований, спасибо ^^ – yoyo

Смежные вопросы