Skip to content

L1ghtweight/netman

Repository files navigation

Mobile app for netman can be found here

python badge

About NETMAN

Manually keeping track of the internet usage in IUT is tedious work. Netman is a small tool that does that dull job for us, saving us a few extra minutes to focus on more productive things. We can add our credentials and netman will send us our internet usage report via email.


Requirements and Installation

  1. Install python 3.x, pip and git if you don't have them already.
  2. Clone and install the dependencies:
git clone --depth 1 https://github.com/L1ghtweight/netman.git
cd netman
pip install -r requirements.txt

NOTE: Administrative privileges may be needed to install pip packages in windows.

  1. We'll need a gmail account to send mails. To set up the email:
  • First, enable 2FA from here.
  • Then, go to App Passwords, select Mail and Windows computer and hit Generate.
  • You will be given a password, copy it.

Google's official guide regarding this step can be found here.

NOTE: Using a throwaway mail is highly recommended.

  1. Inside the netman folder, create a file named secrets.py and store your email and password you just copied in this format:
email = "[email protected]"
password = "password"
  1. Inside the netman folder, create the a file named credentials.json and add your IUT internet credentials inside the file in the following format:
{
    "name1": {
        "username": "username1",
        "password": "password1",
        "email": "email@email",
        "us": true
    },
    "name2": {
        "username": "username2",
        "password": "password2",
        "email": "email@email",
        "us": false
    }
}
  • Follow the structure given in the file.
  • Setting the us variable to true means you will get notified about all of the users' usage through email. Otherwise, you'll get usage of yourself only.
  1. We can now run the script with the command python netman.py.

NOTE: You need to be connected to IUT internet so that the iusers page is accessible.

Scheduling

We can schedule the script to get a periodic update.

Windows:

  • For windows we can use the pre-installed Task Scheduler.

Linux:

  • For Linux we can use crontab.
  • Using the netman_cron.sh script is recommended.

Issues

As secrets.py and credentials.py files are not encrypted, it is necessary to keep them safe from prying eyes.

Possible solutions (and why they aren't implemented)

Using a database: Seems like an overkill for such a simple task.
Password protecting the files: Password would be required whenever an instance is run. If used as a scheduled task, this would become a hassle.