def renameProcess(name, libc = None): try: if int(log(maxsize, 2)) == 63: libc = '/lib/x86_64-linux-gnu/libc.so.6' if not fileExists(libc): libc = '/lib64/libc.so.6' if not fileExists(libc): libc = '/lib/libc.so.6' else: libc = '/lib/i386-linux-gnu/libc.so.6' if not fileExists(libc): libc = '/lib32/libc.so.6' if not fileExists(libc): libc = '/lib/libc.so.6' if libc: CDLL(libc).prctl(15, name, 0, 0, 0) return True except Exception, msg: pass
def renameProcess(name, libc=None): try: if int(log(maxsize, 2)) == 63: libc = '/lib/x86_64-linux-gnu/libc.so.6' if not fileExists(libc): libc = '/lib64/libc.so.6' if not fileExists(libc): libc = '/lib/libc.so.6' else: libc = '/lib/i386-linux-gnu/libc.so.6' if not fileExists(libc): libc = '/lib32/libc.so.6' if not fileExists(libc): libc = '/lib/libc.so.6' if libc: CDLL(libc).prctl(15, name, 0, 0, 0) return True except Exception, msg: pass
def checkInstall(config, custom_rules=None): default_rules = { config['bin']: 'Service not installed!', config['init']: 'Init file not found!', config['config']: 'Config file not found!' } if custom_rules: default_rules.update(custom_rules) for key in default_rules.keys(): if not fileExists(key): error_message(default_rules[key])
def checkInstall(config, custom_rules=None): default_rules = { config["bin"]: "Service not installed!", config["init"]: "Init file not found!", config["config"]: "Config file not found!", } if custom_rules: default_rules.update(custom_rules) for key in default_rules.keys(): if not fileExists(key): error_message(default_rules[key])
def checkInstall(config, custom_rules=None): default_rules = { config['bin']: 'Service not installed!', config['init']: 'Init file not found!', config['config']: 'Config file not found!' } if custom_rules: default_rules.update(custom_rules) for key in default_rules.keys(): if not fileExists(key): error_message(default_rules[key])
def hosts(action='add', host=None, filename='/etc/hosts'): if host and fileExists(filename): new_data = '' for line in getFileArr(filename): gh = lambda e: line.split(e)[-1:][0].strip() if line and host not in(gh('\t'), gh('www.')): new_data += '%s\n' % line.strip() if action == 'add': new_data += '127.0.0.1\t%s\n' % host new_data += '127.0.0.1\twww.%s\n' % host if putFile(filename, new_data): return True return False
def hosts(action="add", host=None, filename="/etc/hosts"): if host and fileExists(filename): new_data = "" for line in getFileArr(filename): gh = lambda e: line.split(e)[-1:][0].strip() if line and host not in (gh("\t"), gh("www.")): new_data += "%s\n" % line.strip() if action == "add": new_data += "127.0.0.1\t%s\n" % host new_data += "127.0.0.1\twww.%s\n" % host if putFile(filename, new_data): return True return False
def hosts(action='add', host=None, filename='/etc/hosts'): if host and fileExists(filename): new_data = '' for line in getFileArr(filename): gh = lambda e: line.split(e)[-1:][0].strip() if line and host not in (gh('\t'), gh('www.')): new_data += '%s\n' % line.strip() if action == 'add': new_data += '127.0.0.1\t%s\n' % host new_data += '127.0.0.1\twww.%s\n' % host if putFile(filename, new_data): return True return False
def backFile(filename): bak_file = filename + '.bak' if not fileExists(bak_file): system_by_code('cp %s{,.bak}' % filename)
def backFile(filename): bak_file = filename + ".bak" if not fileExists(bak_file): system_by_code("cp %s{,.bak}" % filename)
def backFile(filename): bak_file = filename + '.bak' if not fileExists(bak_file): system_by_code('cp %s{,.bak}' % filename)