You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
736 B

#!/usr/bin/env python3
# Dictionary of items we need to track to perform txid filtering
"""
if c
"""
requests = {}
SADDR=0
SPORT=1
DADDR=2
DPORT=3
TXID=4
def drop_packet():
""" """
return 0
def send(skb):
""" Emulate sending of a DNS request"""
request[(skb[SADDR], skb[SPORT], skb[DADDR], skb[DPORT])] = [skb[TXID], 0]
def receive(skb):
""" Emulate receiving of a DNS response"""
if skb[TXID] != request[(skb[DADDR], skb[DPORT], skb[SADDR], skb[SPORT])][0]:
request[(skb[DADDR], skb[DPORT], skb[SADDR], skb[SPORT])][1] += 1
if request[(skb[DADDR], skb[DPORT], skb[SADDR], skb[SPORT])][1] > threshold:
drop_packet()
def main():
"""
"""
if __name__ == '__main__':
main()