ndisapi Documentation

repository·master·Indexed 19 days ago

https://github.com/wiresock/ndisapi

A user-mode library providing a safe and efficient interface for interacting with the Windows Packet Filter driver. It enables raw network packet inspection, modification, and transmission at the NDIS level, featuring tools for packet filtering via fastio_packet_filter, UDP redirection with udp_proxy_server, and IPv6 header parsing.

Tokens
5.7K
Snippets
15
Records
37
Agent score
68%

What's inside ndisapi

  1. Overview of PcapPlusPlus Demo features

    master

    The PcapPlusPlus Demo is a tool designed to intercept and analyze network traffic. Its primary capabilities include:

    • Network Packet Interception: Real-time capture and analysis of network packets.
    • SNI Extraction: Extracting the Server Name Indication (SNI) from HTTPS packets to identify the destination hostname.
    • TLS Fingerprinting: Identifying the specific version of Transport Layer Security (TLS) being utilized in the connection.
  2. Overview of the Hyperscan Network Packet Analysis Example

    master

    The Hyperscan example application demonstrates how to integrate the Hyperscan and llhttp libraries for high-performance network monitoring.

    Workflow:

    1. Intercept network packets.
    2. Parse packets to detect HTTP protocol sessions.
    3. Apply llhttp to the detected sessions for in-depth HTTP protocol parsing.

    This is useful for network security and monitoring applications that need to identify and analyze HTTP traffic at scale.

  3. Overview of NDISAPI

    master

    NDISAPI is a user-mode interface library for interacting with the Windows Packet Filter (WinpkFilter) driver. It allows developers to perform network packet filtering (inspection and modification) at the NDIS level of the Windows network stack without requiring kernel-mode programming skills.

    Key capabilities include:

    • Network Adapter Management: Enumerating and managing adapter properties.
    • Packet Analysis and Modification: Capturing, filtering, and modifying raw network packets.
    • Packet Transmission: Sending raw packets directly through the network stack.
  4. Overview of the SNI Inspector tool

    master

    The sni_inspector is a C++ utility designed to intercept and analyze network traffic using the Windows Packet Filter (WinpkFilter) driver. It specifically inspects TLS/SSL connections to extract the Server Name Indication (SNI) extension and parses HTTP packets to extract the Host header.

    Workflow:

    1. Verifies if the WinpkFilter driver is loaded.
    2. Lists available network interfaces.
    3. Prompts the user to select an interface for filtering.
    4. Monitors traffic on the selected interface and outputs hostnames (from SNI or HTTP Host headers) directly to the console.
    5. Runs continuously until interrupted by a key press.
  5. Overview of the DNS Tracer example

    master
    The dnstrace application is a C++ console tool designed for network debugging, security monitoring, and research. It provides a detailed trace of DNS responses by parsing the structure of DNS packets. It serves as a practical demonstration of how to link the NDISAPI library both statically and dynamically.
  6. How the UDP to TCP Converter works

    master

    The application functions as a bidirectional converter using the Windows Packet Filter (WinpkFilter) library to intercept and modify network traffic. It utilizes a simple_packet_filter object configured with two primary lambda functions to handle packet redirection:

    1. TCP to UDP Conversion: Intercepts incoming TCP packets on a specific port and redirects them to be processed as UDP.
    2. UDP to TCP Conversion: Intercepts outgoing UDP packets on a specific port and redirects them to be processed as TCP.
    3. Pass-through: All other packets are passed through without processing in user mode.
  7. Intercept IPv6 packets with fastio_packet_filter

    master
    In the context of packet processing, ndisapi::fastio_packet_filter can be used to intercept IPv6 packets. Once intercepted, these packets can be passed to an ipv6_parser to identify the transport protocol and perform subsequent actions, such as process lookups for TCP traffic.
  8. How DNS Tracer works

    master
    The application operates by capturing packets originating from a DNS server (specifically targeting port 53) using the Windows Packet Filter. Once captured, the tool parses the packets to extract IP, UDP, and DNS headers. For every DNS response identified, it extracts and prints the specific DNS record type and its associated data. The process runs continuously until interrupted by the user.
  9. Rebind outgoing TCP/UDP connections using Windows Packet Filter

    master

    The Rebind example demonstrates how to use the Windows Packet Filter driver to redirect outgoing TCP/UDP traffic for a specific application from a default network interface to a different one.

    Use Cases

    • Interface Switching: Redirect traffic for a specific application (e.g., Firefox) to a Wi-Fi interface while keeping all other system traffic on a LAN interface.
    • VPN Bypassing: Redirect traffic for a specific application (e.g., a video streaming service) to a physical network interface, effectively bypassing a WireGuard VPN tunnel that is routing all other system traffic.
  10. Run the DNS Tracer application

    master

    Execute the application from the command line. If the Windows Packet Filter driver is active, the application will prompt you to select a network interface from a displayed list. Enter the number corresponding to the interface you wish to monitor to begin capturing and parsing DNS responses.

    ./dnstrace
  11. Prerequisites for running the PcapPlusPlus Demo

    master

    Before building or running the PcapPlusPlus Demo, ensure the following requirements are met:

    1. Windows Packet Filter Driver: The Windows Packet Filter driver must be loaded on your system to allow the application to intercept network packets.
    2. PcapPlusPlus Library: The library must be installed via vcpkg using the appropriate static triplet (x86-windows-static or x64-windows-static).