Giter VIP home page Giter VIP logo

nfq-test's Introduction

Netfilter Queue Basic Example

Netfilter Queue project website

Install required packages (for Ubuntu 20.04):

apt-get install libnfnetlink-dev libnetfilter-queue-dev

Compile the test program:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

Configure INPUT and OUTPUT rules to intercept packets to/from UDP port 5566 and send to netfilter queue 0:

iptables -A INPUT -p udp --dport 5566 -j NFQUEUE --queue-num 0 --queue-bypass
iptables -A OUTPUT -p udp --sport 5566 -j NFQUEUE --queue-num 0 --queue-bypass

Display current rules for INPUT/OUTPUT:

iptables -L INPUT
iptables -L OUTPUT

Remove previously configured rules:

iptables -D INPUT -p udp --dport 5566 -j NFQUEUE --queue-num 0
iptables -D OUTPUT -p udp --sport 5566 -j NFQUEUE --queue-num 0

Run:

build/nfq_test

Start test UDP server

nc -ul 0.0.0.0 5566

Send packets from other host:

nc -u <IP> 5566

nfq-test's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.