Created
December 15, 2016 15:33
-
-
Save SyntheticDream/197a15447a9bf297ff05bcbc7c650dc9 to your computer and use it in GitHub Desktop.
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
from scapy.all import * | |
paks = rdpcap('sample.pcap') | |
db = {} | |
def check_ttl(packet): | |
new_ttl = packet.ttl | |
src = packet.src | |
last_ttl = db.get(src) | |
if last_ttl is None: | |
db[packet.src] = new_ttl | |
else: | |
if last_ttl != new_ttl: | |
return '{} is banned'.format(src) | |
else: | |
return '{} passes'.format(src) | |
for pak in paks: | |
print(check_ttl(pak)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment