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.cli_options.usage(error_message)[source]

Display the usage message describing how to use owtf.

Parameters:error_message (str) – Error message to display
Returns:None
Return type:None

owtf.lib.exceptions module

owtf.lib.exceptions

Declares the framework exceptions and HTTP errors

exception owtf.lib.exceptions.APIError(message, code=400)[source]

Bases: tornado.web.HTTPError

Exception for API-based errors

exception owtf.lib.exceptions.DBIntegrityException(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.DatabaseNotRunningException[source]

Bases: exceptions.Exception

exception owtf.lib.exceptions.FrameworkAbortException(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.FrameworkException(value)[source]

Bases: exceptions.Exception

exception owtf.lib.exceptions.InvalidActionReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidConfigurationReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidErrorReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidMappingReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidMessageReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidParameterType(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidSessionReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidTargetReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidTransactionReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidUrlReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidWorkReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.InvalidWorkerReference(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.PluginAbortException(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.PluginException[source]

Bases: exceptions.Exception

exception owtf.lib.exceptions.PluginsAlreadyLoaded[source]

Bases: owtf.lib.exceptions.PluginException

load_plugins() called twice.

exception owtf.lib.exceptions.PluginsDirectoryDoesNotExist[source]

Bases: owtf.lib.exceptions.PluginException

The specified plugin directory does not exist.

exception owtf.lib.exceptions.UnreachableTargetException(value)[source]

Bases: owtf.lib.exceptions.FrameworkException

exception owtf.lib.exceptions.UnresolvableTargetException(value)[source]

Bases: owtf.lib.exceptions.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 calls acquire(), and therefore blocks if acquire() was called previously. - __exit__ always calls release(). It is therefore a bug to call release() from within a context manager. - Added locked() function. - Added blocking parameter to acquire() 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: object

A file locking mechanism that has context-manager support so you can use it in a with statement. This should be relatively cross compatible as it doesn’t rely on msvcrt or fcntl for the locking.

exception FileLockException[source]

Bases: exceptions.Exception

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
locked()[source]

Returns True iff the file is owned by THIS FileLock instance. (Even if this returns false, the file could be owned by another FileLock instance, possibly in a different thread or process).

Returns:True if file owned by Filelock instance
Return type:bool
purge()[source]

For debug purposes only. Removes the lock file from the hard disk.

release()[source]
Get rid of the lock by deleting the lockfile.
When working in a with statement, this gets automatically called at the end.
Returns:None
Return type:None

owtf.lib.owtf_process module

Module contents