Skip to content

kracekumar/imon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imon Build Status codecov

Internet bandwidth data usage monitor by domain. Short presentation

Setup

  • The program works with rust nightly. Make sure you have rust installed. Use rustup.

  • Install libpcap-dev and libsqlite for your OS.

  • Clone and build the program from source.

git clone git@github.com:kracekumar/imon.git
cd imon
cargo build --release
  • Start the daemon. The daemon captures WiFi packet, so you need to have access to the device. #env RUST_LOG=debug ./target/release/imon start

  • Open an another terminal and go the project root directory. Now query the daemon.

env RUST_LOG=debug ./target/release/imon site google.com
---
Command: site
Arguments: google.com,
---

0| google.com| 1.07 "MB"| "2016-11-02"

Help

user@user-ThinkPad-T400 ~/c/imon> ./target/release/imon -h
imon

Usage:
  imon <command> [<args> ...] [--from=<from>] [--to=<to>]
       [-h|--help]

Options:
  -h --help     Show this screen.
  --version     Show version. # Not yet implemented
  --start       Start date in the format YYYY-MM-DD
  --end         End date in the format YYYY-MM-DD

The mostly used commands are
    start    Start the daemon
    report   Report
    site     Display Site specific data

Examples - Querying
--------
- ./target/release/imon site google.com zulipchat.com duckduckgo.com
- ./target/release/imon site google.com
- ./target/release/imon site google.com --from 2016-11-01
- ./target/release/imon site google.com --from 2016-11-01 --to 2016-11-03
- ./target/release/imon report
- ./target/release/imon report --from 2016-11-05
- ./target/release/imon report --from 2016-11-05 --to 2016-11-05

TODO

  • Add unit tests
  • Add integration tests
  • Publish to crate
  • Add command line usage documentation
  • Filter local network traffic
  • Add a way to monitor Ethernet port
  • Handle cache IP miss. Send DNS lookup.
  • Support audio/video sites.
  • Integrate with travis-ci
  • Write cached IPs to disk before shutting down
  • During startup, read IPs from file
  • IP cache invalidation
  • Replace println with log.
  • Support IPv6 packets!
  • Handle socket connection failure when daemon is down
  • Handle input argument validation
  • Move decoding logic to separate file
  • Use multiple threads to handle the packet decoding

Caveats

  • The hashmap stores domain name against IP address. So sites sharing same IP address traffic data will be skewed. youtube and google.com share similar IPs.
  • The majority of sites load static data from CDN, the request goes to IP address of the CDN. As a result the original domain traffic represented is lesser than actual. Though traffic data against the CDN is stored.
  • If the daemon is started after opening the browser, DNS request isn't sent until and unless DNS result is expired or DNS result is missing in cache.

About

Internet bandwidth monitor by domain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages