forked from secdev/scapy
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This file is part of Scapy | ||
# See http://www.secdev.org/projects/scapy for more information | ||
# Copyright (C) Guillaume Valadon | ||
# This program is published under a GPLv2 license | ||
|
||
# https://github.com/secdev/scapy/issues/1791 | ||
|
||
from scapy.all import * | ||
|
||
# Router IP | ||
dest = conf.route.route("0.0.0.0")[2] | ||
|
||
send_tcp = False | ||
send_icmp = True | ||
|
||
pkts = [] | ||
for i in range(1,50): | ||
a = IP(dst=dest) / TCP(flags="S", seq=i, sport=65000, dport=55556) | ||
b = IP(dst=dest)/ICMP() | ||
if send_tcp: | ||
pkts.append(a) | ||
if send_icmp: | ||
pkts.append(b) | ||
|
||
ans, unans = sr(pkts, filter="host {0}".format(dest), inter=0, timeout=1) | ||
|
||
print("scapy version: {}".format(conf.version)) | ||
|
||
for pkt in ans: | ||
sent = pkt[0] | ||
received = pkt[1] | ||
res = (received.time - sent.sent_time) | ||
print("%s %s : %s" % (received.time, sent.sent_time, res)) |