How can I call the send function without getting output?

CBaker picture CBaker · Mar 13, 2013 · Viewed 17.2k times · Source

Does anyone know how to send a packet using scapy and not receive any output?

This is the command:

send(packet, iface="eth0") 

This is the output

Sent 1 packets.

I'm trying to get it not to print the packet count line at all.

Answer

crayzeewulf picture crayzeewulf · Mar 13, 2013

Try the verbose parameter. Scapy documentation says that verbose should "make the function totally silent when 0". Both False and 0 appear to work. For example:

>>> send(IP(dst="1.2.3.4")/ICMP())
.
Sent 1 packets.
>>> send(IP(dst="1.2.3.4")/ICMP(), verbose=0)
>>> send(IP(dst="1.2.3.4")/ICMP(), verbose=False)
>>> 

You can get little more information using help():

>>> help(send)
Help on function send in module scapy.sendrecv:

send(x, inter=0, loop=0, count=None, verbose=None, realtime=None, *args, **kargs)
    Send packets at layer 3
    send(packets, [inter=0], [loop=0], [verbose=conf.verb]) -> None
(END)