Scapy/5/en
Jump to navigation
Jump to search
Utilisation
Remarques générales
- Le caractère "_" désigne le dernier résultat. Par exemple :
>>> a="Hello" >>> str(a) 'Hello' >>> hexdump(_) 0000 48 65 6C 6C 6F Hello
- Pour obtenir de l'aide sur une fonction, utilisez la fonction help(nom_de_la_fonction)
>>> help(sniff)
Help on function sniff in module __main__:
sniff(count=0, store=1, offline=None, prn=None, lfilter=None, L2socket=None, timeout=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
- Pour connaître la liste des paramètres d'une couche et les valeurs par défaut de ces paramètres, utilisez : ls(couche). Pour connaître la liste des couches, utilisez ls() sans paramètre. Enfin, pour lister les paramètres d'une variable (par exemple t1=IP(dst="192.168.182.132")), utilisez ls(t1).
>>> ls(IP)
version : BitField = (4)
ihl : BitField = (None)
tos : XByteField = (0)
len : ShortField = (None)
id : ShortField = (1)
flags : FlagsField = (0)
frag : BitField = (0)
ttl : ByteField = (64)
proto : ByteEnumField = (0)
chksum : XShortField = (None)
src : Emph = (None)
dst : Emph = ('127.0.0.1')
options : IPoptionsField = ()
- Pour connaître la liste des commandes disponibles, utilisez la fonction lsc().
>>> lsc() sr : Send and receive packets at layer 3 sr1 : Send packets at layer 3 and return only the first answer srp : Send and receive packets at layer 2 srp1 : Send and receive packets at layer 2 and return only the first answer srloop : Send a packet at layer 3 in loop and print the answer each time srploop : Send a packet at layer 2 in loop and print the answer each time sniff : Sniff packets p0f : Passive OS fingerprinting: which OS emitted this TCP SYN ? arpcachepoison : Poison target's cache with (your MAC,victim's IP) couple send : Send packets at layer 3 sendp : Send packets at layer 2 traceroute : Instant TCP traceroute arping : Send ARP who-has requests to determine which hosts are up ls : List available layers, or infos on a given layer lsc : List user commands queso : Queso OS fingerprinting nmap_fp : nmap fingerprinting report_ports : portscan a target and output a LaTeX table dyndns_add : Send a DNS add message to a nameserver for "name" to have a new "rdata" dyndns_del : Send a DNS delete message to a nameserver for "name" is_promisc : Try to guess if target is in Promisc mode. The target is provided by its ip. promiscping : Send ARP who-has requests to determine which hosts are in promiscuous mode