scapy  2.3.1
About: scapy is a interactive network packet manipulation program to forge or decode packets of a wide number of protocols (using python as command board).
  Fossies Dox: scapy-2.3.1.zip  ("inofficial" and yet experimental doxygen-generated source code documentation)  

scapy.sendrecv Namespace Reference

Classes

class  debug
 Debug class ##. More...
 

Functions

def sndrcv (pks, pkt, timeout=None, inter=0, verbose=None, chainCC=0, retry=0, multi=0)
 Send / Receive ##. More...
 
def send (x, inter=0, loop=0, count=None, verbose=None, realtime=None, args, kargs)
 
def sendp (x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, args, kargs)
 
def sendpfast (x, pps=None, mbps=None, realtime=None, loop=0, file_cache=False, iface=None)
 
def sr (x, filter=None, iface=None, nofilter=0, args, kargs)
 
def sr1 (x, filter=None, iface=None, nofilter=0, args, kargs)
 
def srp (x, iface=None, iface_hint=None, filter=None, nofilter=0, type=ETH_P_ALL, args, kargs)
 
def srp1 (args, kargs)
 
def srloop (pkts, args, kargs)
 
def srploop (pkts, args, kargs)
 
def sndrcvflood (pks, pkt, prn=lambda(s, r)
 
def srflood (x, filter=None, iface=None, nofilter=None, args, kargs)
 
def srpflood (x, filter=None, iface=None, iface_hint=None, nofilter=None, args, kargs)
 
def sniff (count=0, store=1, offline=None, prn=None, lfilter=None, L2socket=None, timeout=None, opened_socket=None, stop_filter=None, arg, karg)
 
def bridge_and_sniff (if1, if2, count=0, store=1, offline=None, prn=None, lfilter=None, L2socket=None, timeout=None, stop_filter=None, args, kargs)
 
def tshark (args, kargs)
 

Function Documentation

def scapy.sendrecv.bridge_and_sniff (   if1,
  if2,
  count = 0,
  store = 1,
  offline = None,
  prn = None,
  lfilter = None,
  L2socket = None,
  timeout = None,
  stop_filter = None,
  args,
  kargs 
)
Forward traffic between two interfaces and sniff packets exchanged
bridge_and_sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2Socket 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)
timeout: stop sniffing after a given time (default: None)
L2socket: use the provided L2socket
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)

Definition at line 602 of file sendrecv.py.

References scapy.sendrecv.send().

Referenced by scapy.sendrecv.sniff().

def 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

Definition at line 248 of file sendrecv.py.

Referenced by scapy.sendrecv.bridge_and_sniff().

def scapy.sendrecv.sendp (   x,
  inter = 0,
  loop = 0,
  iface = None,
  iface_hint = None,
  count = None,
  verbose = None,
  realtime = None,
  args,
  kargs 
)
Send packets at layer 2
sendp(packets, [inter=0], [loop=0], [verbose=conf.verb]) -> None

Definition at line 254 of file sendrecv.py.

Referenced by scapy.layers.dot11.airpwn(), scapy.layers.l2.arpcachepoison(), scapy.contrib.dtp.negotiate_trunk(), and scapy.layers.dot11.WiFi_am.send_reply().

def scapy.sendrecv.sendpfast (   x,
  pps = None,
  mbps = None,
  realtime = None,
  loop = 0,
  file_cache = False,
  iface = None 
)
Send packets at layer 2 using tcpreplay for performance
pps:  packets per second
mpbs: MBits per second
realtime: use packet's timestamp, bending time with realtime value
loop: number of times to process the packet list
file_cache: cache packets in RAM instead of reading from disk at each iteration
iface: output interface 

Definition at line 262 of file sendrecv.py.

References scapy.utils.get_temp_file(), and scapy.utils.wrpcap().

def scapy.sendrecv.sndrcv (   pks,
  pkt,
  timeout = None,
  inter = 0,
  verbose = None,
  chainCC = 0,
  retry = 0,
  multi = 0 
)

Send / Receive ##.

Definition at line 38 of file sendrecv.py.

References scapy.layers.inet6.type, and scapy.crypto.cert.warning().

Referenced by scapy.sendrecv.sr(), scapy.sendrecv.sr1(), and scapy.sendrecv.srp().

def scapy.sendrecv.sndrcvflood (   pks,
  pkt,
  prn = lambda (s,r 
)

Definition at line 445 of file sendrecv.py.

Referenced by scapy.sendrecv.srflood(), and scapy.sendrecv.srpflood().

def scapy.sendrecv.sniff (   count = 0,
  store = 1,
  offline = None,
  prn = None,
  lfilter = None,
  L2socket = None,
  timeout = None,
  opened_socket = None,
  stop_filter = None,
  arg,
  karg 
)
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)

Definition at line 533 of file sendrecv.py.

References scapy.sendrecv.bridge_and_sniff().

Referenced by scapy.sendrecv.srpflood(), and scapy.sendrecv.tshark().

def scapy.sendrecv.sr (   x,
  filter = None,
  iface = None,
  nofilter = 0,
  args,
  kargs 
)
Send and receive packets at layer 3
nofilter: put 1 to avoid use of bpf filters
retry:    if positive, how many times to resend unanswered packets
      if negative, how many times to retry when no more packets are answered
timeout:  how much time to wait after the last packet has been sent
verbose:  set verbosity level
multi:    whether to accept multiple answers for the same stimulus
filter:   provide a BPF filter
iface:    listen answers only on the given interface

Definition at line 304 of file sendrecv.py.

References scapy.sendrecv.sndrcv().

Referenced by scapy.layers.isakmp.ikescan(), scapy.contrib.ikev2.ikev2scan(), scapy.modules.nmap.nmap_sig(), scapy.modules.queso.queso_sig(), scapy.layers.inet.report_ports(), scapy.layers.inet.traceroute(), and scapy.layers.inet6.traceroute6().

def scapy.sendrecv.sr1 (   x,
  filter = None,
  iface = None,
  nofilter = 0,
  args,
  kargs 
)
Send packets at layer 3 and return only the first answer
nofilter: put 1 to avoid use of bpf filters
retry:    if positive, how many times to resend unanswered packets
      if negative, how many times to retry when no more packets are answered
timeout:  how much time to wait after the last packet has been sent
verbose:  set verbosity level
multi:    whether to accept multiple answers for the same stimulus
filter:   provide a BPF filter
iface:    listen answers only on the given interface

Definition at line 322 of file sendrecv.py.

References scapy.sendrecv.sndrcv().

Referenced by scapy.layers.dns.dyndns_add(), scapy.layers.dns.dyndns_del(), scapy.layers.inet.fragleak2(), and scapy.layers.snmp.snmpwalk().

def scapy.sendrecv.srflood (   x,
  filter = None,
  iface = None,
  nofilter = None,
  args,
  kargs 
)
Flood and receive packets at layer 3
prn:      function applied to packets received. Ret val is printed if not None
store:    if 1 (default), store answers and return them
unique:   only consider packets whose print 
nofilter: put 1 to avoid use of bpf filters
filter:   provide a BPF filter
iface:    listen answers only on the given interface

Definition at line 499 of file sendrecv.py.

References scapy.sendrecv.sndrcvflood().

def scapy.sendrecv.srloop (   pkts,
  args,
  kargs 
)
Send a packet at layer 3 in loop and print the answer each time
srloop(pkts, [prn], [inter], [count], ...) --> None

Definition at line 433 of file sendrecv.py.

def scapy.sendrecv.srp (   x,
  iface = None,
  iface_hint = None,
  filter = None,
  nofilter = 0,
  type = ETH_P_ALL,
  args,
  kargs 
)
Send and receive packets at layer 2
nofilter: put 1 to avoid use of bpf filters
retry:    if positive, how many times to resend unanswered packets
      if negative, how many times to retry when no more packets are answered
timeout:  how much time to wait after the last packet has been sent
verbose:  set verbosity level
multi:    whether to accept multiple answers for the same stimulus
filter:   provide a BPF filter
iface:    work only on the given interface

Definition at line 343 of file sendrecv.py.

References scapy.sendrecv.sndrcv().

Referenced by scapy.layers.l2.arping(), scapy.layers.l2.promiscping(), and scapy.sendrecv.srp1().

def scapy.sendrecv.srp1 (   args,
  kargs 
)
Send and receive packets at layer 2 and return only the first answer
nofilter: put 1 to avoid use of bpf filters
retry:    if positive, how many times to resend unanswered packets
      if negative, how many times to retry when no more packets are answered
timeout:  how much time to wait after the last packet has been sent
verbose:  set verbosity level
multi:    whether to accept multiple answers for the same stimulus
filter:   provide a BPF filter
iface:    work only on the given interface

Definition at line 363 of file sendrecv.py.

References scapy.sendrecv.srp().

Referenced by scapy.layers.dhcp.dhcp_request(), scapy.layers.l2.getmacbyip(), scapy.arch.windows.getmacbyip(), scapy.layers.l2.is_promisc(), and scapy.layers.inet6.neighsol().

def scapy.sendrecv.srpflood (   x,
  filter = None,
  iface = None,
  iface_hint = None,
  nofilter = None,
  args,
  kargs 
)
Flood and receive packets at layer 2
prn:      function applied to packets received. Ret val is printed if not None
store:    if 1 (default), store answers and return them
unique:   only consider packets whose print 
nofilter: put 1 to avoid use of bpf filters
filter:   provide a BPF filter
iface:    listen answers only on the given interface

Definition at line 513 of file sendrecv.py.

References scapy.sendrecv.sndrcvflood(), and scapy.sendrecv.sniff().

Referenced by scapy.layers.l2.etherleak().

def scapy.sendrecv.srploop (   pkts,
  args,
  kargs 
)
Send a packet at layer 2 in loop and print the answer each time
srloop(pkts, [prn], [inter], [count], ...) --> None

Definition at line 439 of file sendrecv.py.

def scapy.sendrecv.tshark (   args,
  kargs 
)
Sniff packets and print them calling pkt.show(), a bit like text wireshark

Definition at line 664 of file sendrecv.py.

References scapy.sendrecv.sniff().