owtf.lib package¶
Submodules¶
owtf.lib.cli_options module¶
owtf.lib.cli_options¶
Main CLI processing machine
- owtf.lib.cli_options.parse_options(cli_options, valid_groups, valid_types)[source]¶
Main arguments processing for the CLI
- Parameters:
cli_options (dict) – CLI args Supplied by user
valid_groups (list) – Plugin groups to chose from
valid_types (list) – Plugin types to chose from
- Returns:
- Return type:
owtf.lib.exceptions module¶
owtf.lib.exceptions¶
Declares the framework exceptions and HTTP errors
- exception owtf.lib.exceptions.APIError(status_code: int = 500, log_message: str | None = None, *args: Any, **kwargs: Any)[source]¶
Bases:
HTTPErrorEquivalent to
RequestHandler.HTTPErrorexcept for in name
- exception owtf.lib.exceptions.DBIntegrityException(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.FrameworkAbortException(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidActionReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidConfigurationReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidErrorReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidMappingReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidMessageReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidParameterType(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidSessionReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidTargetReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidTransactionReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidUrlReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidWorkReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.InvalidWorkerReference(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.PluginAbortException(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.PluginsAlreadyLoaded[source]¶
Bases:
PluginExceptionload_plugins() called twice.
- exception owtf.lib.exceptions.PluginsDirectoryDoesNotExist[source]¶
Bases:
PluginExceptionThe specified plugin directory does not exist.
- exception owtf.lib.exceptions.UnreachableTargetException(value)[source]¶
Bases:
FrameworkException
- exception owtf.lib.exceptions.UnresolvableTargetException(value)[source]¶
Bases:
FrameworkException
owtf.lib.filelock module¶
owtf.lib.filelock¶
Implementation of a simple cross-platform file locking mechanism. This is a modified version of code retrieved on 2013-01-01 from http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python. The original code was released under the BSD License, as is this modified version. Modifications in this version:
Tweak docstrings for sphinx.
Accept an absolute path for the protected file (instead of a file name relative to cwd).
Allow timeout to be None.
Fixed a bug that caused the original code to be NON-threadsafe when the same FileLock instance was shared by multiple threads in one process. (The original was safe for multiple processes, but not multiple threads in a single process. This version is safe for both cases.)
Added
purge()function.Added
available()function.Expanded API to mimic
threading.Lock interface: -__enter__always callsacquire(), and therefore blocks ifacquire()was called previously. -__exit__always callsrelease(). It is therefore a bug to callrelease()from within a context manager. - Addedlocked()function. - Added blocking parameter toacquire()method
# taken from https://github.com/ilastik/lazyflow/blob/master/lazyflow/utility/fileLock.py # original version from http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/
- class owtf.lib.filelock.FileLock(protected_file_path, timeout=None, delay=1, lock_file_contents=None)[source]¶
Bases:
objectA file locking mechanism that has context-manager support so you can use it in a
withstatement. This should be relatively cross compatible as it doesn’t rely onmsvcrtorfcntlfor the locking.- acquire(blocking=True)[source]¶
- Acquire the lock, if possible. If the lock is in use, and blocking is False, return False.
Otherwise, check again every self.delay seconds until it either gets the lock or exceeds timeout number of seconds, in which case it raises an exception.
- Parameters:
blocking (bool) – File blocked or not
- Returns:
True if lock is acquired, else False
- Return type:
bool
- available()[source]¶
Returns True iff the file is currently available to be locked.
- Returns:
True if lockfile is available
- Return type:
bool