Scapy/11/en

From aldeid
Jump to navigation Jump to search

Received 2 packets, got 1 answers, remaining 0 packets

<IP  version=4L ihl=5L tos=0x0 len=28 id=1758 flags= frag=0L ttl=128 proto=icmp
chksum=0x1b2c src=192.168.225.1 dst=192.168.182.132 options= |<ICMP  type=echo
-reply code=0 chksum=0xffff id=0x0 seq=0x0 |<Padding  load='\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' >>>

En cas de non réponse :

>>> sr1(IP(dst="192.168.225.2")/ICMP())
Begin emission:
.Finished to send 1 packets.
..............................................................^C
Received 63 packets, got 0 answers, remaining 1 packets

Il est possible de scanner les hôtes actifs sur un réseau, en exploitant le tableau de résultats comme dans l'exemple ci-dessous :

>>> sr(IP(dst="192.168.0.0/24")/ICMP())
Begin emission:
....*.*.................*.Finished to send 256 packets.
...........^C
Received 37 packets, got 3 answers, remaining 253 packets
(<Results: TCP:0 UDP:0 ICMP:3 Other:0>, <Unanswered: TCP:0 UDP:0 ICMP:253 Other:
0>)
>>> res,unans=_
>>> res.summary()
IP / ICMP 192.168.182.132 > 192.168.0.10 echo-request 0 ==> IP / ICMP 192.168.0.
10 > 192.168.182.132 echo-reply 0 / Padding
IP / ICMP 192.168.182.132 > 192.168.0.13 echo-request 0 ==> IP / ICMP 192.168.0.
13 > 192.168.182.132 echo-reply 0 / Padding
IP / ICMP 192.168.182.132 > 192.168.0.254 echo-request 0 ==> IP / ICMP 192.168.0
.254 > 192.168.182.132 echo-reply 0 / Padding