A tool to help in testing client/server robustness in the presence of malformed data.

NFQueue Tamper

A tool to help in testing client/server robustness in the presence of malformed data.

Supported protocols:

  • IPv4
    • UDP
    • TCP

Building

Requirements:

Build with make

Usage

nfqueue_tamer -q 
   
     -t "method1;opt1;opt2" -t "method2;opt1"

   

Queue number defaults to 0. Must be run as root.

To create a queue:

iptables -A 
   
     [filter criteria] -j NFQUEUE --queue-num 
    

    
   

For example, to trap all outbound UDP traffic coming from port 63:

iptables -A OUTPUT -p udp --sport 63 -J NFQUEUE --queue-num 0

Available methods and associated options:

  • rand - Randomly tamper with data
    • off - Offset, or offset range, at which to apply randomization
      • Defaults to 0:-1 (0 - end)
    • con - If offset is a range, whether or not modified bytes must be consecutive
      • Defaults to 0 (non-consecutive allowed)
      • NOT CURRENTLY SUPPORTED
    • sz - Number of bytes to modify, can be a range
      • Defaults to 1
  • fixed - Overwrite region of data with supplied values
    • off - Offset at which to apply data
      • Cannot be a range
    • data - Hex data
  • replace - Replace bytes within matching sequence
    • off - Offset into sequence to start replacing
      • Cannot be a range
      • Can be negative
    • seq - Hex sequence to search for
    • data - Replacement data
    • multi - Whether to allow multiple replacements
      • NOTE: Previously matching sequence is currently skipped

Global options:

  • chance - How likely the tamper method is to be used on a given packet
    • Probability value between 0 and 1
    • Defaults to 1

Example:

nfqueue_tamper -q 0 -t "rand;chance=.5;off=0:4;sz=1:2" -t "fixed;chance=0.1;off=16;data=0FEA0011"

This will have a 50% chance on every packet of replacing one or two of the first five bytes in the payload (application-layer data) with a random value, and a 10% chance of replacing data at offset 16-19 with 0F,EA,00,11.

Owner
Peter Farley
Embedded Software Engineer at Sensata | Xirgo Technologies
Peter Farley
Similar Resources

A micro unit-testing library for C/C++

µ-test A micro unit testing framework for C/C++ to get you up and running with unit-testing ASAP (even without libc). Usage Simply include the C and h

Dec 8, 2021

Bayesian A/B testing calculations for C++

BayesTest C++ Bayesian A/B testing calculations for C++ Based on this post by Evan Miller Also available in Rust Installation Include the header in yo

Nov 30, 2021

5G core testing solution

CoreScope CoreScope combines gNodeB and UE components without any radio transmission. It behaves like a UE and exposes an IP interface, but to the cor

Jun 9, 2022

C++ Testing using spies and fakes for isolation and simulation

C++ Testing using spies and fakes for isolation and simulation

ELFspy is a library for linux for writing tests using fakes and spies in C++. For very large call graphs, the testing of the higher nodes can be diffi

Jun 12, 2022

A complete unit testing framework in a header

liblittletest A complete unit testing framework in a header liblittletest is an easy to use all-in-an-header testing framework; all you have to do in

Nov 11, 2021

Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.

Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.

tunit Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android. Continuous Integration build status Operating system Status Windo

Apr 5, 2022

testing joystick under Linux environment, support monitoring disconnection state and auto recovery mode

qjoystick This qjoystick class is rewritten based on the library: https://github.com/drewnoakes/joystick. Please look at this library if you want to s

Oct 30, 2021

Simple C testing framework

MrTest Simple C testing framework Usage Copy the mrtest.c and mrtest.h file into your project. In order to use the mrtest main: create a .c file that

Nov 14, 2021

Testing memleaks with /usr/share/bcc/tools/memleak

Testing memleaks with /usr/share/bcc/tools/memleak

Dec 13, 2021
Comments
  • IP/TCP/UDP Header Mangling Support

    IP/TCP/UDP Header Mangling Support

    Low priority

    Support modification of protocol headers rather than restricting modifications to the data payload. More care would have to be taken here, and possibly a flag to disable checksum re-calculation if desired.

C++ Unit Testing Easier: A Header-only C++ unit testing framework

CUTE C++ Unit Testing Easier: A Header-only C++ unit testing framework usually available as part of the Cevelop C++ IDE (http://cevelop.com) Dependenc

Nov 9, 2021
Practical mutation testing tool for C and C++

Mull Mull is a tool for Mutation Testing based on LLVM/Clang with a strong focus on C and C++ languages. For installation and usage please refer to th

Jun 16, 2022
TestFrame - This is a test framework that uses Raylib and ImGui together to help test and develop concepts
TestFrame - This is a test framework that uses Raylib and ImGui together to help test and develop concepts

This is a test framework that uses Raylib and ImGui together to help test and develop concepts. It is made using C++ because it uses classes for windows and views.

May 13, 2022
Header-only C++11 library for property-based testing.

autocheck Header-only C++11 library for QuickCheck (and later, SmallCheck) testing. Please consult the wiki for documentation. Install conan remote ad

Apr 18, 2022
The fastest feature-rich C++11/14/17/20 single-header testing framework
The fastest feature-rich C++11/14/17/20 single-header testing framework

master branch Windows All dev branch Windows All doctest is a new C++ testing framework but is by far the fastest both in compile times (by orders of

Jun 18, 2022
Googletest - Google Testing and Mocking Framework

GoogleTest OSS Builds Status Announcements Release 1.10.x Release 1.10.x is now available. Coming Soon Post 1.10.x googletest will follow Abseil Live

Jun 23, 2022
C++ xUnit-like testing framework without macros

tst C++ testing framework. Installation, documentation, tutorials See WiKi. Features xUnit-like concepts minimal use of preprocessor macros declarativ

Jan 24, 2022
proftest is a C application for testing the quality of different operating system APIs for profiling.

proftest is a C application for testing the quality of different operating system APIs for profiling.

Jul 23, 2021
c++ testing framework

iutest iutest - iris unit test framework Welcome to the iutest iutest is framework for writing C++ tests. Features An XUnit test framework. Header onl

Jun 15, 2022
UT: C++20 μ(micro)/Unit Testing Framework
UT: C++20 μ(micro)/Unit Testing Framework

"If you liked it then you "should have put a"_test on it", Beyonce rule UT / μt | Motivation | Quick Start | Overview | Tutorial | Examples | User Gui

Jun 13, 2022