def main(unused_args): # Allow per platform configuration. config.CONFIG.AddContext( contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() errors = config.CONFIG.Validate(["Client", "CA", "Logging"]) if errors and list(iterkeys(errors.keys)) != ["Client.private_key"]: raise config_lib.ConfigFormatError(errors) if config.CONFIG["Client.fleetspeak_enabled"]: raise ValueError( "This is not a Fleetspeak client, yet 'Client.fleetspeak_enabled' is " "set to 'True'.") enrollment_necessary = not config.CONFIG.Get("Client.private_key") # Instantiating the client will create a private_key so we need to use a flag. client = comms.GRRHTTPClient(ca_cert=config.CONFIG["CA.certificate"], private_key=config.CONFIG.Get( "Client.private_key", default=None)) if enrollment_necessary: logging.info("No private key found, starting enrollment.") client.InitiateEnrolment() if flags.FLAGS.break_on_start: pdb.set_trace() else: client.Run()
def main(unused_args): client_plugins.RegisterPlugins() if flags.FLAGS.remote_debugging_port: _start_remote_debugging(flags.FLAGS.remote_debugging_port) elif flags.FLAGS.break_on_start: pdb.set_trace() if (flags.FLAGS.unprivileged_server_pipe_input != -1 and flags.FLAGS.unprivileged_server_pipe_output != -1 and flags.FLAGS.unprivileged_server_interface): communication.Main( communication.Channel.FromSerialized( pipe_input=flags.FLAGS.unprivileged_server_pipe_input, pipe_output=flags.FLAGS.unprivileged_server_pipe_output), interface_registry.GetConnectionHandlerForInterfaceString( flags.FLAGS.unprivileged_server_interface), flags.FLAGS.unprivileged_user, flags.FLAGS.unprivileged_group) return # Allow per platform configuration. config.CONFIG.AddContext( contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() sys.exit(0) if config.CONFIG["Client.fleetspeak_enabled"]: fleetspeak_client.GRRFleetspeakClient().Run() return errors = config.CONFIG.Validate(["Client", "CA", "Logging"]) if errors and list(errors.keys()) != ["Client.private_key"]: raise config_lib.ConfigFormatError(errors) if config.CONFIG["Client.fleetspeak_enabled"]: raise ValueError( "This is not a Fleetspeak client, yet 'Client.fleetspeak_enabled' is " "set to 'True'.") enrollment_necessary = not config.CONFIG.Get("Client.private_key") # Instantiating the client will create a private_key so we need to use a flag. client = comms.GRRHTTPClient(ca_cert=config.CONFIG["CA.certificate"], private_key=config.CONFIG.Get( "Client.private_key", default=None)) if enrollment_necessary: logging.info("No private key found, starting enrollment.") client.InitiateEnrolment() client.Run()
def main(unused_args): client_plugins.RegisterPlugins() if flags.FLAGS.remote_debugging_port: _start_remote_debugging(flags.FLAGS.remote_debugging_port) elif flags.FLAGS.break_on_start: pdb.set_trace() # Allow per platform configuration. config.CONFIG.AddContext( contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() sys.exit(0) is_pyinstaller_binary = getattr(sys, "frozen", False) if is_pyinstaller_binary and platform.system() == "Windows": # Since `Client.install_path` is shared with the Sandbox, Sandbox # initialization makes only sense if we run from a proper installation. # This is the case if this is a PyInstaller binary. sandbox.InitSandbox( "{}_{}".format(config.CONFIG["Client.name"], config.CONFIG["Source.version_string"]), [config.CONFIG["Client.install_path"]]) if config.CONFIG["Client.fleetspeak_enabled"]: fleetspeak_client.GRRFleetspeakClient().Run() return errors = config.CONFIG.Validate(["Client", "CA", "Logging"]) if errors and list(errors.keys()) != ["Client.private_key"]: raise config_lib.ConfigFormatError(errors) if config.CONFIG["Client.fleetspeak_enabled"]: raise ValueError( "This is not a Fleetspeak client, yet 'Client.fleetspeak_enabled' is " "set to 'True'.") enrollment_necessary = not config.CONFIG.Get("Client.private_key") # Instantiating the client will create a private_key so we need to use a flag. client = comms.GRRHTTPClient(ca_cert=config.CONFIG["CA.certificate"], private_key=config.CONFIG.Get( "Client.private_key", default=None)) if enrollment_necessary: logging.info("No private key found, starting enrollment.") client.InitiateEnrolment() client.Run()
def main(unused_args): config.CONFIG.AddContext( contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() if flags.FLAGS.break_on_start: pdb.set_trace() else: fleetspeak_client.GRRFleetspeakClient().Run()
def main(unused_args): if flags.FLAGS.remote_debugging_port: _start_remote_debugging(flags.FLAGS.remote_debugging_port) elif flags.FLAGS.break_on_start: pdb.set_trace() if flags.FLAGS.filesystem_server_socket != -1: communication.Main(flags.FLAGS.filesystem_server_socket, server_lib.Dispatch) return # Allow per platform configuration. config.CONFIG.AddContext(contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() sys.exit(0) if config.CONFIG["Client.fleetspeak_enabled"]: fleetspeak_client.GRRFleetspeakClient().Run() return errors = config.CONFIG.Validate(["Client", "CA", "Logging"]) if errors and list(errors.keys()) != ["Client.private_key"]: raise config_lib.ConfigFormatError(errors) if config.CONFIG["Client.fleetspeak_enabled"]: raise ValueError( "This is not a Fleetspeak client, yet 'Client.fleetspeak_enabled' is " "set to 'True'.") enrollment_necessary = not config.CONFIG.Get("Client.private_key") # Instantiating the client will create a private_key so we need to use a flag. client = comms.GRRHTTPClient( ca_cert=config.CONFIG["CA.certificate"], private_key=config.CONFIG.Get("Client.private_key", default=None)) if enrollment_necessary: logging.info("No private key found, starting enrollment.") client.InitiateEnrolment() client.Run()
def main(unused_args): config.CONFIG.AddContext(contexts.CLIENT_CONTEXT, "Context applied when we run the client process.") client_startup.ClientInit() if flags.FLAGS.install: installer.RunInstaller() if not config.CONFIG["Client.fleetspeak_enabled"]: raise ValueError( "This is a Fleetspeak client, yet 'Client.fleetspeak_enabled' is " "'False'.") if flags.FLAGS.break_on_start: pdb.set_trace() else: fleetspeak_client.GRRFleetspeakClient().Run()