From de000304ff6d5045cb9190bc7019e9d3b39adcea Mon Sep 17 00:00:00 2001 From: Paul Bowden Date: Tue, 23 Feb 2021 18:45:53 -0800 Subject: [PATCH] Delete Outlook_WebEx_Version.xml --- Outlook_WebEx_Version.xml | 68 --------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 Outlook_WebEx_Version.xml diff --git a/Outlook_WebEx_Version.xml b/Outlook_WebEx_Version.xml deleted file mode 100644 index e03cae2..0000000 --- a/Outlook_WebEx_Version.xml +++ /dev/null @@ -1,68 +0,0 @@ - -Outlook WebEx Version - -string - -#!/usr/bin/python - -import glob -import HTMLParser -import os -import re -import sys -from os.path import expanduser -from SystemConfiguration import SCDynamicStoreCopyConsoleUser - -def get_console_user(): - username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0] - username = [username,""][username in [u"loginwindow", None, u""]] - return username - -def does_folder_exist(path): - return os.path.isdir(path) - -def get_home_folder(username): - home_folder = expanduser('~' + str(username)) - if does_folder_exist(home_folder): - return home_folder - return None - -def get_outlook_log_filename(home_folder): - log_folder = os.path.join(home_folder, 'Library/Containers/com.microsoft.Outlook/Data/Library/Caches/Microsoft/uls/com.microsoft.Outlook/logs') - if does_folder_exist(log_folder): - log_files = glob.glob(log_folder + '/*.log') - if len(log_files) != 0: - return str(log_files[0]) - return None - -def grep_outlook_log(filename): - with open(filename) as log_file: - for line in log_file: - webex = re.findall(r'"WebExVersion":', line) - valid = re.findall(r'Valid WebEx version found', line) - invalid = re.findall(r'Invalid WebEx version found', line) - ver = re.findall(r'"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})"', line) - if webex and ver and invalid: - return str(ver[0] + ' [blocked]') - if webex and ver and valid: - return str(ver[0]) - return 'Not present' - -## MAIN -console_user = get_console_user() -webex_version = 'Not present' -if console_user: - home_folder = get_home_folder(console_user) - if home_folder: - outlook_log = get_outlook_log_filename(home_folder) - if outlook_log: - webex_version = grep_outlook_log(outlook_log) - -html_parser = HTMLParser.HTMLParser() -result = html_parser.unescape('<result>') + str(webex_version) + html_parser.unescape('</result>') -print(result) - -sys.exit(0) - - - \ No newline at end of file