Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upException ignored in: 'netfilterqueue.global_callback' #50
Comments
|
Duplicates #31 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from netfilterqueue import NetfilterQueue
from scapy.all import *
def print_and_accept(pkt):
print(pkt)
pl = IP(pkt.get_payload())
print(pl.show())
pl[IP].dst = "172.17.0.3"
del pl[IP].len, pl[IP].chksum, pl[TCP].chksum
print(">>>payload: ",str(pl))
pkt.set_payload(str(pl))
hw = pkt.get_hw()
if hw:
print(":".join("{:02x}".format(c) for c in hw[0:6]))
pkt.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(0, print_and_accept)
try:
nfqueue.run()
except KeyboardInterrupt:
print('')
nfqueue.unbind()
following is the output:
###[ IP ]###
version = 4
ihl = 5
tos = 0x0
len = 52
id = 43486
flags = DF
frag = 0
ttl = 127
proto = tcp
chksum = 0x2028
src = /old?u=https%3A%2F%2Fgithub.com%2Fkti%2Fpython-netfilterqueue%2Fissues%2F192.168.197.1%3Cbr&y=1999> dst = 172.17.0.2
\options
###[ TCP ]###
sport = 10732
dport = http
seq = 3132586654
ack = 0
dataofs = 8
reserved = 0
flags = S
window = 64240
chksum = 0xe2cf
urgptr = 0
options = [('MSS', 1460), ('NOP', None), ('WScale', 8), ('NOP', None), ('NOP', None), ('SAckOK', b'')]
None