S
S
serj123312021-08-05 04:33:07
Python
serj12331, 2021-08-05 04:33:07

How to respond to an incoming packet in a NetfilterQueue?

Good day! Faced such a problem. We use NetfilterQueue to intercept packets.
The pkt.drop() function for dropping a packet does not alert the client that the packet has been dropped and the client is starting to reconnect. How to send a package with our content to the client so that the client receives it.
I accept the package in this way, but I don’t know how to answer. Tell me please.

from netfilterqueue import NetfilterQueue
def print_and_accept(pkt):
    print(pkt)
    pkt.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(1, print_and_accept)
try:
    nfqueue.run()
except KeyboardInterrupt:
    print('')
nfqueue.unbind()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question