def clearWebexPackage(): """clear webex package @param filePath: service path on windows @type filePath: string @return: operation result @rtype: tuple """ result = False,'clear package fail' if isWindows(): resultlist=[] resultlist=[] directoryList = ['C:\Users\Administrator\AppData\Local\Webex', 'C:\Users\Administrator\AppData\LocalLow\Webex', 'C:\ProgramData\Webex'] for dire in directoryList: print 'delete directory :' + dire p = subprocess.Popen(('rd /s /q '+dire),shell = True) ret = p.wait() print 'delete directory result :' + str(ret) p.kill() resultlist.append(ret) filePathList = [r'C:\Windows\Downloaded Program Files\ieatgpc.dll', r'C:\Users\Administrator\AppData\Roaming\Mozilla\plugins\npatgpc.dll', r'C:\Program Files\Google\Chrome\Application\Plugins\npatgpc.dll', r'C:\Program Files (x86)\Google\Chrome\Application\Plugins\npatgpc.dll', r'C:\Program Files\Mozilla Firefox\browser\plugins\npatgpc.dll', r'C:\Program Files (x86)\Mozilla Firefox\browser\plugins\npatgpc.dll', r'C:\Users\Administrator\AppData\Local\WebEx\ChromeNativeHost\ciscowebexstart.exe'] for file in filePathList: print 'delete file :' + file p = subprocess.Popen(('del /f /s /q /a '+'"'+file+'"'),shell = True) ret = p.wait() print 'delete file result :' + str(ret) p.kill() resultlist.append(ret) for resultT in resultlist: if resultT in [0,1,2]: result = True,'' elif isMacOSX(): resultlist=[] p6=subprocess.Popen('rm -rf ~/Library/Application\ Support/WebEx\ Folder',shell=True) ret6 = p6.wait() resultlist.append(ret6) for resultT in resultlist: if resultT in [0]: result = True,'' return result
def stopMeeting(self): """kill meeting process. @return: True when stop meeting successfully,otherwise return False and message @rtype: tuple """ if isWindows() : toKillProccessList = ["IEDriverServer.exe","chromedriver.exe"] resultlist = [] if self.serviceType.lower() == "mc" or self.serviceType.lower() == "ec" or self.serviceType.lower() == "tc" : toKillProccessList.append("atmgr.exe") elif self.serviceType.lower() == "sc": toKillProccessList.append("atscmgr.exe") toKillProccessList.append("OUTLOOK.EXE") for processName in toKillProccessList: p=subprocess.Popen(("taskkill /f /im " + processName),shell=True) ret = p.wait() resultlist.append(ret) for resultT in resultlist: if resultT not in [0]: return False,'stop meeting fail' return True,'' elif isMacOSX(): p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) out, err = p.communicate() if self.serviceType.lower() == "mc": processName = "Meeting Center" elif self.serviceType.lower() == "ec": processName = "Event Center" elif self.serviceType.lower() == "tc": processName = "Training Center" elif self.serviceType.lower() == "sc": processName = "Session Center" for line in out.splitlines(): # print line if processName in line: pid = int(line.split(None, 1)[0]) os.kill(pid, signal.SIGKILL) return True,''
try: _winreg.CreateKey(rootName, REG_PATH) registry_key = _winreg.OpenKey(rootName, REG_PATH, 0, _winreg.KEY_WRITE) if valueType == "REG_SZ": _winreg.SetValueEx(registry_key, name, 0, _winreg.REG_SZ, value) else: _winreg.SetValueEx(registry_key, name, 0, _winreg.REG_DWORD, value) _winreg.CloseKey(registry_key) return True except WindowsError, e: print "set regitry,error is :", e return False elif isMacOSX(): import plistlib try: plHandle = plistlib.readPlist(REG_PATH) if name in plHandle: if plHandle[name] == value: print "have exist " + name + ":" + value return tempDict[name] = value plistlib.writePlist(tempDict, REG_PATH) return True except Exception, e: print "set_reg error ,message :", e return False