-
Notifications
You must be signed in to change notification settings - Fork 395
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
Mari Wahl
committed
Dec 23, 2014
1 parent
a1bbf06
commit ffb92e0
Showing
5 changed files
with
72 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python | ||
|
||
__author__ = "bt3" | ||
|
||
from scapy.all import * | ||
|
||
|
||
output=sr(IP(dst='google.com')/ICMP()) | ||
print '\nOutput is:' | ||
print output | ||
result, unanswered=output | ||
print '\nResult is:' | ||
print result[0] |
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,15 @@ | ||
#!/usr/bin/env python | ||
|
||
__author__ = "bt3" | ||
|
||
from scapy.all import * | ||
|
||
print conf.route | ||
|
||
conf.route.add(host='192.168.118.2', gw='192.168.1.114') | ||
|
||
print conf.route | ||
|
||
conf.route.resync() | ||
|
||
print conf.route |
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,10 @@ | ||
#!/usr/bin/env python | ||
|
||
__author__ = "bt3" | ||
|
||
from scapy.all import * | ||
|
||
packet = IP(dst="192.168.1.114")/ICMP()/"Helloooo!" | ||
#send(packet, loop=1) | ||
send(packet) | ||
packet.show() |
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,4 @@ | ||
#!/usr/bin/env python | ||
|
||
__author__ = "bt3" | ||
|
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 |
---|---|---|
@@ -1,16 +1,31 @@ | ||
#!/usr/bin/env python | ||
|
||
__author__ = "bt3" | ||
|
||
from scapy.all import * | ||
hostname = "google.com" | ||
for i in range(1, 28): | ||
pkt = IP(dst=hostname, ttl=i) / UDP(dport=33434) | ||
# Send the packet and get a reply | ||
reply = sr1(pkt, verbose=0) | ||
if reply is None: | ||
# No reply =( | ||
break | ||
elif reply.type == 3: | ||
# We've reached our destination | ||
print "Done!", reply.src | ||
break | ||
else: | ||
# We're in the middle somewhere | ||
print "%d hops away: " % i , reply.src | ||
|
||
HOST = "google.com" | ||
|
||
def traceroute(): | ||
for i in range(1, 28): | ||
|
||
pkt = IP(dst=HOST, ttl=i) / UDP(dport=33434) | ||
# Send the packet and get a reply | ||
reply = sr1(pkt, verbose=0) | ||
|
||
if reply is None: | ||
# No reply =( | ||
break | ||
|
||
elif reply.type == 3: | ||
# We've reached our destination | ||
print "Done!", reply.src | ||
break | ||
|
||
else: | ||
# We're in the middle somewhere | ||
print "%d hops away: " % i , reply.src | ||
|
||
|
||
if __name__ == '__main__': | ||
traceroute() |