#!/usr/bin/python ''' Name: checkgmail.py Created by: Tyler Reguly (ht@computerdefense.org) Date Created: April 27th, 2006 Functional Spec: Provide command line access to gmail. Details and examples @ www.computerdefense.org) ''' import libgmail, sys, getopt, getpass def parseArgs(): try: opts, args = getopt.getopt(sys.argv[1:], "aruhL:F:RSCQ:N:U:P:") except getopt.GetoptError: showHelp() global password global type global label global showMsg global address global showSubject global showCount global query global displayCount global username password = None type = "UNREAD" label = "inbox" showMsg = False address = None showSubject = False showCount = False query = None username = None displayCount = None for o, a in opts: if ( o == "-a" ): type = "ALL" elif ( o == "-u" ): type = "UNREAD" elif ( o == "-r" ): type = "READ" if ( o == "-L" ): label = a if ( o == "-F"): address = a if ( o == "-R" ): showMsg = True if ( o == "-S" ): showSubject = True if ( o == "-C" ): showCount = True if ( o == "-Q" ): query = a if ( o == "-U" ): username = a if ( o == "-P" ): password = a if ( o == "-N" ): displayCount = a if (o == "-h" ): showHelp() def showHelp(): print "Usage: "+ sys.argv[0] + "