repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
adamrehn/ue4cli
ue4cli/Utility.py
Utility.findArgs
def findArgs(args, prefixes): """ Extracts the list of arguments that start with any of the specified prefix values """ return list([ arg for arg in args if len([p for p in prefixes if arg.lower().startswith(p.lower())]) > 0 ])
python
def findArgs(args, prefixes): """ Extracts the list of arguments that start with any of the specified prefix values """ return list([ arg for arg in args if len([p for p in prefixes if arg.lower().startswith(p.lower())]) > 0 ])
Extracts the list of arguments that start with any of the specified prefix values
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/Utility.py#L86-L93
adamrehn/ue4cli
ue4cli/Utility.py
Utility.stripArgs
def stripArgs(args, blacklist): """ Removes any arguments in the supplied list that are contained in the specified blacklist """ blacklist = [b.lower() for b in blacklist] return list([arg for arg in args if arg.lower() not in blacklist])
python
def stripArgs(args, blacklist): """ Removes any arguments in the supplied list that are contained in the specified blacklist """ blacklist = [b.lower() for b in blacklist] return list([arg for arg in args if arg.lower() not in blacklist])
Removes any arguments in the supplied list that are contained in the specified blacklist
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/Utility.py#L103-L108
adamrehn/ue4cli
ue4cli/Utility.py
Utility.capture
def capture(command, input=None, cwd=None, shell=False, raiseOnError=False): """ Executes a child process and captures its output """ # Attempt to execute the child process proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, shell=shell, universa...
python
def capture(command, input=None, cwd=None, shell=False, raiseOnError=False): """ Executes a child process and captures its output """ # Attempt to execute the child process proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, shell=shell, universa...
Executes a child process and captures its output
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/Utility.py#L111-L129
adamrehn/ue4cli
ue4cli/Utility.py
Utility.run
def run(command, cwd=None, shell=False, raiseOnError=False): """ Executes a child process and waits for it to complete """ returncode = subprocess.call(command, cwd=cwd, shell=shell) if raiseOnError == True and returncode != 0: raise Exception('child process ' + str(command) + ' failed with exit code ' + s...
python
def run(command, cwd=None, shell=False, raiseOnError=False): """ Executes a child process and waits for it to complete """ returncode = subprocess.call(command, cwd=cwd, shell=shell) if raiseOnError == True and returncode != 0: raise Exception('child process ' + str(command) + ' failed with exit code ' + s...
Executes a child process and waits for it to complete
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/Utility.py#L132-L139
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.setEngineRootOverride
def setEngineRootOverride(self, rootDir): """ Sets a user-specified directory as the root engine directory, overriding any auto-detection """ # Set the new root directory ConfigurationManager.setConfigKey('rootDirOverride', os.path.abspath(rootDir)) # Check that the specified directory is valid and ...
python
def setEngineRootOverride(self, rootDir): """ Sets a user-specified directory as the root engine directory, overriding any auto-detection """ # Set the new root directory ConfigurationManager.setConfigKey('rootDirOverride', os.path.abspath(rootDir)) # Check that the specified directory is valid and ...
Sets a user-specified directory as the root engine directory, overriding any auto-detection
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L33-L45
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getEngineRoot
def getEngineRoot(self): """ Returns the root directory location of the latest installed version of UE4 """ if not hasattr(self, '_engineRoot'): self._engineRoot = self._getEngineRoot() return self._engineRoot
python
def getEngineRoot(self): """ Returns the root directory location of the latest installed version of UE4 """ if not hasattr(self, '_engineRoot'): self._engineRoot = self._getEngineRoot() return self._engineRoot
Returns the root directory location of the latest installed version of UE4
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L53-L59
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getEngineVersion
def getEngineVersion(self, outputFormat = 'full'): """ Returns the version number of the latest installed version of UE4 """ version = self._getEngineVersionDetails() formats = { 'major': version['MajorVersion'], 'minor': version['MinorVersion'], 'patch': version['PatchVersion'], 'full': '{}.{}.{}...
python
def getEngineVersion(self, outputFormat = 'full'): """ Returns the version number of the latest installed version of UE4 """ version = self._getEngineVersionDetails() formats = { 'major': version['MajorVersion'], 'minor': version['MinorVersion'], 'patch': version['PatchVersion'], 'full': '{}.{}.{}...
Returns the version number of the latest installed version of UE4
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L61-L78
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getEngineChangelist
def getEngineChangelist(self): """ Returns the compatible Perforce changelist identifier for the latest installed version of UE4 """ # Newer versions of the engine use the key "CompatibleChangelist", older ones use "Changelist" version = self._getEngineVersionDetails() if 'CompatibleChangelist' in versio...
python
def getEngineChangelist(self): """ Returns the compatible Perforce changelist identifier for the latest installed version of UE4 """ # Newer versions of the engine use the key "CompatibleChangelist", older ones use "Changelist" version = self._getEngineVersionDetails() if 'CompatibleChangelist' in versio...
Returns the compatible Perforce changelist identifier for the latest installed version of UE4
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L80-L90
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.isInstalledBuild
def isInstalledBuild(self): """ Determines if the Engine is an Installed Build """ sentinelFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'InstalledBuild.txt') return os.path.exists(sentinelFile)
python
def isInstalledBuild(self): """ Determines if the Engine is an Installed Build """ sentinelFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'InstalledBuild.txt') return os.path.exists(sentinelFile)
Determines if the Engine is an Installed Build
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L92-L97
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getEditorBinary
def getEditorBinary(self, cmdVersion=False): """ Determines the location of the UE4Editor binary """ return os.path.join(self.getEngineRoot(), 'Engine', 'Binaries', self.getPlatformIdentifier(), 'UE4Editor' + self._editorPathSuffix(cmdVersion))
python
def getEditorBinary(self, cmdVersion=False): """ Determines the location of the UE4Editor binary """ return os.path.join(self.getEngineRoot(), 'Engine', 'Binaries', self.getPlatformIdentifier(), 'UE4Editor' + self._editorPathSuffix(cmdVersion))
Determines the location of the UE4Editor binary
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L99-L103
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getProjectDescriptor
def getProjectDescriptor(self, dir): """ Detects the .uproject descriptor file for the Unreal project in the specified directory """ for project in glob.glob(os.path.join(dir, '*.uproject')): return os.path.realpath(project) # No project detected raise UnrealManagerException('could not detect an Unrea...
python
def getProjectDescriptor(self, dir): """ Detects the .uproject descriptor file for the Unreal project in the specified directory """ for project in glob.glob(os.path.join(dir, '*.uproject')): return os.path.realpath(project) # No project detected raise UnrealManagerException('could not detect an Unrea...
Detects the .uproject descriptor file for the Unreal project in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L123-L131
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getPluginDescriptor
def getPluginDescriptor(self, dir): """ Detects the .uplugin descriptor file for the Unreal plugin in the specified directory """ for plugin in glob.glob(os.path.join(dir, '*.uplugin')): return os.path.realpath(plugin) # No plugin detected raise UnrealManagerException('could not detect an Unreal plugi...
python
def getPluginDescriptor(self, dir): """ Detects the .uplugin descriptor file for the Unreal plugin in the specified directory """ for plugin in glob.glob(os.path.join(dir, '*.uplugin')): return os.path.realpath(plugin) # No plugin detected raise UnrealManagerException('could not detect an Unreal plugi...
Detects the .uplugin descriptor file for the Unreal plugin in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L133-L141
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getDescriptor
def getDescriptor(self, dir): """ Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory """ try: return self.getProjectDescriptor(dir) except: try: return self.getPluginDescriptor(dir) except: raise UnrealManagerException('could not detect an ...
python
def getDescriptor(self, dir): """ Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory """ try: return self.getProjectDescriptor(dir) except: try: return self.getPluginDescriptor(dir) except: raise UnrealManagerException('could not detect an ...
Detects the descriptor file for either an Unreal project or an Unreal plugin in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L143-L153
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.listThirdPartyLibs
def listThirdPartyLibs(self, configuration = 'Development'): """ Lists the supported Unreal-bundled third-party libraries """ interrogator = self._getUE4BuildInterrogator() return interrogator.list(self.getPlatformIdentifier(), configuration, self._getLibraryOverrides())
python
def listThirdPartyLibs(self, configuration = 'Development'): """ Lists the supported Unreal-bundled third-party libraries """ interrogator = self._getUE4BuildInterrogator() return interrogator.list(self.getPlatformIdentifier(), configuration, self._getLibraryOverrides())
Lists the supported Unreal-bundled third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L173-L178
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdpartyLibs
def getThirdpartyLibs(self, libs, configuration = 'Development', includePlatformDefaults = True): """ Retrieves the ThirdPartyLibraryDetails instance for Unreal-bundled versions of the specified third-party libraries """ if includePlatformDefaults == True: libs = self._defaultThirdpartyLibs() + libs interr...
python
def getThirdpartyLibs(self, libs, configuration = 'Development', includePlatformDefaults = True): """ Retrieves the ThirdPartyLibraryDetails instance for Unreal-bundled versions of the specified third-party libraries """ if includePlatformDefaults == True: libs = self._defaultThirdpartyLibs() + libs interr...
Retrieves the ThirdPartyLibraryDetails instance for Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L180-L187
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibCompilerFlags
def getThirdPartyLibCompilerFlags(self, libs): """ Retrieves the compiler flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDefault...
python
def getThirdPartyLibCompilerFlags(self, libs): """ Retrieves the compiler flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDefault...
Retrieves the compiler flags for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L189-L204
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibLinkerFlags
def getThirdPartyLibLinkerFlags(self, libs): """ Retrieves the linker flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] includeLibs = True ...
python
def getThirdPartyLibLinkerFlags(self, libs): """ Retrieves the linker flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] includeLibs = True ...
Retrieves the linker flags for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L206-L226
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibCmakeFlags
def getThirdPartyLibCmakeFlags(self, libs): """ Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDe...
python
def getThirdPartyLibCmakeFlags(self, libs): """ Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries """ fmt = PrintingFormat.singleLine() if libs[0] == '--multiline': fmt = PrintingFormat.multiLine() libs = libs[1:] platformDe...
Retrieves the CMake invocation flags for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L228-L244
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibIncludeDirs
def getThirdPartyLibIncludeDirs(self, libs): """ Retrieves the list of include directories for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.getThi...
python
def getThirdPartyLibIncludeDirs(self, libs): """ Retrieves the list of include directories for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.getThi...
Retrieves the list of include directories for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L246-L256
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibFiles
def getThirdPartyLibFiles(self, libs): """ Retrieves the list of library files for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.getThirdpartyLibs(...
python
def getThirdPartyLibFiles(self, libs): """ Retrieves the list of library files for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.getThirdpartyLibs(...
Retrieves the list of library files for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L258-L268
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.getThirdPartyLibDefinitions
def getThirdPartyLibDefinitions(self, libs): """ Retrieves the list of preprocessor definitions for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.g...
python
def getThirdPartyLibDefinitions(self, libs): """ Retrieves the list of preprocessor definitions for building against the Unreal-bundled versions of the specified third-party libraries """ platformDefaults = True if libs[0] == '--nodefaults': platformDefaults = False libs = libs[1:] details = self.g...
Retrieves the list of preprocessor definitions for building against the Unreal-bundled versions of the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L270-L280
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.generateProjectFiles
def generateProjectFiles(self, dir=os.getcwd(), args=[]): """ Generates IDE project files for the Unreal project in the specified directory """ # If the project is a pure Blueprint project, then we cannot generate project files if os.path.exists(os.path.join(dir, 'Source')) == False: Utility.printStderr...
python
def generateProjectFiles(self, dir=os.getcwd(), args=[]): """ Generates IDE project files for the Unreal project in the specified directory """ # If the project is a pure Blueprint project, then we cannot generate project files if os.path.exists(os.path.join(dir, 'Source')) == False: Utility.printStderr...
Generates IDE project files for the Unreal project in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L282-L295
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.cleanDescriptor
def cleanDescriptor(self, dir=os.getcwd()): """ Cleans the build artifacts for the Unreal project or plugin in the specified directory """ # Verify that an Unreal project or plugin exists in the specified directory descriptor = self.getDescriptor(dir) # Because performing a clean will also delete the ...
python
def cleanDescriptor(self, dir=os.getcwd()): """ Cleans the build artifacts for the Unreal project or plugin in the specified directory """ # Verify that an Unreal project or plugin exists in the specified directory descriptor = self.getDescriptor(dir) # Because performing a clean will also delete the ...
Cleans the build artifacts for the Unreal project or plugin in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L297-L314
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.buildDescriptor
def buildDescriptor(self, dir=os.getcwd(), configuration='Development', args=[], suppressOutput=False): """ Builds the editor modules for the Unreal project or plugin in the specified directory, using the specified build configuration """ # Verify that an Unreal project or plugin exists in the specified dire...
python
def buildDescriptor(self, dir=os.getcwd(), configuration='Development', args=[], suppressOutput=False): """ Builds the editor modules for the Unreal project or plugin in the specified directory, using the specified build configuration """ # Verify that an Unreal project or plugin exists in the specified dire...
Builds the editor modules for the Unreal project or plugin in the specified directory, using the specified build configuration
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L316-L339
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.runEditor
def runEditor(self, dir=os.getcwd(), debug=False, args=[]): """ Runs the editor for the Unreal project in the specified directory (or without a project if dir is None) """ projectFile = self.getProjectDescriptor(dir) if dir is not None else '' extraFlags = ['-debug'] + args if debug == True else args Utilit...
python
def runEditor(self, dir=os.getcwd(), debug=False, args=[]): """ Runs the editor for the Unreal project in the specified directory (or without a project if dir is None) """ projectFile = self.getProjectDescriptor(dir) if dir is not None else '' extraFlags = ['-debug'] + args if debug == True else args Utilit...
Runs the editor for the Unreal project in the specified directory (or without a project if dir is None)
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L341-L347
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.runUAT
def runUAT(self, args): """ Runs the Unreal Automation Tool with the supplied arguments """ Utility.run([self.getRunUATScript()] + args, cwd=self.getEngineRoot(), raiseOnError=True)
python
def runUAT(self, args): """ Runs the Unreal Automation Tool with the supplied arguments """ Utility.run([self.getRunUATScript()] + args, cwd=self.getEngineRoot(), raiseOnError=True)
Runs the Unreal Automation Tool with the supplied arguments
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L349-L353
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.packageProject
def packageProject(self, dir=os.getcwd(), configuration='Shipping', extraArgs=[]): """ Packages a build of the Unreal project in the specified directory, using common packaging options """ # Verify that the specified build configuration is valid if configuration not in self.validBuildConfigurations(): r...
python
def packageProject(self, dir=os.getcwd(), configuration='Shipping', extraArgs=[]): """ Packages a build of the Unreal project in the specified directory, using common packaging options """ # Verify that the specified build configuration is valid if configuration not in self.validBuildConfigurations(): r...
Packages a build of the Unreal project in the specified directory, using common packaging options
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L355-L398
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.packagePlugin
def packagePlugin(self, dir=os.getcwd(), extraArgs=[]): """ Packages a build of the Unreal plugin in the specified directory, suitable for use as a prebuilt Engine module """ # Invoke UAT to package the build distDir = os.path.join(os.path.abspath(dir), 'dist') self.runUAT([ 'BuildPlugin', '-Plugin...
python
def packagePlugin(self, dir=os.getcwd(), extraArgs=[]): """ Packages a build of the Unreal plugin in the specified directory, suitable for use as a prebuilt Engine module """ # Invoke UAT to package the build distDir = os.path.join(os.path.abspath(dir), 'dist') self.runUAT([ 'BuildPlugin', '-Plugin...
Packages a build of the Unreal plugin in the specified directory, suitable for use as a prebuilt Engine module
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L400-L411
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.packageDescriptor
def packageDescriptor(self, dir=os.getcwd(), args=[]): """ Packages a build of the Unreal project or plugin in the specified directory """ # Verify that an Unreal project or plugin exists in the specified directory descriptor = self.getDescriptor(dir) # Perform the packaging step if self.isProject(d...
python
def packageDescriptor(self, dir=os.getcwd(), args=[]): """ Packages a build of the Unreal project or plugin in the specified directory """ # Verify that an Unreal project or plugin exists in the specified directory descriptor = self.getDescriptor(dir) # Perform the packaging step if self.isProject(d...
Packages a build of the Unreal project or plugin in the specified directory
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L413-L425
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase.runAutomationCommands
def runAutomationCommands(self, projectFile, commands, capture=False): ''' Invokes the Automation Test commandlet for the specified project with the supplied automation test commands ''' # IMPORTANT IMPLEMENTATION NOTE: # We need to format the command as a string and execute it using a shell in order to ...
python
def runAutomationCommands(self, projectFile, commands, capture=False): ''' Invokes the Automation Test commandlet for the specified project with the supplied automation test commands ''' # IMPORTANT IMPLEMENTATION NOTE: # We need to format the command as a string and execute it using a shell in order to ...
Invokes the Automation Test commandlet for the specified project with the supplied automation test commands
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L427-L449
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase._getEngineRoot
def _getEngineRoot(self): """ Retrieves the user-specified engine root directory override (if set), or else performs auto-detection """ override = ConfigurationManager.getConfigKey('rootDirOverride') if override != None: Utility.printStderr('Using user-specified engine root: ' + override) return overrid...
python
def _getEngineRoot(self): """ Retrieves the user-specified engine root directory override (if set), or else performs auto-detection """ override = ConfigurationManager.getConfigKey('rootDirOverride') if override != None: Utility.printStderr('Using user-specified engine root: ' + override) return overrid...
Retrieves the user-specified engine root directory override (if set), or else performs auto-detection
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L538-L547
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase._getEngineVersionDetails
def _getEngineVersionDetails(self): """ Parses the JSON version details for the latest installed version of UE4 """ versionFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'Build.version') return json.loads(Utility.readFile(versionFile))
python
def _getEngineVersionDetails(self): """ Parses the JSON version details for the latest installed version of UE4 """ versionFile = os.path.join(self.getEngineRoot(), 'Engine', 'Build', 'Build.version') return json.loads(Utility.readFile(versionFile))
Parses the JSON version details for the latest installed version of UE4
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L555-L560
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase._getEngineVersionHash
def _getEngineVersionHash(self): """ Computes the SHA-256 hash of the JSON version details for the latest installed version of UE4 """ versionDetails = self._getEngineVersionDetails() hash = hashlib.sha256() hash.update(json.dumps(versionDetails, sort_keys=True, indent=0).encode('utf-8')) return hash.hexd...
python
def _getEngineVersionHash(self): """ Computes the SHA-256 hash of the JSON version details for the latest installed version of UE4 """ versionDetails = self._getEngineVersionDetails() hash = hashlib.sha256() hash.update(json.dumps(versionDetails, sort_keys=True, indent=0).encode('utf-8')) return hash.hexd...
Computes the SHA-256 hash of the JSON version details for the latest installed version of UE4
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L562-L569
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase._runUnrealBuildTool
def _runUnrealBuildTool(self, target, platform, configuration, args, capture=False): """ Invokes UnrealBuildTool with the specified parameters """ platform = self._transformBuildToolPlatform(platform) arguments = [self.getBuildScript(), target, platform, configuration] + args if capture == True: return U...
python
def _runUnrealBuildTool(self, target, platform, configuration, args, capture=False): """ Invokes UnrealBuildTool with the specified parameters """ platform = self._transformBuildToolPlatform(platform) arguments = [self.getBuildScript(), target, platform, configuration] + args if capture == True: return U...
Invokes UnrealBuildTool with the specified parameters
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L607-L616
adamrehn/ue4cli
ue4cli/UnrealManagerBase.py
UnrealManagerBase._getUE4BuildInterrogator
def _getUE4BuildInterrogator(self): """ Uses UE4BuildInterrogator to interrogate UnrealBuildTool about third-party library details """ ubtLambda = lambda target, platform, config, args: self._runUnrealBuildTool(target, platform, config, args, True) interrogator = UE4BuildInterrogator(self.getEngineRoot(), sel...
python
def _getUE4BuildInterrogator(self): """ Uses UE4BuildInterrogator to interrogate UnrealBuildTool about third-party library details """ ubtLambda = lambda target, platform, config, args: self._runUnrealBuildTool(target, platform, config, args, True) interrogator = UE4BuildInterrogator(self.getEngineRoot(), sel...
Uses UE4BuildInterrogator to interrogate UnrealBuildTool about third-party library details
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UnrealManagerBase.py#L618-L624
adamrehn/ue4cli
ue4cli/JsonDataManager.py
JsonDataManager.getKey
def getKey(self, key): """ Retrieves the value for the specified dictionary key """ data = self.getDictionary() if key in data: return data[key] else: return None
python
def getKey(self, key): """ Retrieves the value for the specified dictionary key """ data = self.getDictionary() if key in data: return data[key] else: return None
Retrieves the value for the specified dictionary key
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/JsonDataManager.py#L15-L23
adamrehn/ue4cli
ue4cli/JsonDataManager.py
JsonDataManager.getDictionary
def getDictionary(self): """ Retrieves the entire data dictionary """ if os.path.exists(self.jsonFile): return json.loads(Utility.readFile(self.jsonFile)) else: return {}
python
def getDictionary(self): """ Retrieves the entire data dictionary """ if os.path.exists(self.jsonFile): return json.loads(Utility.readFile(self.jsonFile)) else: return {}
Retrieves the entire data dictionary
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/JsonDataManager.py#L25-L32
adamrehn/ue4cli
ue4cli/JsonDataManager.py
JsonDataManager.setKey
def setKey(self, key, value): """ Sets the value for the specified dictionary key """ data = self.getDictionary() data[key] = value self.setDictionary(data)
python
def setKey(self, key, value): """ Sets the value for the specified dictionary key """ data = self.getDictionary() data[key] = value self.setDictionary(data)
Sets the value for the specified dictionary key
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/JsonDataManager.py#L34-L40
adamrehn/ue4cli
ue4cli/JsonDataManager.py
JsonDataManager.setDictionary
def setDictionary(self, data): """ Overwrites the entire dictionary """ # Create the directory containing the JSON file if it doesn't already exist jsonDir = os.path.dirname(self.jsonFile) if os.path.exists(jsonDir) == False: os.makedirs(jsonDir) # Store the dictionary Utility.writeFile(self.js...
python
def setDictionary(self, data): """ Overwrites the entire dictionary """ # Create the directory containing the JSON file if it doesn't already exist jsonDir = os.path.dirname(self.jsonFile) if os.path.exists(jsonDir) == False: os.makedirs(jsonDir) # Store the dictionary Utility.writeFile(self.js...
Overwrites the entire dictionary
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/JsonDataManager.py#L42-L53
adamrehn/ue4cli
ue4cli/UE4BuildInterrogator.py
UE4BuildInterrogator.list
def list(self, platformIdentifier, configuration, libOverrides = {}): """ Returns the list of supported UE4-bundled third-party libraries """ modules = self._getThirdPartyLibs(platformIdentifier, configuration) return sorted([m['Name'] for m in modules] + [key for key in libOverrides])
python
def list(self, platformIdentifier, configuration, libOverrides = {}): """ Returns the list of supported UE4-bundled third-party libraries """ modules = self._getThirdPartyLibs(platformIdentifier, configuration) return sorted([m['Name'] for m in modules] + [key for key in libOverrides])
Returns the list of supported UE4-bundled third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UE4BuildInterrogator.py#L16-L21
adamrehn/ue4cli
ue4cli/UE4BuildInterrogator.py
UE4BuildInterrogator.interrogate
def interrogate(self, platformIdentifier, configuration, libraries, libOverrides = {}): """ Interrogates UnrealBuildTool about the build flags for the specified third-party libraries """ # Determine which libraries need their modules parsed by UBT, and which are override-only libModules = list([lib for lib...
python
def interrogate(self, platformIdentifier, configuration, libraries, libOverrides = {}): """ Interrogates UnrealBuildTool about the build flags for the specified third-party libraries """ # Determine which libraries need their modules parsed by UBT, and which are override-only libModules = list([lib for lib...
Interrogates UnrealBuildTool about the build flags for the specified third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UE4BuildInterrogator.py#L23-L90
adamrehn/ue4cli
ue4cli/UE4BuildInterrogator.py
UE4BuildInterrogator._absolutePaths
def _absolutePaths(self, paths): """ Converts the supplied list of paths to absolute pathnames (except for pure filenames without leading relative directories) """ slashes = [p.replace('\\', '/') for p in paths] stripped = [p.replace('../', '') if p.startswith('../') else p for p in slashes] return list([p ...
python
def _absolutePaths(self, paths): """ Converts the supplied list of paths to absolute pathnames (except for pure filenames without leading relative directories) """ slashes = [p.replace('\\', '/') for p in paths] stripped = [p.replace('../', '') if p.startswith('../') else p for p in slashes] return list([p ...
Converts the supplied list of paths to absolute pathnames (except for pure filenames without leading relative directories)
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UE4BuildInterrogator.py#L95-L101
adamrehn/ue4cli
ue4cli/UE4BuildInterrogator.py
UE4BuildInterrogator._flatten
def _flatten(self, field, items, transform = None): """ Extracts the entry `field` from each item in the supplied iterable, flattening any nested lists """ # Retrieve the value for each item in the iterable values = [item[field] for item in items] # Flatten any nested lists flattened = [] for valu...
python
def _flatten(self, field, items, transform = None): """ Extracts the entry `field` from each item in the supplied iterable, flattening any nested lists """ # Retrieve the value for each item in the iterable values = [item[field] for item in items] # Flatten any nested lists flattened = [] for valu...
Extracts the entry `field` from each item in the supplied iterable, flattening any nested lists
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UE4BuildInterrogator.py#L103-L117
adamrehn/ue4cli
ue4cli/UE4BuildInterrogator.py
UE4BuildInterrogator._getThirdPartyLibs
def _getThirdPartyLibs(self, platformIdentifier, configuration): """ Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries """ # If we have previously cached the library list for the current engine version, use the cached data cachedList = CachedDataManager.getCachedDataKe...
python
def _getThirdPartyLibs(self, platformIdentifier, configuration): """ Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries """ # If we have previously cached the library list for the current engine version, use the cached data cachedList = CachedDataManager.getCachedDataKe...
Runs UnrealBuildTool in JSON export mode and extracts the list of third-party libraries
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/UE4BuildInterrogator.py#L119-L175
adamrehn/ue4cli
ue4cli/CMakeCustomFlags.py
CMakeCustomFlags.processLibraryDetails
def processLibraryDetails(details): """ Processes the supplied ThirdPartyLibraryDetails instance and sets any custom CMake flags """ # If the header include directories list contains any directories we have flags for, add them for includeDir in details.includeDirs: # If the directory path matches an...
python
def processLibraryDetails(details): """ Processes the supplied ThirdPartyLibraryDetails instance and sets any custom CMake flags """ # If the header include directories list contains any directories we have flags for, add them for includeDir in details.includeDirs: # If the directory path matches an...
Processes the supplied ThirdPartyLibraryDetails instance and sets any custom CMake flags
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/CMakeCustomFlags.py#L19-L46
adamrehn/ue4cli
ue4cli/PluginManager.py
PluginManager.getPlugins
def getPlugins(): """ Returns the list of valid ue4cli plugins """ # Retrieve the list of detected entry points in the ue4cli.plugins group plugins = { entry_point.name: entry_point.load() for entry_point in pkg_resources.iter_entry_points('ue4cli.plugins') } # Filter out any invalid plugin...
python
def getPlugins(): """ Returns the list of valid ue4cli plugins """ # Retrieve the list of detected entry points in the ue4cli.plugins group plugins = { entry_point.name: entry_point.load() for entry_point in pkg_resources.iter_entry_points('ue4cli.plugins') } # Filter out any invalid plugin...
Returns the list of valid ue4cli plugins
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/PluginManager.py#L10-L34
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getCompilerFlags
def getCompilerFlags(self, engineRoot, fmt): """ Constructs the compiler flags string for building against this library """ return Utility.join( fmt.delim, self.prefixedStrings(self.definitionPrefix, self.definitions, engineRoot) + self.prefixedStrings(self.includeDirPrefix, self.includeDirs, engine...
python
def getCompilerFlags(self, engineRoot, fmt): """ Constructs the compiler flags string for building against this library """ return Utility.join( fmt.delim, self.prefixedStrings(self.definitionPrefix, self.definitions, engineRoot) + self.prefixedStrings(self.includeDirPrefix, self.includeDirs, engine...
Constructs the compiler flags string for building against this library
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L71-L81
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getLinkerFlags
def getLinkerFlags(self, engineRoot, fmt, includeLibs=True): """ Constructs the linker flags string for building against this library """ components = self.resolveRoot(self.ldFlags, engineRoot) if includeLibs == True: components.extend(self.prefixedStrings(self.linkerDirPrefix, self.linkDirs, engineRoot)) ...
python
def getLinkerFlags(self, engineRoot, fmt, includeLibs=True): """ Constructs the linker flags string for building against this library """ components = self.resolveRoot(self.ldFlags, engineRoot) if includeLibs == True: components.extend(self.prefixedStrings(self.linkerDirPrefix, self.linkDirs, engineRoot)) ...
Constructs the linker flags string for building against this library
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L83-L92
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getPrefixDirectories
def getPrefixDirectories(self, engineRoot, delimiter=' '): """ Returns the list of prefix directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.prefixDirs, engineRoot))
python
def getPrefixDirectories(self, engineRoot, delimiter=' '): """ Returns the list of prefix directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.prefixDirs, engineRoot))
Returns the list of prefix directories for this library, joined using the specified delimiter
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L94-L98
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getIncludeDirectories
def getIncludeDirectories(self, engineRoot, delimiter=' '): """ Returns the list of include directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.includeDirs, engineRoot))
python
def getIncludeDirectories(self, engineRoot, delimiter=' '): """ Returns the list of include directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.includeDirs, engineRoot))
Returns the list of include directories for this library, joined using the specified delimiter
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L100-L104
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getLinkerDirectories
def getLinkerDirectories(self, engineRoot, delimiter=' '): """ Returns the list of linker directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.linkDirs, engineRoot))
python
def getLinkerDirectories(self, engineRoot, delimiter=' '): """ Returns the list of linker directories for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.linkDirs, engineRoot))
Returns the list of linker directories for this library, joined using the specified delimiter
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L106-L110
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getLibraryFiles
def getLibraryFiles(self, engineRoot, delimiter=' '): """ Returns the list of library files for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.libs, engineRoot))
python
def getLibraryFiles(self, engineRoot, delimiter=' '): """ Returns the list of library files for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.libs, engineRoot))
Returns the list of library files for this library, joined using the specified delimiter
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L112-L116
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getPreprocessorDefinitions
def getPreprocessorDefinitions(self, engineRoot, delimiter=' '): """ Returns the list of preprocessor definitions for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.definitions, engineRoot))
python
def getPreprocessorDefinitions(self, engineRoot, delimiter=' '): """ Returns the list of preprocessor definitions for this library, joined using the specified delimiter """ return delimiter.join(self.resolveRoot(self.definitions, engineRoot))
Returns the list of preprocessor definitions for this library, joined using the specified delimiter
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L118-L122
adamrehn/ue4cli
ue4cli/ThirdPartyLibraryDetails.py
ThirdPartyLibraryDetails.getCMakeFlags
def getCMakeFlags(self, engineRoot, fmt): """ Constructs the CMake invocation flags string for building against this library """ return Utility.join( fmt.delim, [ '-DCMAKE_PREFIX_PATH=' + self.getPrefixDirectories(engineRoot, ';'), '-DCMAKE_INCLUDE_PATH=' + self.getIncludeDirectories(engineRoot, '...
python
def getCMakeFlags(self, engineRoot, fmt): """ Constructs the CMake invocation flags string for building against this library """ return Utility.join( fmt.delim, [ '-DCMAKE_PREFIX_PATH=' + self.getPrefixDirectories(engineRoot, ';'), '-DCMAKE_INCLUDE_PATH=' + self.getIncludeDirectories(engineRoot, '...
Constructs the CMake invocation flags string for building against this library
https://github.com/adamrehn/ue4cli/blob/f1c34502c96059e36757b7433da7e98760a75a6f/ue4cli/ThirdPartyLibraryDetails.py#L124-L136
tkrajina/git-plus
gitutils/__init__.py
is_changed
def is_changed(): """ Checks if current project has any noncommited changes. """ executed, changed_lines = execute_git('status --porcelain', output=False) merge_not_finished = mod_path.exists('.git/MERGE_HEAD') return changed_lines.strip() or merge_not_finished
python
def is_changed(): """ Checks if current project has any noncommited changes. """ executed, changed_lines = execute_git('status --porcelain', output=False) merge_not_finished = mod_path.exists('.git/MERGE_HEAD') return changed_lines.strip() or merge_not_finished
Checks if current project has any noncommited changes.
https://github.com/tkrajina/git-plus/blob/6adf9ae5c695feab5e8ed18f93777ac05dd4957c/gitutils/__init__.py#L108-L112
edx/edx-rest-api-client
edx_rest_api_client/client.py
user_agent
def user_agent(): """ Return a User-Agent that identifies this client. Example: python-requests/2.9.1 edx-rest-api-client/1.7.2 ecommerce The last item in the list will be the application name, taken from the OS environment variable EDX_REST_API_CLIENT_NAME. If that environment variabl...
python
def user_agent(): """ Return a User-Agent that identifies this client. Example: python-requests/2.9.1 edx-rest-api-client/1.7.2 ecommerce The last item in the list will be the application name, taken from the OS environment variable EDX_REST_API_CLIENT_NAME. If that environment variabl...
Return a User-Agent that identifies this client. Example: python-requests/2.9.1 edx-rest-api-client/1.7.2 ecommerce The last item in the list will be the application name, taken from the OS environment variable EDX_REST_API_CLIENT_NAME. If that environment variable is not set, it will default ...
https://github.com/edx/edx-rest-api-client/blob/7ed2a833691d2fdf3a4fbc9189ee5c4443bd892b/edx_rest_api_client/client.py#L14-L34
edx/edx-rest-api-client
edx_rest_api_client/client.py
get_oauth_access_token
def get_oauth_access_token(url, client_id, client_secret, token_type='jwt', grant_type='client_credentials', refresh_token=None): """ Retrieves OAuth 2.0 access token using the given grant type. Args: url (str): Oauth2 access token endpoint client_id (str): client ID ...
python
def get_oauth_access_token(url, client_id, client_secret, token_type='jwt', grant_type='client_credentials', refresh_token=None): """ Retrieves OAuth 2.0 access token using the given grant type. Args: url (str): Oauth2 access token endpoint client_id (str): client ID ...
Retrieves OAuth 2.0 access token using the given grant type. Args: url (str): Oauth2 access token endpoint client_id (str): client ID client_secret (str): client secret Kwargs: token_type (str): Type of token to return. Options include bearer and jwt. grant_type (str): O...
https://github.com/edx/edx-rest-api-client/blob/7ed2a833691d2fdf3a4fbc9189ee5c4443bd892b/edx_rest_api_client/client.py#L40-L85
edx/edx-rest-api-client
edx_rest_api_client/client.py
OAuthAPIClient.request
def request(self, method, url, **kwargs): # pylint: disable=arguments-differ """ Overrides Session.request to ensure that the session is authenticated """ self._check_auth() return super(OAuthAPIClient, self).request(method, url, **kwargs)
python
def request(self, method, url, **kwargs): # pylint: disable=arguments-differ """ Overrides Session.request to ensure that the session is authenticated """ self._check_auth() return super(OAuthAPIClient, self).request(method, url, **kwargs)
Overrides Session.request to ensure that the session is authenticated
https://github.com/edx/edx-rest-api-client/blob/7ed2a833691d2fdf3a4fbc9189ee5c4443bd892b/edx_rest_api_client/client.py#L121-L126
greenbone/ospd
ospd/ospd_ssh.py
OSPDaemonSimpleSSH.run_command
def run_command(self, scan_id, host, cmd): """ Run a single command via SSH and return the content of stdout or None in case of an Error. A scan error is issued in the latter case. For logging into 'host', the scan options 'port', 'username', 'password' and 'ssh_timeout'...
python
def run_command(self, scan_id, host, cmd): """ Run a single command via SSH and return the content of stdout or None in case of an Error. A scan error is issued in the latter case. For logging into 'host', the scan options 'port', 'username', 'password' and 'ssh_timeout'...
Run a single command via SSH and return the content of stdout or None in case of an Error. A scan error is issued in the latter case. For logging into 'host', the scan options 'port', 'username', 'password' and 'ssh_timeout' are used.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd_ssh.py#L94-L147
greenbone/ospd
ospd/xml.py
get_result_xml
def get_result_xml(result): """ Formats a scan result to XML format. Arguments: result (dict): Dictionary with a scan result. Return: Result as xml element object. """ result_xml = Element('result') for name, value in [('name', result['name']), ('type', ...
python
def get_result_xml(result): """ Formats a scan result to XML format. Arguments: result (dict): Dictionary with a scan result. Return: Result as xml element object. """ result_xml = Element('result') for name, value in [('name', result['name']), ('type', ...
Formats a scan result to XML format. Arguments: result (dict): Dictionary with a scan result. Return: Result as xml element object.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/xml.py#L25-L44
greenbone/ospd
ospd/xml.py
simple_response_str
def simple_response_str(command, status, status_text, content=""): """ Creates an OSP response XML string. Arguments: command (str): OSP Command to respond to. status (int): Status of the response. status_text (str): Status text of the response. content (str): Text part of the r...
python
def simple_response_str(command, status, status_text, content=""): """ Creates an OSP response XML string. Arguments: command (str): OSP Command to respond to. status (int): Status of the response. status_text (str): Status text of the response. content (str): Text part of the r...
Creates an OSP response XML string. Arguments: command (str): OSP Command to respond to. status (int): Status of the response. status_text (str): Status text of the response. content (str): Text part of the response XML element. Return: String of response in xml format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/xml.py#L47-L69
greenbone/ospd
ospd/ospd.py
bind_socket
def bind_socket(address, port): """ Returns a socket bound on (address:port). """ assert address assert port bindsocket = socket.socket() try: bindsocket.bind((address, port)) except socket.error: logger.error("Couldn't bind socket on %s:%s", address, port) return None ...
python
def bind_socket(address, port): """ Returns a socket bound on (address:port). """ assert address assert port bindsocket = socket.socket() try: bindsocket.bind((address, port)) except socket.error: logger.error("Couldn't bind socket on %s:%s", address, port) return None ...
Returns a socket bound on (address:port).
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L132-L146
greenbone/ospd
ospd/ospd.py
bind_unix_socket
def bind_unix_socket(path): """ Returns a unix file socket bound on (path). """ assert path bindsocket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: os.unlink(path) except OSError: if os.path.exists(path): raise try: bindsocket.bind(path) excep...
python
def bind_unix_socket(path): """ Returns a unix file socket bound on (path). """ assert path bindsocket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) try: os.unlink(path) except OSError: if os.path.exists(path): raise try: bindsocket.bind(path) excep...
Returns a unix file socket bound on (path).
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L148-L166
greenbone/ospd
ospd/ospd.py
close_client_stream
def close_client_stream(client_stream, unix_path): """ Closes provided client stream """ try: client_stream.shutdown(socket.SHUT_RDWR) if unix_path: logger.debug('%s: Connection closed', unix_path) else: peer = client_stream.getpeername() logger.debug(...
python
def close_client_stream(client_stream, unix_path): """ Closes provided client stream """ try: client_stream.shutdown(socket.SHUT_RDWR) if unix_path: logger.debug('%s: Connection closed', unix_path) else: peer = client_stream.getpeername() logger.debug(...
Closes provided client stream
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L169-L180
greenbone/ospd
ospd/ospd.py
OSPDaemon.set_command_attributes
def set_command_attributes(self, name, attributes): """ Sets the xml attributes of a specified command. """ if self.command_exists(name): command = self.commands.get(name) command['attributes'] = attributes
python
def set_command_attributes(self, name, attributes): """ Sets the xml attributes of a specified command. """ if self.command_exists(name): command = self.commands.get(name) command['attributes'] = attributes
Sets the xml attributes of a specified command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L243-L247
greenbone/ospd
ospd/ospd.py
OSPDaemon.add_scanner_param
def add_scanner_param(self, name, scanner_param): """ Add a scanner parameter. """ assert name assert scanner_param self.scanner_params[name] = scanner_param command = self.commands.get('start_scan') command['elements'] = { 'scanner_params': {...
python
def add_scanner_param(self, name, scanner_param): """ Add a scanner parameter. """ assert name assert scanner_param self.scanner_params[name] = scanner_param command = self.commands.get('start_scan') command['elements'] = { 'scanner_params': {...
Add a scanner parameter.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L249-L258
greenbone/ospd
ospd/ospd.py
OSPDaemon.add_vt
def add_vt(self, vt_id, name=None, vt_params=None, vt_refs=None, custom=None, vt_creation_time=None, vt_modification_time=None, vt_dependencies=None, summary=None, impact=None, affected=None, insight=None, solution=None, solution_t=None, detection=None, qod_t=...
python
def add_vt(self, vt_id, name=None, vt_params=None, vt_refs=None, custom=None, vt_creation_time=None, vt_modification_time=None, vt_dependencies=None, summary=None, impact=None, affected=None, insight=None, solution=None, solution_t=None, detection=None, qod_t=...
Add a vulnerability test information. Returns: The new number of stored VTs. -1 in case the VT ID was already present and thus the new VT was not considered. -2 in case the vt_id was invalid.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L260-L319
greenbone/ospd
ospd/ospd.py
OSPDaemon._preprocess_scan_params
def _preprocess_scan_params(self, xml_params): """ Processes the scan parameters. """ params = {} for param in xml_params: params[param.tag] = param.text or '' # Set default values. for key in self.scanner_params: if key not in params: para...
python
def _preprocess_scan_params(self, xml_params): """ Processes the scan parameters. """ params = {} for param in xml_params: params[param.tag] = param.text or '' # Set default values. for key in self.scanner_params: if key not in params: para...
Processes the scan parameters.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L363-L394
greenbone/ospd
ospd/ospd.py
OSPDaemon.process_vts_params
def process_vts_params(self, scanner_vts): """ Receive an XML object with the Vulnerability Tests an their parameters to be use in a scan and return a dictionary. @param: XML element with vt subelements. Each vt has an id attribute. Optional parameters can be included ...
python
def process_vts_params(self, scanner_vts): """ Receive an XML object with the Vulnerability Tests an their parameters to be use in a scan and return a dictionary. @param: XML element with vt subelements. Each vt has an id attribute. Optional parameters can be included ...
Receive an XML object with the Vulnerability Tests an their parameters to be use in a scan and return a dictionary. @param: XML element with vt subelements. Each vt has an id attribute. Optional parameters can be included as vt child. Example form: ...
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L401-L445
greenbone/ospd
ospd/ospd.py
OSPDaemon.process_credentials_elements
def process_credentials_elements(cred_tree): """ Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</passwo...
python
def process_credentials_elements(cred_tree): """ Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</passwo...
Receive an XML object with the credentials to run a scan against a given target. @param: <credentials> <credential type="up" service="ssh" port="22"> <username>scanuser</username> <password>mypass</password> </credential> <credential type="u...
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L448-L487
greenbone/ospd
ospd/ospd.py
OSPDaemon.process_targets_element
def process_targets_element(cls, scanner_target): """ Receive an XML object with the target, ports and credentials to run a scan against. @param: XML element with target subelements. Each target has <hosts> and <ports> subelements. Hosts can be a single host, a host range, a com...
python
def process_targets_element(cls, scanner_target): """ Receive an XML object with the target, ports and credentials to run a scan against. @param: XML element with target subelements. Each target has <hosts> and <ports> subelements. Hosts can be a single host, a host range, a com...
Receive an XML object with the target, ports and credentials to run a scan against. @param: XML element with target subelements. Each target has <hosts> and <ports> subelements. Hosts can be a single host, a host range, a comma-separated host list or a network address. <ports> a...
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L490-L548
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_start_scan_command
def handle_start_scan_command(self, scan_et): """ Handles <start_scan> command. @return: Response string for <start_scan> command. """ target_str = scan_et.attrib.get('target') ports_str = scan_et.attrib.get('ports') # For backward compatibility, if target and ports att...
python
def handle_start_scan_command(self, scan_et): """ Handles <start_scan> command. @return: Response string for <start_scan> command. """ target_str = scan_et.attrib.get('target') ports_str = scan_et.attrib.get('ports') # For backward compatibility, if target and ports att...
Handles <start_scan> command. @return: Response string for <start_scan> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L550-L616
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_stop_scan_command
def handle_stop_scan_command(self, scan_et): """ Handles <stop_scan> command. @return: Response string for <stop_scan> command. """ scan_id = scan_et.attrib.get('scan_id') if scan_id is None or scan_id == '': raise OSPDError('No scan_id attribute', 'stop_scan') ...
python
def handle_stop_scan_command(self, scan_et): """ Handles <stop_scan> command. @return: Response string for <stop_scan> command. """ scan_id = scan_et.attrib.get('scan_id') if scan_id is None or scan_id == '': raise OSPDError('No scan_id attribute', 'stop_scan') ...
Handles <stop_scan> command. @return: Response string for <stop_scan> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L618-L629
greenbone/ospd
ospd/ospd.py
OSPDaemon.finish_scan
def finish_scan(self, scan_id): """ Sets a scan as finished. """ self.set_scan_progress(scan_id, 100) self.set_scan_status(scan_id, ScanStatus.FINISHED) logger.info("%s: Scan finished.", scan_id)
python
def finish_scan(self, scan_id): """ Sets a scan as finished. """ self.set_scan_progress(scan_id, 100) self.set_scan_status(scan_id, ScanStatus.FINISHED) logger.info("%s: Scan finished.", scan_id)
Sets a scan as finished.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L661-L665
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scanner_param_type
def get_scanner_param_type(self, param): """ Returns type of a scanner parameter. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return None return entry.get('type')
python
def get_scanner_param_type(self, param): """ Returns type of a scanner parameter. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return None return entry.get('type')
Returns type of a scanner parameter.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L675-L681
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scanner_param_mandatory
def get_scanner_param_mandatory(self, param): """ Returns if a scanner parameter is mandatory. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return False return entry.get('mandatory')
python
def get_scanner_param_mandatory(self, param): """ Returns if a scanner parameter is mandatory. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return False return entry.get('mandatory')
Returns if a scanner parameter is mandatory.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L683-L689
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scanner_param_default
def get_scanner_param_default(self, param): """ Returns default value of a scanner parameter. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return None return entry.get('default')
python
def get_scanner_param_default(self, param): """ Returns default value of a scanner parameter. """ assert isinstance(param, str) entry = self.scanner_params.get(param) if not entry: return None return entry.get('default')
Returns default value of a scanner parameter.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L691-L697
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scanner_params_xml
def get_scanner_params_xml(self): """ Returns the OSP Daemon's scanner params in xml format. """ scanner_params = Element('scanner_params') for param_id, param in self.scanner_params.items(): param_xml = SubElement(scanner_params, 'scanner_param') for name, value in [('id...
python
def get_scanner_params_xml(self): """ Returns the OSP Daemon's scanner params in xml format. """ scanner_params = Element('scanner_params') for param_id, param in self.scanner_params.items(): param_xml = SubElement(scanner_params, 'scanner_param') for name, value in [('id...
Returns the OSP Daemon's scanner params in xml format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L699-L713
greenbone/ospd
ospd/ospd.py
OSPDaemon.new_client_stream
def new_client_stream(self, sock): """ Returns a new ssl client stream from bind_socket. """ assert sock newsocket, fromaddr = sock.accept() logger.debug("New connection from" " %s:%s", fromaddr[0], fromaddr[1]) # NB: Despite the name, ssl.PROTOCOL_SSLv23 se...
python
def new_client_stream(self, sock): """ Returns a new ssl client stream from bind_socket. """ assert sock newsocket, fromaddr = sock.accept() logger.debug("New connection from" " %s:%s", fromaddr[0], fromaddr[1]) # NB: Despite the name, ssl.PROTOCOL_SSLv23 se...
Returns a new ssl client stream from bind_socket.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L715-L738
greenbone/ospd
ospd/ospd.py
OSPDaemon.write_to_stream
def write_to_stream(stream, response, block_len=1024): """ Send the response in blocks of the given len using the passed method dependending on the socket type. """ try: i_start = 0 i_end = block_len while True: if i_end > len(r...
python
def write_to_stream(stream, response, block_len=1024): """ Send the response in blocks of the given len using the passed method dependending on the socket type. """ try: i_start = 0 i_end = block_len while True: if i_end > len(r...
Send the response in blocks of the given len using the passed method dependending on the socket type.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L741-L757
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_client_stream
def handle_client_stream(self, stream, is_unix=False): """ Handles stream of data received from client. """ assert stream data = [] stream.settimeout(2) while True: try: if is_unix: buf = stream.recv(1024) else: ...
python
def handle_client_stream(self, stream, is_unix=False): """ Handles stream of data received from client. """ assert stream data = [] stream.settimeout(2) while True: try: if is_unix: buf = stream.recv(1024) else: ...
Handles stream of data received from client.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L759-L800
greenbone/ospd
ospd/ospd.py
OSPDaemon.parallel_scan
def parallel_scan(self, scan_id, target): """ Starts the scan with scan_id. """ try: ret = self.exec_scan(scan_id, target) if ret == 0: self.add_scan_host_detail(scan_id, name='host_status', host=target, value='0') ...
python
def parallel_scan(self, scan_id, target): """ Starts the scan with scan_id. """ try: ret = self.exec_scan(scan_id, target) if ret == 0: self.add_scan_host_detail(scan_id, name='host_status', host=target, value='0') ...
Starts the scan with scan_id.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L802-L822
greenbone/ospd
ospd/ospd.py
OSPDaemon.check_pending_target
def check_pending_target(self, scan_id, multiscan_proc): """ Check if a scan process is still alive. In case the process finished or is stopped, removes the process from the multiscan _process list. Processes dead and with progress < 100% are considered stopped or with failures. ...
python
def check_pending_target(self, scan_id, multiscan_proc): """ Check if a scan process is still alive. In case the process finished or is stopped, removes the process from the multiscan _process list. Processes dead and with progress < 100% are considered stopped or with failures. ...
Check if a scan process is still alive. In case the process finished or is stopped, removes the process from the multiscan _process list. Processes dead and with progress < 100% are considered stopped or with failures. Then will try to stop the other runnings (target) scans owned...
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L824-L846
greenbone/ospd
ospd/ospd.py
OSPDaemon.calculate_progress
def calculate_progress(self, scan_id): """ Calculate the total scan progress from the partial target progress. """ t_prog = dict() for target in self.get_scan_target(scan_id): t_prog[target] = self.get_scan_target_progress(scan_id, target) return sum(t_prog.values())...
python
def calculate_progress(self, scan_id): """ Calculate the total scan progress from the partial target progress. """ t_prog = dict() for target in self.get_scan_target(scan_id): t_prog[target] = self.get_scan_target_progress(scan_id, target) return sum(t_prog.values())...
Calculate the total scan progress from the partial target progress.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L848-L855
greenbone/ospd
ospd/ospd.py
OSPDaemon.start_scan
def start_scan(self, scan_id, targets, parallel=1): """ Handle N parallel scans if 'parallel' is greater than 1. """ os.setsid() multiscan_proc = [] logger.info("%s: Scan started.", scan_id) target_list = targets if target_list is None or not target_list: rai...
python
def start_scan(self, scan_id, targets, parallel=1): """ Handle N parallel scans if 'parallel' is greater than 1. """ os.setsid() multiscan_proc = [] logger.info("%s: Scan started.", scan_id) target_list = targets if target_list is None or not target_list: rai...
Handle N parallel scans if 'parallel' is greater than 1.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L857-L896
greenbone/ospd
ospd/ospd.py
OSPDaemon.dry_run_scan
def dry_run_scan(self, scan_id, targets): """ Dry runs a scan. """ os.setsid() for _, target in enumerate(targets): host = resolve_hostname(target[0]) if host is None: logger.info("Couldn't resolve %s.", target[0]) continue por...
python
def dry_run_scan(self, scan_id, targets): """ Dry runs a scan. """ os.setsid() for _, target in enumerate(targets): host = resolve_hostname(target[0]) if host is None: logger.info("Couldn't resolve %s.", target[0]) continue por...
Dry runs a scan.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L898-L911
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_timeout
def handle_timeout(self, scan_id, host): """ Handles scanner reaching timeout error. """ self.add_scan_error(scan_id, host=host, name="Timeout", value="{0} exec timeout." .format(self.get_scanner_name()))
python
def handle_timeout(self, scan_id, host): """ Handles scanner reaching timeout error. """ self.add_scan_error(scan_id, host=host, name="Timeout", value="{0} exec timeout." .format(self.get_scanner_name()))
Handles scanner reaching timeout error.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L913-L917
greenbone/ospd
ospd/ospd.py
OSPDaemon.set_scan_host_finished
def set_scan_host_finished(self, scan_id, target, host): """ Add the host in a list of finished hosts """ self.scan_collection.set_host_finished(scan_id, target, host)
python
def set_scan_host_finished(self, scan_id, target, host): """ Add the host in a list of finished hosts """ self.scan_collection.set_host_finished(scan_id, target, host)
Add the host in a list of finished hosts
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L919-L921
greenbone/ospd
ospd/ospd.py
OSPDaemon.set_scan_target_progress
def set_scan_target_progress( self, scan_id, target, host, progress): """ Sets host's progress which is part of target. """ self.scan_collection.set_target_progress( scan_id, target, host, progress)
python
def set_scan_target_progress( self, scan_id, target, host, progress): """ Sets host's progress which is part of target. """ self.scan_collection.set_target_progress( scan_id, target, host, progress)
Sets host's progress which is part of target.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L928-L932
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_get_scans_command
def handle_get_scans_command(self, scan_et): """ Handles <get_scans> command. @return: Response string for <get_scans> command. """ scan_id = scan_et.attrib.get('scan_id') details = scan_et.attrib.get('details') pop_res = scan_et.attrib.get('pop_results') if det...
python
def handle_get_scans_command(self, scan_et): """ Handles <get_scans> command. @return: Response string for <get_scans> command. """ scan_id = scan_et.attrib.get('scan_id') details = scan_et.attrib.get('details') pop_res = scan_et.attrib.get('pop_results') if det...
Handles <get_scans> command. @return: Response string for <get_scans> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L949-L980
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_get_vts_command
def handle_get_vts_command(self, vt_et): """ Handles <get_vts> command. @return: Response string for <get_vts> command. """ vt_id = vt_et.attrib.get('vt_id') vt_filter = vt_et.attrib.get('filter') if vt_id and vt_id not in self.vts: text = "Failed to find v...
python
def handle_get_vts_command(self, vt_et): """ Handles <get_vts> command. @return: Response string for <get_vts> command. """ vt_id = vt_et.attrib.get('vt_id') vt_filter = vt_et.attrib.get('filter') if vt_id and vt_id not in self.vts: text = "Failed to find v...
Handles <get_vts> command. @return: Response string for <get_vts> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L982-L1006
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_help_command
def handle_help_command(self, scan_et): """ Handles <help> command. @return: Response string for <help> command. """ help_format = scan_et.attrib.get('format') if help_format is None or help_format == "text": # Default help format is text. return simple_r...
python
def handle_help_command(self, scan_et): """ Handles <help> command. @return: Response string for <help> command. """ help_format = scan_et.attrib.get('format') if help_format is None or help_format == "text": # Default help format is text. return simple_r...
Handles <help> command. @return: Response string for <help> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1008-L1021
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_help_text
def get_help_text(self): """ Returns the help output in plain text format.""" txt = str('\n') for name, info in self.commands.items(): command_txt = "\t{0: <22} {1}\n".format(name, info['description']) if info['attributes']: command_txt = ''.join([command...
python
def get_help_text(self): """ Returns the help output in plain text format.""" txt = str('\n') for name, info in self.commands.items(): command_txt = "\t{0: <22} {1}\n".format(name, info['description']) if info['attributes']: command_txt = ''.join([command...
Returns the help output in plain text format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1023-L1038
greenbone/ospd
ospd/ospd.py
OSPDaemon.elements_as_text
def elements_as_text(self, elems, indent=2): """ Returns the elems dictionary as formatted plain text. """ assert elems text = "" for elename, eledesc in elems.items(): if isinstance(eledesc, dict): desc_txt = self.elements_as_text(eledesc, indent + 2) ...
python
def elements_as_text(self, elems, indent=2): """ Returns the elems dictionary as formatted plain text. """ assert elems text = "" for elename, eledesc in elems.items(): if isinstance(eledesc, dict): desc_txt = self.elements_as_text(eledesc, indent + 2) ...
Returns the elems dictionary as formatted plain text.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1040-L1055
greenbone/ospd
ospd/ospd.py
OSPDaemon.handle_delete_scan_command
def handle_delete_scan_command(self, scan_et): """ Handles <delete_scan> command. @return: Response string for <delete_scan> command. """ scan_id = scan_et.attrib.get('scan_id') if scan_id is None: return simple_response_str('delete_scan', 404, ...
python
def handle_delete_scan_command(self, scan_et): """ Handles <delete_scan> command. @return: Response string for <delete_scan> command. """ scan_id = scan_et.attrib.get('scan_id') if scan_id is None: return simple_response_str('delete_scan', 404, ...
Handles <delete_scan> command. @return: Response string for <delete_scan> command.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1057-L1073
greenbone/ospd
ospd/ospd.py
OSPDaemon.delete_scan
def delete_scan(self, scan_id): """ Deletes scan_id scan from collection. @return: 1 if scan deleted, 0 otherwise. """ if self.get_scan_status(scan_id) == ScanStatus.RUNNING: return 0 try: del self.scan_processes[scan_id] except KeyError: ...
python
def delete_scan(self, scan_id): """ Deletes scan_id scan from collection. @return: 1 if scan deleted, 0 otherwise. """ if self.get_scan_status(scan_id) == ScanStatus.RUNNING: return 0 try: del self.scan_processes[scan_id] except KeyError: ...
Deletes scan_id scan from collection. @return: 1 if scan deleted, 0 otherwise.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1075-L1087
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scan_results_xml
def get_scan_results_xml(self, scan_id, pop_res): """ Gets scan_id scan's results in XML format. @return: String of scan results in xml. """ results = Element('results') for result in self.scan_collection.results_iterator(scan_id, pop_res): results.append(get_result_...
python
def get_scan_results_xml(self, scan_id, pop_res): """ Gets scan_id scan's results in XML format. @return: String of scan results in xml. """ results = Element('results') for result in self.scan_collection.results_iterator(scan_id, pop_res): results.append(get_result_...
Gets scan_id scan's results in XML format. @return: String of scan results in xml.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1089-L1099
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_xml_str
def get_xml_str(self, data): """ Creates a string in XML Format using the provided data structure. @param: Dictionary of xml tags and their elements. @return: String of data in xml format. """ responses = [] for tag, value in data.items(): elem = Element(ta...
python
def get_xml_str(self, data): """ Creates a string in XML Format using the provided data structure. @param: Dictionary of xml tags and their elements. @return: String of data in xml format. """ responses = [] for tag, value in data.items(): elem = Element(ta...
Creates a string in XML Format using the provided data structure. @param: Dictionary of xml tags and their elements. @return: String of data in xml format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1101-L1121
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_scan_xml
def get_scan_xml(self, scan_id, detailed=True, pop_res=False): """ Gets scan in XML format. @return: String of scan in XML format. """ if not scan_id: return Element('scan') target = ','.join(self.get_scan_target(scan_id)) progress = self.get_scan_progress(s...
python
def get_scan_xml(self, scan_id, detailed=True, pop_res=False): """ Gets scan in XML format. @return: String of scan in XML format. """ if not scan_id: return Element('scan') target = ','.join(self.get_scan_target(scan_id)) progress = self.get_scan_progress(s...
Gets scan in XML format. @return: String of scan in XML format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1123-L1146
greenbone/ospd
ospd/ospd.py
OSPDaemon.get_vt_xml
def get_vt_xml(self, vt_id): """ Gets a single vulnerability test information in XML format. @return: String of single vulnerability test information in XML format. """ if not vt_id: return Element('vt') vt = self.vts.get(vt_id) name = vt.get('name') ...
python
def get_vt_xml(self, vt_id): """ Gets a single vulnerability test information in XML format. @return: String of single vulnerability test information in XML format. """ if not vt_id: return Element('vt') vt = self.vts.get(vt_id) name = vt.get('name') ...
Gets a single vulnerability test information in XML format. @return: String of single vulnerability test information in XML format.
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/ospd.py#L1330-L1413