Exemplo n.º 1
0
Arquivo: helpers.py Projeto: Zypan/ahc
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
Arquivo: helpers.py Projeto: Zypan/ahc
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])
Exemplo n.º 4
0
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])
Exemplo n.º 5
0
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])
Exemplo n.º 6
0
Arquivo: helpers.py Projeto: Zypan/ahc
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
Arquivo: helpers.py Projeto: Zypan/ahc
def backFile(filename):
	bak_file = filename + '.bak'
	if not fileExists(bak_file):
		system_by_code('cp %s{,.bak}' % filename)
Exemplo n.º 10
0
def backFile(filename):
    bak_file = filename + ".bak"
    if not fileExists(bak_file):
        system_by_code("cp %s{,.bak}" % filename)
Exemplo n.º 11
0
def backFile(filename):
    bak_file = filename + '.bak'
    if not fileExists(bak_file):
        system_by_code('cp %s{,.bak}' % filename)