Cyberoam Python Login Logout Script

If you have a Wincable or any other Internet account that uses Cyberoam Software for login.. And u are pissed off by the Linux client that is buggy in terms of logging off or login.

Here is a python script (My first useful python program) that logs in and logs out correctly. Without leaving a trace of /tmp/

You can put the script in the $HOME/bin directory. So that it is visible in $PATH.


$ wincable start

$ wincable stop

You can alternatively download the script

Configuration of 2 variables is required

  • CLIENT_DIR – The directory in which crclient binary resides
  • USERNAME – Login name of the user
import os, time, sys

'''Tool to log into the wincable system, first checks if any
process is running, if yes, kills it and then invokes the binary client'''

#===================== CONFIGURATION ===================

CLIENT_DIR = '/home/rutu/crclient'
USERNAME = "rushiraj"



def startClient():
	print "Starting client ..."
	login = "./crclient -u " + USERNAME
	start = os.popen(login)

def removeFile():
		#Forcefully remove pid file if any
		os.popen("rm -fr /tmp/")

def stopClient():
	# Check for existing process, if found, terminate, kill
	p = os.popen("ps ax | grep 'crclient -u' | grep -v grep")
	pss =
	if (pss != ""):
		# process is running, try to terminate
		print "Terminating process ..."

		os.popen("./crclient -l")

#Check first argument
command = sys.argv[1]
if command == "start":
elif command == "stop":

# vim: set ft=python:

3 thoughts on “Cyberoam Python Login Logout Script”

    1. if your crclient script/file exists in /home/rutu/crclient/bin – then /home/rutu/crclient/bin is the residing directory

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.