Giter Site home page Giter Site logo

redcap's Introduction

redcap

Lightweight cross-platform packet counter based on libpcap and using Redis for storing the statistics.

Usage

./redcap_count <device> <filter> <count> <redis_key> <redis_incrby_interval> [redis_bgsave_interval]

  • <device>: Interface name. (eth0, re0, lo, etc.)
  • <filter>: libpcap expression.
  • <count>: How many packets to capture. 0 for infinite.
  • <redis_key>: Redis key to store the number.
  • <redis_incrby_interval>: Update the Redis data after receiving 'n' packets.
  • [redis_bgsave_interval]: If provided, it will run an asynchronus write-to-disk on redis.

Dependencies

Compiling

% cc -o redcap_count redcap_count.c -lpcap -lhiredis -pedantic -Wall

Example

# ./redcap_count eth0 "icmp[icmptype] == icmp-echo and dst host 8.8.8.8" 100 my_key 5 10

  • Listening on eth0.
  • Filtering the ICMP Echo Request(ping) packets destinated for 8.8.8.8.
  • Capturing 100 packets.
  • Storing as my_key in Redis.
  • Updating Redis after 5 packets.
  • Store the Redis data on disk after 10 packets. (optional)

TODO

  • Option for enabling an OS-specific library? (PF_RING, netmap(4), etc.)
  • verbose option.
  • <redis_index_id>
  • Connecting to Redis via socket. (optional)
  • Remote Redis server. (Default on 127.0.0.1:6379)

redcap's People

Contributors

wyldepointer avatar

Stargazers

 avatar Niloofar avatar Massoud Asadi avatar Payam Naderi avatar Hamidreza Soleimani avatar

Watchers

James Cloos avatar  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.