Linux

ZOLPhone Balance & Usage Check script

ZOL Zimbabwe operate a voip platform – HERE

If you work with a number of DID’s, it quickly becomes tedious to login to the portal and check your online balance/usage.
After a colleague sent me his perl script getting the balance off the CRM’s portal, i gave it a shot through bash.
Here is the results of that project.

The Download link is at the bottom of the page.


This script is not in any way a ZOL product, nor is it endorsed by ZOL. Use it at your own discretion & risk.


Usage Example


Usage ./bc -u='USER' -p='PASS' -ot|--output-totals -v|--verbose

[[email protected] ~]# ./bc -u='keith' -p='######'
$0.99

[[email protected] ~]# ./bc -u='keith' -p='######' -v
using keith and ######
Displaying current monthly usage only.
$0.99

[[email protected] ~]# ./bc -u='keith' -p='######' -v -ot
using keith and ######
Displaying overall usage only.
$1.42

CODE


#!/bin/bash
# ZOLPhone Balance Check Script (voip.zol.co.zw)
# Keith Rose - www.keithro.se
# Email [email protected]
# Mobile - +263 772 375 600
# Public Domain. Do as you wish. 

# USE AT YOUR OWN RISK


DISPLAYTOTAL=0;VERBOSE=0
for i in "[email protected]"
do
case $i in
  -u=*|--username=*)
  USER="${i#*=}"
  shift
  ;;
  -p=*|--password=*)
  PASS="${i#*=}"
  shift
  ;;
  -ot|--output-totals)
  DISPLAYTOTAL=1
  shift
  ;;
  -v|--verbose)
  VERBOSE=1
  shift
  ;;
esac
done
if [[ -z $USER || -z $PASS  ]]; then
 echo "Usage ./bc -u='USER' -p='PASS' -ot|--output-totals -v|--verbose";
else
 if [ "$VERBOSE" -gt 0 ]; then echo using $USER and $PASS;fi
 if [ "$DISPLAYTOTAL" -gt 0 ]; then
  BAL=$(wget -qO- --post-data "login=$USER&password=$PASS&pin=&image=Login&run=log&run2=log&b=0&p=0" http://voip.zol.co.zw/cgi-bin/if.cgi |  sed -n "/

\(.*\).*:\1:p'); if [ "$VERBOSE" -gt 0 ]; then echo "Displaying overall usage only."; fi echo $BAL else BAL=$(wget -qO- --post-data "login=$USER&password=$PASS&pin=&image=Login&run=log&run2=log&b=0&p=0" http://voip.zol.co.zw/cgi-bin/if.cgi | sed -n 's:.*
\(.*\).*:\1:p' | sed -n -e '/^\$/p'); if [ "$VERBOSE" -gt 0 ]; then echo "Displaying current monthly usage only.";fi echo $BAL fi # End of #DisplayTotal fi

Download here – ZOL Balance Check Script

Leave a Reply

Your email address will not be published. Required fields are marked *