text
stringlengths
81
112k
Given a file, this will return all potenial APT source URIs. def FindPotentialURIs(self, file_obj): """Given a file, this will return all potenial APT source URIs.""" rfc822_format = "" # will contain all lines not in legacy format uris_to_parse = [] for line in utils.ReadFileBytesAsUnicode(file_obj)...
Extracts keyword/value settings from the ntpd config. The keyword is always the first entry item. Values are the remainder of the entries. In cases where an ntpd config allows multiple values, these are split according to whitespace or duplicate entries. Keywords and values are normalized. Keyword...
Parse a ntp config into rdf. def Parse(self, stat, file_object, knowledge_base): """Parse a ntp config into rdf.""" _, _ = stat, knowledge_base # TODO(hanuszczak): This parser only allows single use because it messes # with its state. This should be fixed. field_parser = NtpdFieldParser() for ...
Extract a list from the given fields. def _ExtractList(self, fields, ignores=(",",), terminators=()): """Extract a list from the given fields.""" extracted = [] i = 0 for i, field in enumerate(fields): # Space-separated comma; ignore, but this is not a finished list. # Similar for any other...
Parse an entry and add it to the given SudoersConfig rdfvalue. def ParseSudoersEntry(self, entry, sudoers_config): """Parse an entry and add it to the given SudoersConfig rdfvalue.""" key = entry[0] if key in SudoersFieldParser.ALIAS_TYPES: # Alias. alias_entry = rdf_config_file.SudoersAlias( ...
Preprocess the given data, ready for parsing. def Preprocess(self, data): """Preprocess the given data, ready for parsing.""" # Add whitespace to line continuations. data = data.replace(":\\", ": \\") # Strip comments manually because sudoers has multiple meanings for '#'. data = SudoersFieldParse...
Validate an RDFValue instance. Args: value: An RDFValue instance or something which may be used to instantiate the correct instance. Raises: TypeValueError: If the value is not a valid RDFValue instance or the required type. Returns: A Valid RDFValue instance. def Valid...
Validate the value. Args: value: Value is expected to be a dict-like object that a given RDFStruct can be initialized from. Raises: TypeValueError: If the value is not a valid dict-like object that a given RDFStruct can be initialized from. Returns: A valid instance of s...
Returns a copy of this set with a new element added. def Add(self, other): """Returns a copy of this set with a new element added.""" new_descriptors = [] for desc in self.descriptors + other.descriptors: if desc not in new_descriptors: new_descriptors.append(desc) return TypeDescriptorS...
Append the descriptor to this set. def Append(self, desc): """Append the descriptor to this set.""" if desc not in self.descriptors: self.descriptors.append(desc) self.descriptor_map[desc.name] = desc self.descriptor_names.append(desc.name)
Returns a copy of this set without elements with given names. def Remove(self, *descriptor_names): """Returns a copy of this set without elements with given names.""" new_descriptor_map = self.descriptor_map.copy() for name in descriptor_names: new_descriptor_map.pop(name, None) new_descriptors ...
Parse and validate the args. Note we pop all the args we consume here - so if there are any args we dont know about, args will not be an empty dict after this. This allows the same args to be parsed by several TypeDescriptorSets. Args: args: A dictionary of arguments that this TypeDescriptorSet ...
Parse a bool from a string. def FromString(self, string): """Parse a bool from a string.""" if string.lower() in ("false", "no", "n"): return False if string.lower() in ("true", "yes", "y"): return True raise TypeValueError("%s is not recognized as a boolean value." % string)
Validate a potential list. def Validate(self, value): """Validate a potential list.""" if isinstance(value, string_types): raise TypeValueError("Value must be an iterable not a string.") elif not isinstance(value, (list, tuple)): raise TypeValueError("%r not a valid List" % value) # Valid...
Adds all known parsers to the registry. def Register(): """Adds all known parsers to the registry.""" # pyformat: disable # Command parsers. parsers.SINGLE_RESPONSE_PARSER_FACTORY.Register( "Dpkg", linux_cmd_parser.DpkgCmdParser) parsers.SINGLE_RESPONSE_PARSER_FACTORY.Register( "Dmidecode", linu...
Get the rdfurn of the current audit log. def _CurrentAuditLog(): """Get the rdfurn of the current audit log.""" now_sec = rdfvalue.RDFDatetime.Now().AsSecondsSinceEpoch() rollover_seconds = AUDIT_ROLLOVER_TIME.seconds # This gives us a filename that only changes every # AUDIT_ROLLOVER_TIfilME seconds, but is...
Attempt to coerce string into a unicode object. def UnicodeFromCodePage(string): """Attempt to coerce string into a unicode object.""" # get the current code page codepage = ctypes.windll.kernel32.GetOEMCP() try: return string.decode("cp%s" % codepage) except UnicodeError: try: return string.de...
Enumerate all MAC addresses of all NICs. Args: args: Unused. Yields: `rdf_client_network.Interface` instances. def EnumerateInterfacesFromClient(args): """Enumerate all MAC addresses of all NICs. Args: args: Unused. Yields: `rdf_client_network.Interface` instances. """ del args # Unu...
List all local filesystems mounted on this system. def EnumerateFilesystemsFromClient(args): """List all local filesystems mounted on this system.""" del args # Unused. for drive in win32api.GetLogicalDriveStrings().split("\x00"): if not drive: continue try: volume = win32file.GetVolumeNameF...
Query service and get its config. def QueryService(svc_name): """Query service and get its config.""" hscm = win32service.OpenSCManager(None, None, win32service.SC_MANAGER_ALL_ACCESS) result = None try: hs = win32serviceutil.SmartOpenService(hscm, svc_name, ...
Run the WMI query and return the data. def WmiQueryFromClient(args): """Run the WMI query and return the data.""" query = args.query base_object = args.base_object or r"winmgmts:\root\cimv2" if not query.upper().startswith("SELECT "): raise RuntimeError("Only SELECT WMI queries allowed.") for response_...
Run a WMI query and return a result. Args: query: the WMI query to run. baseobj: the base object for the WMI query. Yields: rdf_protodict.Dicts containing key value pairs from the resulting COM objects. def RunWMIQuery(query, baseobj=r"winmgmts:\root\cimv2"): """Run a WMI query and return a res...
Estimate the install date of this system. def Run(self, unused_args): """Estimate the install date of this system.""" # Don't use winreg.KEY_WOW64_64KEY since it breaks on Windows 2000 subkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows NT\\CurrentVe...
This kills us with no cleanups. def Run(self, unused_arg): """This kills us with no cleanups.""" logging.debug("Disabling service") win32serviceutil.ChangeServiceConfig( None, config.CONFIG["Nanny.service_name"], startType=win32service.SERVICE_DISABLED) svc_config = QueryServic...
This calls the Windows OpenKeyEx function in a Unicode safe way. def OpenKey(key, sub_key): """This calls the Windows OpenKeyEx function in a Unicode safe way.""" regopenkeyex = advapi32["RegOpenKeyExW"] regopenkeyex.restype = ctypes.c_long regopenkeyex.argtypes = [ ctypes.c_void_p, ctypes.c_wchar_p, cty...
This calls the Windows RegQueryInfoKey function in a Unicode safe way. def QueryInfoKey(key): """This calls the Windows RegQueryInfoKey function in a Unicode safe way.""" regqueryinfokey = advapi32["RegQueryInfoKeyW"] regqueryinfokey.restype = ctypes.c_long regqueryinfokey.argtypes = [ ctypes.c_void_p, c...
This calls the Windows QueryValueEx function in a Unicode safe way. def QueryValueEx(key, value_name): """This calls the Windows QueryValueEx function in a Unicode safe way.""" regqueryvalueex = advapi32["RegQueryValueExW"] regqueryvalueex.restype = ctypes.c_long regqueryvalueex.argtypes = [ ctypes.c_voi...
This calls the Windows RegEnumKeyEx function in a Unicode safe way. def EnumKey(key, index): """This calls the Windows RegEnumKeyEx function in a Unicode safe way.""" regenumkeyex = advapi32["RegEnumKeyExW"] regenumkeyex.restype = ctypes.c_long regenumkeyex.argtypes = [ ctypes.c_void_p, ctypes.wintypes.D...
This calls the Windows RegEnumValue function in a Unicode safe way. def EnumValue(key, index): """This calls the Windows RegEnumValue function in a Unicode safe way.""" regenumvalue = advapi32["RegEnumValueW"] regenumvalue.restype = ctypes.c_long regenumvalue.argtypes = [ ctypes.c_void_p, ctypes.wintypes...
Converts a Windows Registry value to the corresponding Python data type. def _Reg2Py(data, size, data_type): """Converts a Windows Registry value to the corresponding Python data type.""" if data_type == winreg.REG_DWORD: if size == 0: return 0 # DWORD is an unsigned 32-bit integer, see: # https:...
List the names of all keys and values. def ListNames(self): """List the names of all keys and values.""" # TODO: This check is flawed, because the current definition of # "IsDirectory" is the negation of "is a file". One registry path can # actually refer to a key ("directory"), a value of the same na...
A generator of all keys and values. def ListFiles(self, ext_attrs=None): """A generator of all keys and values.""" del ext_attrs # Unused. if not self.IsDirectory(): return if self.hive is None: for name in dir(winreg): if name.startswith("HKEY_"): response = rdf_client...
This creates a File or a Directory from a stat response. def CreateAFF4Object(stat_response, client_id_urn, mutation_pool, token=None): """This creates a File or a Directory from a stat response.""" urn = stat_response.pathspec.AFF4Path(client_id_urn) if stat.S_ISDIR(stat_response.st_mode): ftype = standar...
Filters out duplicates from passed PathInfo objects. Args: path_infos: An iterable with PathInfo objects. Returns: A list of PathInfo objects with duplicates removed. Duplicates are removed following this logic: they're sorted by (ctime, mtime, atime, inode number) in the descending order and then...
Persists information about stat entries. Args: stat_entries: A list of `StatEntry` instances. client_id: An id of a client the stat entries come from. mutation_pool: A mutation pool used for writing into the AFF4 data store. token: A token used for writing into the AFF4 data store. def WriteStatEntr...
Starts the Glob. This is the main entry point for this flow mixin. First we convert the pattern into regex components, and then we interpolate each component. Finally, we generate a cartesian product of all combinations. Args: paths: A list of GlobExpression instances. pathtype: The p...
Called when we've found a matching a StatEntry. def GlobReportMatch(self, stat_response): """Called when we've found a matching a StatEntry.""" # By default write the stat_response to the AFF4 VFS. with data_store.DB.GetMutationPool() as pool: WriteStatEntries([stat_response], ...
r"""Converts a glob pattern into a list of pathspec components. Wildcards are also converted to regular expressions. The pathspec components do not span directories, and are marked as a regex or a literal component. We also support recursion into directories using the ** notation. For example, /home/...
Find the node in the component_tree from component_path. Args: component_path: A list of components which reference a node in the component tree. This allows us to resume processing in the tree. Returns: A node in the component_tree. def FindNode(self, component_path): """Find the nod...
Check if the responses matches the pathspec (considering options). def _MatchPath(self, pathspec, response): """Check if the responses matches the pathspec (considering options).""" to_match = response.pathspec.Basename() if pathspec.path_options == rdf_paths.PathSpec.Options.CASE_INSENSITIVE: return...
Process the responses from the client. def ProcessEntry(self, responses): """Process the responses from the client.""" if not responses.success: return # The Find client action does not return a StatEntry but a # FindSpec. Normalize to a StatEntry. stat_responses = [ r.hit if isinsta...
Query the database file. def Query(self, sql_query): """Query the database file.""" results = {} try: self._connection = sqlite.connect(self.name) self._connection.execute("PRAGMA journal_mode=%s" % self.journal_mode) self._cursor = self._connection.cursor() results = self._cursor....
Gets all client_ids for a given list of hostnames or FQDNS. Args: hostnames: A list of hostnames / FQDNs. token: An ACL token. Returns: A dict with a list of all known GRR client_ids for each hostname. def GetClientURNsForHostnames(hostnames, token=None): """Gets all client_ids for a given list of ...
Return most recent client from list of clients. def GetMostRecentClient(client_list, token=None): """Return most recent client from list of clients.""" last = rdfvalue.RDFDatetime(0) client_urn = None for client in aff4.FACTORY.MultiOpen(client_list, token=token): client_last = client.Get(client.Schema.LAS...
Assign a label to a group of clients based on hostname. Sets a label as an identifier to a group of clients. Removes the label from other clients. This can be used to automate labeling clients based on externally derived attributes, for example machines assigned to particular users, or machines fulfilling p...
Returns a list of client URNs associated with keywords. Args: keywords: The list of keywords to search by. Returns: A list of client URNs. Raises: ValueError: A string (single keyword) was passed instead of an iterable. def LookupClients(self, keywords): """Returns a list of client...
Looks up all clients associated with any of the given keywords. Args: keywords: A list of keywords we are interested in. Returns: A dict mapping each keyword to a list of matching clients. def ReadClientPostingLists(self, keywords): """Looks up all clients associated with any of the given key...
Finds the client_id and keywords for a client. Args: client: A VFSGRRClient record to find keywords for. Returns: A tuple (client_id, keywords) where client_id is the client identifier and keywords is a list of keywords related to client. def AnalyzeClient(self, client): """Finds the clie...
Adds a client to the index. Args: client: A VFSGRRClient record to add or update. def AddClient(self, client): """Adds a client to the index. Args: client: A VFSGRRClient record to add or update. """ client_id, keywords = self.AnalyzeClient(client) self.AddKeywordsForName(client_...
Removes all labels for a given client object. Args: client: A VFSGRRClient record. def RemoveClientLabels(self, client): """Removes all labels for a given client object. Args: client: A VFSGRRClient record. """ keywords = [] for label in client.GetLabelsNames(): keyword = se...
Extracts a start time from a list of keywords if present. def _AnalyzeKeywords(self, keywords): """Extracts a start time from a list of keywords if present.""" start_time = rdfvalue.RDFDatetime.Now() - rdfvalue.Duration("180d") filtered_keywords = [] for k in keywords: if k.startswith(self.START...
Returns a list of client URNs associated with keywords. Args: keywords: The list of keywords to search by. Returns: A list of client URNs. Raises: ValueError: A string (single keyword) was passed instead of an iterable. def LookupClients(self, keywords): """Returns a list of client...
Looks up all clients associated with any of the given keywords. Args: keywords: A list of keywords we are interested in. Returns: A dict mapping each keyword to a list of matching clients. def ReadClientPostingLists(self, keywords): """Looks up all clients associated with any of the given key...
Finds the client_id and keywords for a client. Args: client: A Client object record to find keywords for. Returns: A list of keywords related to client. def AnalyzeClient(self, client): """Finds the client_id and keywords for a client. Args: client: A Client object record to find k...
Adds a client to the index. Args: client: A Client object record. def AddClient(self, client): """Adds a client to the index. Args: client: A Client object record. """ keywords = self.AnalyzeClient(client) keywords.add(self._NormalizeKeyword(client.client_id)) data_store.REL_...
Removes all labels for a given client. Args: client_id: The client_id. def RemoveAllClientLabels(self, client_id): """Removes all labels for a given client. Args: client_id: The client_id. """ labels_to_remove = set( [l.name for l in data_store.REL_DB.ReadClientLabels(client_i...
Removes all labels for a given client. Args: client_id: The client_id. labels: A list of labels to remove. def RemoveClientLabels(self, client_id, labels): """Removes all labels for a given client. Args: client_id: The client_id. labels: A list of labels to remove. """ for...
Verifies the message list signature. In the server we check that the timestamp is later than the ping timestamp stored with the client. This ensures that client responses can not be replayed. Args: response_comms: The raw response_comms rdfvalue. packed_message_list: The PackedMessageList ...
Verifies the message list signature. In the server we check that the timestamp is later than the ping timestamp stored with the client. This ensures that client responses can not be replayed. Args: response_comms: The raw response_comms rdfvalue. packed_message_list: The PackedMessageList ...
Processes a queue of messages as passed from the client. We basically dispatch all the GrrMessages in the queue to the task scheduler for backend processing. We then retrieve from the TS the messages destined for this client. Args: request_comms: A ClientCommunication rdfvalue with messages sen...
Drains the client's Task Scheduler queue. 1) Get all messages in the client queue. 2) Sort these into a set of session_ids. 3) Use data_store.DB.ResolvePrefix() to query all requests. 4) Delete all responses for retransmitted messages (if needed). Args: client: The ClientURN object specifyi...
Enrols a Fleetspeak-enabled client for use with GRR. Args: client_id: GRR client-id for the client. Returns: True if the client is new, and actually got enrolled. This method is a no-op if the client already exists (in which case False is returned). def EnrolFleetspeakClient(self, client_id...
Receives and processes messages for flows stored in the relational db. Args: client_id: The client which sent the messages. messages: A list of GrrMessage RDFValues. def ReceiveMessagesRelationalFlows(self, client_id, messages): """Receives and processes messages for flows stored in the relational...
Receives and processes the messages from the source. For each message we update the request object, and place the response in that request's queue. If the request is complete, we send a message to the worker. Args: client_id: The client which sent the messages. messages: A list of GrrMessa...
Hands off messages to well known flows. def HandleWellKnownFlows(self, messages): """Hands off messages to well known flows.""" msgs_by_wkf = {} result = [] for msg in messages: # Regular message - queue it. if msg.response_id != 0: result.append(msg) continue # Well ...
Executes one of the predefined commands. Args: command: An `ExecuteRequest` object. Yields: `rdf_client_action.ExecuteResponse` objects. def ExecuteCommandFromClient(command): """Executes one of the predefined commands. Args: command: An `ExecuteRequest` object. Yields: `rdf_client_action...
Call os.statvfs for a given list of paths. Args: args: An `rdf_client_action.StatFSRequest`. Yields: `rdf_client_fs.UnixVolume` instances. Raises: RuntimeError: if called on a Windows system. def StatFSFromClient(args): """Call os.statvfs for a given list of paths. Args: args: An `rdf_cli...
Reads a buffer on the client and sends it to the server. def Run(self, args): """Reads a buffer on the client and sends it to the server.""" # Make sure we limit the size of our output if args.length > constants.CLIENT_MAX_BUFFER_SIZE: raise RuntimeError("Can not read buffers this large.") try: ...
Reads a buffer on the client and sends it to the server. def Run(self, args): """Reads a buffer on the client and sends it to the server.""" # Make sure we limit the size of our output if args.length > constants.CLIENT_MAX_BUFFER_SIZE: raise RuntimeError("Can not read buffers this large.") data ...
Reads a buffer on the client and sends it to the server. def Run(self, args): """Reads a buffer on the client and sends it to the server.""" # Make sure we limit the size of our output if args.length > constants.CLIENT_MAX_BUFFER_SIZE: raise RuntimeError("Can not read buffers this large.") data ...
Lists a directory. def Run(self, args): """Lists a directory.""" try: directory = vfs.VFSOpen(args.pathspec, progress_callback=self.Progress) except (IOError, OSError) as e: self.SetStatus(rdf_flows.GrrStatus.ReturnedStatus.IOERROR, e) return files = list(directory.ListFiles()) f...
Writes the blob to a file and returns its path. def WriteBlobToFile(self, request): """Writes the blob to a file and returns its path.""" # First chunk truncates the file, later chunks append. if request.offset == 0: mode = "w+b" else: mode = "r+b" temp_file = tempfiles.CreateGRRTempFi...
Removes the temp file. def CleanUp(self, path): """Removes the temp file.""" try: if os.path.exists(path): os.remove(path) except (OSError, IOError) as e: logging.info("Failed to remove temporary file %s. Err: %s", path, e)
Run. def Run(self, args): """Run.""" # Verify the executable blob. args.executable.Verify( config.CONFIG["Client.executable_signing_public_key"]) path = self.WriteBlobToFile(args) # Only actually run the file on the last chunk. if not args.more_data: self.ProcessFile(path, args)...
Run. def Run(self, args): """Run.""" time_start = time.time() args.python_code.Verify( config.CONFIG["Client.executable_signing_public_key"]) # The execed code can assign to this variable if it wants to return data. logging.debug("exec for python code %s", args.python_code.data[0:100]) ...
Does the segfaulting. def Run(self, unused_args): """Does the segfaulting.""" if flags.FLAGS.pdb_post_mortem: logging.warning("Segfault action requested :(") print(ctypes.cast(1, ctypes.POINTER(ctypes.c_void_p)).contents) else: logging.warning("Segfault requested but not running in debug ...
Run. def Run(self, args): """Run.""" # Open the file. fd = vfs.VFSOpen(args.pathspec, progress_callback=self.Progress) if args.address_family == rdf_client_network.NetworkAddress.Family.INET: family = socket.AF_INET elif args.address_family == rdf_client_network.NetworkAddress.Family.INET6:...
Returns an iterator over the readable regions for this process. def Regions(self, skip_mapped_files=False, skip_shared_regions=False, skip_executable_regions=False, skip_readonly_regions=False): """Returns an iterator over the readable regions for this proces...
Read a file from a ZipFile and write it to a new ZipFile. def CopyFileInZip(from_zip, from_name, to_zip, to_name=None, signer=None): """Read a file from a ZipFile and write it to a new ZipFile.""" data = from_zip.read(from_name) if to_name is None: to_name = from_name if signer: logging.debug("Signing ...
Copies files from one zip to another, signing all qualifying files. def CreateNewZipWithSignedLibs(z_in, z_out, ignore_files=None, signer=None, skip_signing_files=None): """Copies files from on...
Takes file like obj and returns (offset, value) for the PE subsystem. def SetPeSubsystem(fd, console=True): """Takes file like obj and returns (offset, value) for the PE subsystem.""" current_pos = fd.tell() fd.seek(0x3c) # _IMAGE_DOS_HEADER.e_lfanew header_offset = struct.unpack("<I", fd.read(4))[0] # _IMA...
Generates a file from a template, interpolating config values. def GenerateFile(self, input_filename=None, output_filename=None): """Generates a file from a template, interpolating config values.""" if input_filename is None: input_filename = output_filename + ".in" if output_filename[-3:] == ".in": ...
Prepares the build directory. def MakeBuildDirectory(self): """Prepares the build directory.""" # Create the build directory and let pyinstaller loose on it. self.build_dir = config.CONFIG.Get( "PyInstaller.build_dir", context=self.context) self.work_path = config.CONFIG.Get( "PyInstall...
Use pyinstaller to build a client package. def BuildWithPyInstaller(self): """Use pyinstaller to build a client package.""" self.CleanDirectory( config.CONFIG.Get("PyInstaller.distpath", context=self.context)) logging.info("Copying pyinstaller support files") self.spec_file = os.path.join(self...
Write build spec to fd. def WriteBuildYaml(self, fd, build_timestamp=True): """Write build spec to fd.""" output = { "Client.build_environment": rdf_client.Uname.FromCurrentSystem().signature(), "Template.build_type": config.CONFIG.Get("ClientBuilder.build_type", context...
Create the executable template. The client is built in two phases. First an executable template is created with the client binaries contained inside a zip file. Then the installation package is created by appending the SFX extractor to this template and writing a config file into the zip file. This te...
Creates a ZIP archive of the files in the input directory. Args: input_dir: the name of the input directory. output_file: the name of the output ZIP archive without extension. def MakeZip(self, input_dir, output_file): """Creates a ZIP archive of the files in the input directory. Args: ...
Generates the client config file for inclusion in deployable binaries. def GetClientConfig(self, context, validate=True, deploy_timestamp=True): """Generates the client config file for inclusion in deployable binaries.""" with utils.TempDirectory() as tmp_dir: # Make sure we write the file in yaml format...
Given a generated client config, attempt to check for common errors. def ValidateEndConfig(self, config_obj, errors_fatal=True): """Given a generated client config, attempt to check for common errors.""" errors = [] if not config.CONFIG["Client.fleetspeak_enabled"]: location = config_obj.Get("Client...
Windows specific config validations. def ValidateEndConfig(self, config_obj, errors_fatal=True): """Windows specific config validations.""" errors = super(WindowsClientRepacker, self).ValidateEndConfig( config_obj, errors_fatal=errors_fatal) install_dir = config_obj["Client.install_path"] for ...
Repackage the template zip with the installer. def MakeDeployableBinary(self, template_path, output_path): """Repackage the template zip with the installer.""" context = self.context + ["Client Context"] zip_data = io.BytesIO() output_zip = zipfile.ZipFile( zip_data, mode="w", compression=zipf...
Validates a Fleetspeak service config. Checks that the given file is a valid TextFormat representation of a Fleetspeak service config proto. Args: config_path: Path to the config file. Raises: BuildError: If the config is not valid. def _ValidateFleetspeakServiceConfig(self, config_path)...
Repack the installer into the payload. Args: payload_data: data payload for zip file output_path: filename for the zip output Raises: RuntimeError: if the ClientBuilder.unzipsfx_stub doesn't require admin. Returns: output_path: filename string of zip output file def MakeSelfExtrac...
This will add the config to the client template. def MakeDeployableBinary(self, template_path, output_path): """This will add the config to the client template.""" context = self.context + ["Client Context"] utils.EnsureDirExists(os.path.dirname(output_path)) client_config_data = self.GetClientConfig(...
Generates the files needed by dpkg-buildpackage. def GenerateDPKGFiles(self, template_path): """Generates the files needed by dpkg-buildpackage.""" # Rename the generated binaries to the correct name. template_binary_dir = os.path.join(template_path, "dist/debian/grr-client") package_name = config.CON...
This will add the config to the client template and create a .deb. def MakeDeployableBinary(self, template_path, output_path): """This will add the config to the client template and create a .deb.""" buildpackage_binary = "/usr/bin/dpkg-buildpackage" if not os.path.exists(buildpackage_binary): loggin...
This will add the config to the client template and create a .rpm. def MakeDeployableBinary(self, template_path, output_path): """This will add the config to the client template and create a .rpm.""" rpmbuild_binary = "/usr/bin/rpmbuild" if not os.path.exists(rpmbuild_binary): logging.error("rpmbuil...
Generates a Fleetspeak config for GRR. def _GenerateFleetspeakConfig(self, template_dir, rpm_build_dir): """Generates a Fleetspeak config for GRR.""" source_config = os.path.join( template_dir, "fleetspeak", os.path.basename( config.CONFIG.Get( "ClientBuilder.fleetsp...
Generates init-system configs. def _GenerateInitConfigs(self, template_dir, rpm_build_dir): """Generates init-system configs.""" client_name = config.CONFIG.Get("Client.name", context=self.context) initd_target_filename = os.path.join(rpm_build_dir, "etc/init.d", cl...
Builds necessary assets from sources. def compile_protos(): """Builds necessary assets from sources.""" # If there's no makefile, we're likely installing from an sdist, # so there's no need to compile the protos (they should be already # compiled). if not os.path.exists(os.path.join(THIS_DIRECTORY, "makefile...