Skip to content

j-jith/iitm-netaccess-cmd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netaccess

build-status snap-status

This command line application allows you to login to IIT Madras' netaccess website and approve (or revoke) your machine's internet access.

Installation

Using Cargo

This application is written in Rust, and therefore the easiest way to install it is using the Cargo package manager of Rust. Installation is as simple as

$ cargo install --git https://github.com/j-jith/iitm-netaccess-cmd

Using Snap

For those of you who don't want to go through the trouble of installing Rust and Cargo, I have created a snap package which should work on most Linux distributions. After setting up snap, you can install this application by

$ sudo snap install netaccess

Usage:

netaccess [OPTIONS] [SUBCOMMAND]

Flags

-h, --help       Prints help information
-V, --version    Prints version information

Options

-d, --duration <duration>    (Optional) Duration of approval - 1 => one hour, 2 => one day. Omit to be prompted.
-p, --password <password>    (Optional) Password associated with your username. Omit to be prompted.
-u, --username <username>    (Optional) Username (your roll number) used for logging in to netaccess. Omit to be prompted.

Subcommands

approve    Approve internet access for this machine. Invoked by default if no subcommands are specified.
help       Prints this message or the help of the given subcommand(s)
revoke     Revoke internet access of this or other previously approved machine(s)

Examples

If you simply call netaccess without any subcommands/options, you will be prompted for all requisite data.

$ netaccess
Username: ddyyb000
Password:
Session duration (1: one hour (default), 2: one day): 2
You have requested approval for one day
Login successful
Succesfully approved

Alternatively, you can use the options -u, -p, and -d to specify your username, password, and duration of approval, respectively, at the time of calling netaccess.

$ netaccess -u ddyyb000 -p my_password -d 2
Login successful
Succesfully approved

The above command is equivalent to

$ netaccess approve -u ddyyb000 -p my_password -d 2

approve is the default subcommand. So you can omit it if you don't feel like typing a lot.

Caution

Please note that it is not recommended to provide your password in plain text using the -p option. A password manager should be used for this purpose. Please see Using the password option.

To revoke internet access of your machine, you can simply type

$ netaccess revoke

You will be prompted for your username and password. This will be followed by a prompt for your network interface. This is required to identify your IP address. If you are aware of your IP address, you can do the following

$ netaccess revoke <ip address>

You can revoke internet access of any machine that you've previously approved. At the moment, revoke subcommand does not validate the IP address. So you have to be careful when entering the IP address. revoke command can also accept username and password through -u and -p as follows

$ netaccess revoke <ip address> -u ddyyb000 -p my_password

Using the password option

It is not recommended to provide your password to the -p option in plain text for the sake of security. Instead, a password manager like pass should be used. In pass, one can create an entry for netaccess by

$ pass insert netaccess

Then, the password can be provided to netaccess as follows.

$ netaccess approve -u ddyyb000 -d 2 -p `pass netaccess`

Of course, if you don't want to store the password on your machine, you can simply omit the -p option, and you'll be prompted for your password.

About

Command line application for approving/revoking your machine's internet access at IIT Madras

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages