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(8) for packet filtering, and I want to make sure my tool can still leverage the power of that.

Usage

Usage of skbdump:
  -i, --interface string       interface to capture (default "lo")
  -w, --pcap-filename string   output pcap filename (default "skbdump.pcap")
  -p, --priority uint32        filter priority (default 1)
  -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
  2. skbdump -i eth0 udp
  3. skbdump -i eth0 host 10.10.1.1
  4. skbdump -i any dst 10.10.1.20

Known Issues

  1. There are some bugs of transforming cbpf to ebpf, and now the tool will break for skbdump -i lo arp. To workaround the issue you can use the equivalent filter expression such as skbdump -i lo ether proto arp.
  2. Some complicated filter expression doesn't work as expected, such as 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'.
  3. Currently the tool only supports capturing packets with maximum 1024 bytes.

skbdump's People

Contributors

jschwinger233 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.