Coder Social home page Coder Social logo

skbdump's Introduction

skbdump

skbdump takes advantages of tc-bpf(8) to dump traffic on a network.

This tool is created by the following motives:

  1. tcpdump(8) is bypassed when a bpf program on a device redirects the skb to another device;
  2. tcpdump(8) works slowly and affects network performance;
  3. tcpdump(8) -i any relies on Linux cooked-mode capture (SLL) and the link layer header isn't available;
  4. tcpdump(8) doesn't reflect the information of direction: egress or ingress;
  5. tcpdump(8) can't capture the skb metadata in the struct __sk_buff;

However, tcpdump(8) does have something I really appriciate, such as pcap-filter(7) for packet filtering, and I want to make sure my tool can still leverage the power of that.

Installation

Please download the latest binary in the releases.

Requirements

libpcap is required for Linux, for Ubuntu:

apt install libpcap-dev

Usage

Usage of skbdump:
  -i, --interface string       interface to capture (default "lo")
  -w, --pcap-filename string   output pcap filename (default "skbdump.pcap")
      --perf-output            use bpf_perf_event_output to lift payload size limit
  -s, --skb-filename string    output skb filename (default "skbdump.skb")

Please be aware that every capture will dump two files, one is pcap file which I recommand you open it by wireshark, and the other is skb text file just simply recording skb metadata in JSON.

Some examples:

  1. skbdump -i eth0 port 80 and host 10.10.1.1
  2. skbdump -i eth0 udp or arp
  3. skbdump -i any icmp or icmp6
  4. skbdump -i any ip6 and dst host fd04::18ab
  5. skbdump -i veth 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'

Known Issues

  1. Currently the tool only supports capturing packets with maximum 1500 bytes in default mode (bpf queue output mode).
  2. Using perf output mode can capture payload larger than 1500 bytes, but it's likely to mess up the event order and get some events lost.

skbdump's People

Contributors

jschwinger233 avatar mozillazg avatar

Watchers

 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.