Git Product home page Git Product logo

snifferpp's Introduction

snifferpp

Packet Sniffer I wrote while trying to replicate TCP in C++. I was developing on MacOS, so it uses Berklee Packet Filters (BPF) (MacOS does not allow you to access TCP and UDP packets via a raw socket as you would in linux).

Part of the goal here was to try to C++-ify a more traditionally C workflow, so you will see lots of classes here acting as resource handles (for example BPFDevice, which essentially manages the file descriptor for the BPF and helps buffer reads).

main.cpp will fill the BPFDevice buffer and read packets until it gets one with a supported transport protocol (TCP and UDP currently, but fairly easy to add more). It then prints out the packet (with formatted header output and both raw and encoded payload)

If no such packet exists in the buffer, it will exit (one could instead just refill the buffer and keep trying). Given the buffer size of 4096 bytes (set in main) this is unlikely.

*Note using BPF Devices requires root permissions, so one has to use sudo to run the executable.

Example output: example_output

snifferpp's People

Contributors

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