Giter Site home page Giter Site logo

bigmacstorm / archertrafficgraph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hraftery/archertrafficgraph

0.0 2.0 0.0 383 KB

Provides a live graph of network traffic passing through a TP-Link Archer C7 AC1750

License: MIT License

Shell 27.51% Gnuplot 6.33% Perl 66.16%

archertrafficgraph's Introduction

Live Traffic Graph for TP-Link Archer C7 routers

These scripts provides a live graph of network traffic passing through a TP-Link Archer C7 AC1750.

Screenshot

After years living with a Billion that has a live network graph in its standard web interface, I've moved to an Archer C7 and miss the graph dearly. Whenever there's a speed issue or a download quota issue the first thing I want to do is jump on to the router and see which device is slamming it. The Archer C7 web interface does provide some numerical statistics, but they are extremely difficult to make sense of since there's no sense of progress over time or relative magnitude.

So today I set about giving the Archer a graph. This is what I've hacked together. It's extremely rough, but the results are terrific and I figure with the community's help it could be so much better.

Dependencies

  • Unix environment (developed on OS X, likely fine on Linux)
  • gnuplot
  • Perl
  • curl

Quick Start

  1. Run liveplot.sh from the command line.
  2. Wait for the graph to appear.
  3. If the graph appears, then hallelujah, you're done.
  4. In the extremely likely scenario that it doesn't, keep reading.

Troubleshooting

  • All scripts have to be executable. This ought to do it:
    • chmod +x liveplot.sh liveplot.pl getStats.sh resetStats.sh
  • The router's IP address is hardcoded. If yours is not 192.168.0.1, then update getStats.sh and resetStats.sh.
  • I haven't figured out the router's authentication method, so it's hardcoded for now.
    • Browse to your router's webpage and sniff the network traffic (eg. in Wireshark).
    • Look for the HTTP GET packet sent to the router after you login.
    • Copy both the first part of the URL after the IP address, and the Cookie string.
      • Eg. the "VXKQJFBBBVYUWYEA" from "http://192.168.0.1/VXKQJFBBBVYUWYEA/userRpm/..."
      • Eg. the "Authorization=Basic%20YWRtaW46MjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzM%3D" from "Cookie:"
      • Don't get too excited that I just gave away my password.
    • Paste the results into both getStats.sh and resetStats.sh
    • Try liveplot.sh again.

How It Works

liveplot.sh is the entry point. It first runs resetStats.sh which makes a curl request to the router which mimics pressing the "Reset Statistics" button. Then, every 5 seconds it runs getStats.sh, which is effectively what the browser does when you're viewing the statistics page. The resulting HTML page is piped to liveplot.pl which parses it and finds the array of statistics. From that it pulls out all the IP addresses and their total bytes (I ignored "current" bytes because it doesn't seem reliable).

liveplot.pl then compares the total bytes to the total bytes from last time it was run (which are stored in liveplot.tmp. It then calculates the delta and writes the results to liveplot.dat, pushing any old data back in time.

Meanwhile liveplot.sh runs gnuplot in parallel, which executes liveplot.gnu. It reads liveplot.dat, plots it and then repeats every 5 seconds.

All together this little concert pops up a gnuplot window (running in AquaTerm on my machine) which shows the average kB/s, every 5 seconds for the last 100 seconds, for all IP addresses the router knows about.

TODO

Lots.

  • Automatically authenticate.
  • Packaging - script names, ease of execution, location of output files etc.
  • I'd really like some schooling on Perl style. I love Perl, but every time I write a script I feel like I'm butchering it, and there has to be a better way.
  • Make setting IP address easy.
  • Error reporting!
  • Deal with heaps of IP addresses in a clearer way (I have 16, and the colours are too hard to distinguish).
  • Improve refresh rate?
  • Allow zooming?
  • Fix bugs.

Contact

I welcome all comments, suggestions, bug fixes and stories of use.

Heath Raftery [email protected]

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.