Giter Site home page Giter Site logo

iitm-netaccess-cmd's Introduction

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.

iitm-netaccess-cmd's People

Contributors

j-jith avatar varun19299 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

iitm-netaccess-cmd's Issues

Pnet version requires updating

The cargo builds presently fail due to pnet<=0.21.
We changed the versions in the yaml file for our use case.

Also, could a travis CI be setup for the cargo builds? (or similar)

Nice repo btw! Much better than the naive implementation we were using via barebones python.

Failed to send login request

I ran the following command

netaccess -u my_username -p my_passwd -d 2

and got following error,

thread 'main' panicked at 'Failed to send login request: Error { kind: Io(Error { repr: Custom(Custom { kind: Other, error: Ssl(ErrorStack([Error { code: 336134278, library: "SSL routines", function: "ssl3_get_server_certificate", reason: "certificate verify failed", file: "s3_clnt.c", line: 1264 }])) }) }), url: Some("https://netaccess.iitm.ac.in/account/login/") }', /checkout/src/libcore/result.rs:906:4
note: Run with RUST_BACKTRACE=1 for a backtrace.

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.