cross platform command line tool to list, notify and book vaccine using cowin API

Overview

Command line tool to List and Book Vaccine

cowin-cli is a simple cli tool to book vaccines and list centers using the COWIN API. It also supports auto captcha completion .

Note: By default cowin-cli will not run continoulsy and monitor slot changes, use bash / batch scripts for that purpose, which can be found here.

Features

  • Zero dependency : No neeed to install anything, download precompiled binary and run.
  • Automatic captcha support: credits to https://github.com/ayushchd
  • Scripting support : scripts are available for all platforms.
  • Reuse OTP : session token is written to a text file to reuse it later.
  • Cross platform : Windows, Linux, macOS, Termux.

Installation

Install via go get

$ go get -u github.com/anoop142/cowin-cli

Note : go version 1.16+ is required.

OR

Download precompiled binaries.

Precompiled binaries are avalailable for Windows and linux. Download them at Releases page.

Android Termux

Follow these steps to set up in termux.

# Install packages
$ pkg i golang git
# Add go bin to PATH
$ echo "export GOPATH=$HOME/go\nexport PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> ~/.bashrc
$ source ~/.bashrc
#  Install cowin-cli
$ go get -u github.com/anoop142/cowin-cli

Getting Started

There are two modes

  • List mode
  • Booking mode

List vaccine centers

cowin-cli -s state -d district [-v vaccine] [-m age] [-i] [-b]  [-c dd-mm-yyyy]

Example

$ cowin-cli -s kerala -d alappuzha -i -m 45 

Thazhakara PHC  Free  10-05-2021  0  COVISHIELD 45+
Kayamkulam THQH  Free  10-05-2021  0  COVISHIELD 45+

The -i option displays all extra info like date, vaccine name, age...

Book Vaccine

You can specify mobile number, centers to auto book, age, name etc. If not, you will be prompted to enter it appropriately.

$  cowin-cli -sc -state -d district [-no mobileNumber] [-name Name] [-centers center1,cetner2 ] [-slot slotTime] [-ntok]

Example 1

$  cowin-cli -sc -s kerala -d alappuzha -no 9123456780

    +----+----------------+-----------+---------+-----------+
    | ID |   CENTER       | FREE TYPE | MIN AGE |  VACCINE  |
    +----+----------------+-----------+---------+-----------+
    |  0 | Aroor FHC      | Free      |      45 | COVISHIELD|
    |  1 | Ala PHC        | Free      |      45 | COVISHIELD|
    |  2 | Chunakkara CHC | Free      |      45 | COVISHIELD|
    +----+----------------+-----------+---------+-----------+

      Enter Center ID : 1
      Enter OTP : xxxxx

    +----+---------------+
    | ID |     NAME      |
    +----+---------------+
    |  0 | John doe      |
    |  1 | Jane doe      |
    |  2 | All           |
    +----+---------------+

     Enter name ID : 1

    Appointment scheduled successfully!

Note: By default cowin-cli will reuse token, so until the token expires , you don't need to enter otp again.

you can specify most of the details for booking the vaccine

Example 2

$  cowin-cli -sc -s kerala -d alappuzha -no 9123456780 -name "John doe" -centers "Aroor FHC,Ala PHC"

Center : Aroor FHC
Enter OTP :  xxxxx

Note: -centers "any" to auto select any center. -name "all" to book for all under same mobile no.

Termux Auto OTP

It's possible to detect OTP message and get OTP in Termux without user input. use -aotp flag to invoke this feature.

You need to first setup termux to read sms.

1.Install Termux API apk from Fdroid

2.Install termux-api package

# Install termux-api package
$ pkg i termux-api
# To give permisiion
$ termux-list-sms
# Example
$ cowin-cli -s kerala -d alappuzha -sc -no 9123456789 -aotp

Scripts

Scripts are available for notifying and booking using cowin-cli here. You need to edit the vaules of the script like district name, mobile number etc..

Options

  -s	state State Name
  -d  district District name
  -version	Show version
  -h  Show Help

List Center:

  -b	
        show bookable only
  -c string
        date dd-mm-yyyy (default tomorrow's date)
  -i	
        full info
  -p string
        pincode
  -v string
        vaccine name
  -m int
        age

Book Vaccine:

    -sc
            invoke schedule vaccine mode
    -name string
            registered name           
    -no string
            mobile number
    -centers string seperated by ','
            centers to auto select
    -m int
            min age limit
    -slot string
            slot time (FORENOON default)
    -ntok
    	don't reuse token

Known issues

  • Random Unauthenticated access error for no reasons.

License

GPL 3.0

Copyright (c) Anoop S

Comments
  • Generate Token as a part of executing cowin-cli-notify-book.sh

    Generate Token as a part of executing cowin-cli-notify-book.sh

    Please advise the steps to be followed to make Token generation with support for Auto OTP for Token generation part of executing cowin-cli-notify-book.sh

    opened by jacobgeorge05 15
  • (Idea) Use token for listing centers

    (Idea) Use token for listing centers

    I've seen that when using the API for listing centers without the token, the data isn't up to date, it takes a little longer to get the centers. Using another script, when using token/adding authorization to the header even for the listing centers/public API, the data is more up to date, it gets the open centers faster.

    Do you think you could figure out a way to use the OTP generated token to search as well? Hence simulating a logged-in user?

    opened by ad1tyas 15
  • suggestion: only one time otp require

    suggestion: only one time otp require

    Hi Current scenario is: Search vaccination center>try to book center>receive OTP>Enter otp>Enter basic Details>Appointment is book OR Vaccination center is full If vaccination center is full then we have to follow again same above procedure, and it waste several seconds to book vaccination center because of new otp. So is that possible that using only one OTP to re-search vaccination center and try to book. in case vaccination center is full then we dont need to another otp, it just continue recent otp session and book vaccination center.

    opened by TonyStark 9
  • OTP not receiving v1.5.4

    OTP not receiving v1.5.4

    Hi Affected Version: v1.5.4 Problem: OTP not receiving --> I have tried two different numbers but i dont get OTP on both number. But on cowin portal everything works perfectly. So i think maybe api is blocking otp request or something else

    opened by TonyStark 8
  • Wrong commands and missing code in termux script

    Wrong commands and missing code in termux script

    This is a very nice project. Appreciate the effort. I noticed some bugs(I believe they are as I couldn't get them to work) and I am sharing them here.

    Notification script for automated termux script isn't available in code. The following line in the termux script should be changed appropriately for termux which I believe is cowin-cli COWIN_CLI="./cowin-cli"

    schedule function in the termux automated script is the following:

    schedule(){
    	"$COWIN_CLI" -s "$STATE" -d "$DISTRICT" -sc -no "$NO" -names "$NAMES" -centers "$CENTERS" -v "$VACCINE" -dose $DOSE -aotp  -c "$DATE" && exit 0 
    }
    

    It doesn't have -m "$AGE". But the script for linux have it.

    opened by NirmalManoj 6
  • Invalid District, Pincode (-p) returning with

    Invalid District, Pincode (-p) returning with "Unauthenticed Access"

    $ cowin-cli -p 423701 2021/05/21 17:16:03 Unauthenticated access!

    Furthermore my district or pincode not working.

    $ cowin-cli -s maharashtra -d aurangabad 2021/05/21 17:20:43 Invalid district!

    I am on "Termux" with Zero Coding Knowledge. Please help and how to notify/book by "Pincode"

    opened by profhacker3 4
  • Unable to run cowin-cli in karnataka

    Unable to run cowin-cli in karnataka

    Hey anoop, im a user from karnataka and im unable to run the precompiled version 1.4.7 and it shows tamilnadu and i want to run it in karnataka. Can you pls help ?

    opened by siddkothari 4
  • district name has space

    district name has space

    lets assume, if district name has space then how to make it work -d "district name" is not working example: -s punjab -d "sas nagar"

    $ ./cowin-cli.exe -sc -s punjab -d "sas nagar" -no 90000000
    2021/05/11 16:55:10 Invalid district!
    
    opened by TonyStark 4
  • Invalid district!

    Invalid district!

    I am trying to book a slot in south delhi district. Tried "south delhi" "south-delhi" "south_delhi" "southdelhi" but none of them work. How do i figure out the correct district name?

    opened by sahiliitm 3
  • Merge PR 14

    Merge PR 14

    Hey, could you merge this so the bot starts working again (without Chrome Inspect Token trickery)

    https://github.com/anoop142/cowin-cli/pull/14

    Thanks.

    opened by ad1tyas 3
  • Issue while booking

    Issue while booking

    Hi Anoop, The script is amazing I was able to book an appointment for my mum. But today when I tried to book I received a bad request error. Also, centre lists do not contain all available centres in districts.

    opened by nitishpanchpor 3
Releases(1.8.0)
Owner
Anoop S
Electrical Engineering Student @ Mar Athanasius College of Engineering
Anoop S
F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely. Written in Go!

F2 is a cross-platform command-line tool for batch renaming files and directories quickly and safely.

Ayooluwa 534 Sep 23, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

null 0 Nov 22, 2021
A CLI command to parse Terraform execution result and notify it to Backlog

tf2b Fork of mercari/tfnotify tf2b parses Terraform commands' execution result and applies it to an arbitrary template and then notifies it to Backlog

Yuichi Watanabe 1 Oct 15, 2021
Simple to do list API with Gin and Gorm (with Postgres)Simple to do list API with Gin and Gorm (with Postgres)

go-todo Simple to do list API with Gin and Gorm (with Postgres) Docker Clone this repository and run: docker-compose up You can then hit the followin

ansh-dev 5 Aug 29, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Clement Sam 2.1k Sep 22, 2022
A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints

Venky 0 Dec 22, 2021
mass-binding-target is a command line tool for generating binding target list by search plot files from disk.

mass-binding-target mass-binding-target is a command line tool for generating binding target list by search plot files from disk. Build Go 1.13 or new

null 0 Nov 5, 2021
A simple shopping list that keeps track of a users shopping list using charm.sh tools

Terminal Shopping List This repo is a practise project for learning practical Go. I have chosen to use a toolset called Charm as it provides a rich se

Ben Clarke 0 Jan 13, 2022
A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a proxy.

Fake-SMS A simple command line tool using which you can skip phone number based SMS verification by using a temporary phone number that acts like a pr

Narasimha Prasanna HN 726 Sep 23, 2022
The Todo List / Task Manager for Geeks in command line

The CLI To-Do List / Task Manager for Geeks ??‍?? Developer / DevOps / Sysadmin? A command line hero? ?? Live with the dark terminal? ?? Think in Mark

Anis uddin Ahmad 398 Sep 28, 2022
Package command provide simple API to create modern command-line interface

Package command Package command provide simple API to create modern command-line interface, mainly for lightweight usage, inspired by cobra Usage pack

chenen 0 Jan 16, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.

Table of contents Introduction Reference Contributing Introduction Overview git-xargs is a command-line tool (CLI) for making updates across multiple

Gruntwork 650 Sep 28, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command

git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command. You give git-xargs:

Maxar Infrastructure 1 Feb 5, 2022
A command line tool for simplified docker volume command built with go

dockervol A command line tool for simplified docker volume command built with go. Features: Remove anonymous volume (beta) Remove volume by matching n

Moh Achun Armando 0 Dec 18, 2021
fofax is a fofa query tool written in go, positioned as a command-line tool and characterized by simplicity and speed.

fofaX 0x00 Introduction fofax is a fofa query tool written in go, positioned as

null 461 Sep 24, 2022
wy : a set of command-line tools to test your container-based platform

wy wy (Abbreviation of Would You) is a set of command-line tools to test your container-based platform. ToC: Commands Deployment Monitoring Contributi

Yusuke Kuoka 2 Apr 30, 2022
A simple logging interface that supports cross-platform color and concurrency.

WLog Package wlog creates simple to use UI structure. The UI is used to simply print to the screen. There a wrappers that will wrap each other to crea

Will Dixon 59 Sep 26, 2022
traindown-cli is a command line tool for fitness data using the Traindrain specification.

traindown-cli traindown-cli is a command line tool for fitness data using Traindown. Installation go install github.com/OliverCardoza/[email protected]

Oliver Cardoza 1 Mar 13, 2022
🚤 Cross-platform, unofficial CLI for Cloudflare Warp

wgcf is an unofficial, cross-platform CLI for Cloudflare Warp

Victor 2.1k Sep 22, 2022