Exemple #1
0
    def __init__(self, app_name):

        if os.geteuid() != 0:
            sys.exit("TopPatch Agent must be run as root.")

        self.app_name = app_name
        self.registered_plugins = {}

        settings.initialize(self.app_name)

        self.found_plugins = self.load_plugins(settings.PluginDirectory)
        self.register_plugins()
Exemple #2
0
    def __init__(self, app_name):

        if os.geteuid() != 0:
            sys.exit("TopPatch Agent must be run as root.")

        self.app_name = app_name
        self.registered_plugins = {}

        settings.initialize(self.app_name)

        self.found_plugins = self.load_plugins(settings.PluginDirectory)
        self.register_plugins()
Exemple #3
0
import subprocess
import sys
import os
import time
from collections import namedtuple

sys.path.append(os.path.join(os.getcwd(), "src"))

from utils import settings
from utils import logger

settings.initialize('watcher')

original_plist = '/opt/TopPatch/agent/daemon/com.toppatch.agent.plist'
osx_plist = '/System/Library/LaunchDaemons/com.toppatch.agent.plist'
daemon_label = 'com.toppatch.agent'
cp_command = ['/bin/cp', original_plist, osx_plist]
list_command = ['/bin/launchctl', 'list']
load_command = ['/bin/launchctl', 'load', '-w', osx_plist]
unload_command = ['/bin/launchctl', 'unload', '-w', osx_plist]
start_command = ['/bin/launchctl', 'start', daemon_label]
stop_command = ['/bin/launchctl', 'stop', daemon_label]

check_in_seconds = 60

def start_agent():

    result = False
    try:

        process = subprocess.Popen(start_command, stdout=subprocess.PIPE,
Exemple #4
0
import subprocess
import sys
import os
import time
from collections import namedtuple

sys.path.append(os.path.join(os.getcwd(), "src"))

from utils import settings
from utils import logger

settings.initialize('watcher')

original_plist = '/opt/TopPatch/agent/daemon/com.toppatch.agent.plist'
osx_plist = '/System/Library/LaunchDaemons/com.toppatch.agent.plist'
daemon_label = 'com.toppatch.agent'
cp_command = ['/bin/cp', original_plist, osx_plist]
list_command = ['/bin/launchctl', 'list']
load_command = ['/bin/launchctl', 'load', '-w', osx_plist]
unload_command = ['/bin/launchctl', 'unload', '-w', osx_plist]
start_command = ['/bin/launchctl', 'start', daemon_label]
stop_command = ['/bin/launchctl', 'stop', daemon_label]

check_in_seconds = 60


def start_agent():

    result = False
    try: