File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 2626
2727
2828def _check_tcpdump ():
29+ """
30+ Return True if the tcpdump command can be started
31+ """
2932 with open (os .devnull , 'wb' ) as devnull :
30- proc = subprocess .Popen ([conf .prog .tcpdump , "--version" ],
31- stdout = devnull , stderr = subprocess .STDOUT )
33+ try :
34+ proc = subprocess .Popen ([conf .prog .tcpdump , "--version" ],
35+ stdout = devnull , stderr = subprocess .STDOUT )
36+ except OSError :
37+ return False
3238 return proc .wait () == 0
3339
3440
Original file line number Diff line number Diff line change @@ -344,3 +344,12 @@ if six.PY3:
344344 l3ps.send(IP(dst="8.8.8.8")/ICMP())
345345 return True
346346 assert test_L3PacketSocket_sendto_python3()
347+
348+ = Test _check_tcpdump()
349+
350+ from scapy.arch.common import _check_tcpdump
351+
352+ saved_conf_prog_tcpdump = conf.prog.tcpdump
353+ conf.prog.tcpdump = "does_not_exist"
354+ assert _check_tcpdump() == False
355+ conf.prog.tcpdump = saved_conf_prog_tcpdump
You can’t perform that action at this time.
0 commit comments