API Reference

Module contents

pyappscan.create_engine(url, username=None, password=None, key='AppscanEnterpriseUser', apikey=None, secretkey=None, verify=True)

Convenience function for importing all modules.

This function is in the base of the module and will return a properly initialized object namespace with which you can access all appscan methods. This abstracts the state management and login management of appscan. Usage:

Example

>>> from pyappscan import create_engine
# imported
>>> appscan = create_engine(
...             url="https://appscan.domain.com/ase/api/",
...             apikey="AEF8137319C8",
...             secretkey="XXXXXXXX"
... )
Parameters
  • url (str) – Base URL for appscan API

  • username (str, optional) – Username to log in with; used in conjunction with password. Defaults to None.

  • password (str, optional) – Password to log in with; used in conjunction with username. Defaults to None.

  • key (str, optional) – Feature Key to log in as. Defaults to “AppscanEnterpriseUser”.

  • apikey (str, optional) – API Key to log in with; used in conjunction with secretkey. Defaults to None.

  • secretkey (str, optional) – API Secret to log in with; used in conjunction with apikey. Defaults to None.

  • verify (bool, optional) – Certificate path for requests. Defaults to False.

Returns

pyappscan.pyappscan.PyAppscan

Submodules

pyappscan.pyappscan module

class pyappscan.pyappscan.PyAppscan(baseurl: str, username: Optional[str] = None, password: Optional[str] = None, key: str = 'AppscanEnterpriseUser', apikey: Optional[str] = None, secretkey: Optional[str] = None, verify: bool = True)

Bases: pyappscan.query.Query

Main class that is returned when called from pyappscan.create_engine()

Note

You may be wondering why there is no deletejob method. This is because you cannot directly delete jobs via the API, you have to delete the folder item. This can be done using the deletefolderitem() method, during which you should also delete the associated report, as not deleting it causes issues with Appscan internals.

Parameters
  • baseurl (str) – Base URL for appscan

  • username (str, optional) – Username to log in with; used in conjunction with password. Defaults to None.

  • password (str, optional) – Password to log in with; used in conjunction with username. Defaults to None.

  • key (str, optional) – Feature Key to log in as. Defaults to “AppscanEnterpriseUser”.

  • apikey (str, optional) – API Key to log in with; used in conjunction with secretkey. Defaults to None.

  • secretkey (str, optional) – API Secret to log in with; used in conjunction with apikey. Defaults to None.

  • verify (bool, optional) – Certificate path for requests. Defaults to False.

baseurl

Base URL for appscan

Type

str

username

Username to log in with; used in conjunction with password. Defaults to None.

Type

str

password

Password to log in with; used in conjunction with username. Defaults to None.

Type

str

key

Feature Key to log in as. Defaults to “AppscanEnterpriseUser”.

Type

str

apikey

API Key to log in with; used in conjunction with secretkey. Defaults to None.

Type

str

secretkey

API Secret to log in with; used in conjunction with apikey. Defaults to None.

Type

str

verify

Certificate path for requests. Defaults to False.

Type

bool

logger

logger for pyappscan; this can be overwritten by running the following on an instantiated object:

>>> app.logger.handlers = []
Type

logging.Logger

adduser(realname: str, username: str, email: str, usertype: Union[str, int]) Dict[str, str]

Add a user to appscan with a given usertype

Parameters
  • realname (str) – Real name of the user

  • username (str) – Desired user name of the user

  • email (str) – Email of the user

  • usertype (Union[str, int]) – Usertype ID; if string, usertype ID will be grabbed

Raises

UserTypeError – Not a valid user type; valid user types can be found using the usertypequery() method

Returns

Result of user submission

Return type

Dict[str, str]

References

pyappscan.query.Query.usertypequery()

createapikey() Dict[str, str]

Create API key

Creates an API key and Secret Key for current user to utilize instead of username/password combo, also no key is needed, and can be safely stored in environment variables or encrypted files (still do not commit these to Github)!

Note

Can be run as many times as you want, but invalidates old API/Secret key combo

Returns

Dictionary containing api key and secret key

Return type

Dict[str, str]

createapplication(appname: str, attributedict: Optional[Dict[str, str]] = None, appdesc: Optional[str] = None, appoutdated: bool = False, copyappname: Optional[str] = None) Dict[str, Any]

Create application from attribute dictionary

Note that the dictionary structure is: dict —-dict ——–list ————dict

Note

When giving a copyappname and an attributedict, you will overwrite only the entries in the copyappname app’s attriute dictionary which exist in the attributedict.

Parameters
  • appname (str) – Application name

  • attributedict (dict, optional) – Attribute dictionary for application; you can find this by querying applicationattributequery(). Defaults to None.

  • appdesc (str, optional) – App description. Defaults to None.

  • appoutdated (bool, optional) – Is the app outdated. Defaults to False.

  • copyappname (str, optional) – Application to copy and merge attributes. Defaults to None.

Raises

ValueError – Raised when neither attributedict or copyappname are given, although they can both be given to merge attributes

Returns

Result of app creation, including app ID

Return type

Dict[str, Any]

References

pyappscan.query.Query.applicationattributequery()

createfolder(name: str, parent: Union[int, str], description: Optional[str] = None, contact: Optional[str] = None) Dict[str, str]

Create a folder

Parameters
  • name (str) – Folder name

  • parent (int OR str) – Folder parent ID; if string, folder ID will be grabbed

  • description (str, optional) – Folder description. Defaults to None.

  • contact (str, optional) – Folder contact info. Defaults to None.

Raises

ValueError – Parent cannot be None

Returns

Result of folder creation including folder ID

Return type

dict

createfolderitem(templateid, appid, size=None, empty=False, keySet=None, values=None)

Create a folder item

Parameters
  • templateid (int) – Template ID

  • appid (App ID) – Application ID

  • size (int, optional) – size of folder item. Defaults to None.

  • empty (bool, optional) – Is item empty. Defaults to False.

  • keySet (str, optional) – Keyset for folder item. Defaults to None.

  • values (dict, optional) – Value dictionary for folder item. Defaults to None.

Raises

NotImplementedError – Not implemented yet

createjob(jobname: str, policyname: Union[str, int], foldername: Union[str, int], templatename: Union[str, int], jobdesc: Optional[str] = None, jobcontact: Optional[str] = None, appname: Optional[Union[str, int]] = None) Dict[str, str]

Alias for jobcreate()

References

jobcreate()

createuser(realname: str, username: str, email: str, usertype: Union[str, int]) Dict[str, str]

Alias for adduser() for convenience

References

adduser()

deleteapikey() Dict[str, str]

Deletes API key for current user

Returns

Result of api key deletion

Return type

Dict[str, str]

deleteapplication(appid: int) Dict[str, str]

Delete application

Parameters

appid (int) – Application ID

Raises

ValueError – raised if App ID is None

Returns

Result of deletion

Return type

Dict[str, str]

deletefolder(folderid: int) Dict[str, str]

Delete folder

Parameters

folderid (int) – Folder ID

Returns

Result of folder deletion

Return type

dict

deletefolderitem(folderitemid: int) Dict[str, str]

Delete folder item

Parameters

folderitemid (int) – Folder item ID

Returns

Result of folder item deletion

Return type

dict

jobcreate(jobname: str, policyname: Union[str, int], foldername: Union[str, int], templatename: Union[str, int], jobdesc: Optional[str] = None, jobcontact: Optional[str] = None, appname: Optional[Union[str, int]] = None) Dict[str, str]

Create a folder job

Note

In order to initialize a job you have to run updatescan() to specify a starting URL.

Parameters
  • jobname (str) – Job name

  • policyname (Union[str, int]) – Policy ID or Name

  • foldername (Union[str, int]) – Folder ID or Name

  • templatename (Union[str, int]) – Template ID or Name

  • jobdesc (str, optional) – Job Description. Defaults to None.

  • jobcontact (str, optional) – Job contact. Defaults to None.

  • appname (Union[str, int], optional) – Application ID or Name to associate

  • None. (with the job. Defaults to) –

Returns

Results of job creation including assigned Job ID

Return type

Dict[str, str]

References

updatescan()

schedulescan(jobid: int, scheduleDelta: datetime.timedelta, schedule_start: Optional[datetime.datetime] = None, schedule_end: Optional[datetime.datetime] = None, exclusionDelta: Optional[datetime.timedelta] = None, exclusion_start: Optional[datetime.datetime] = None, exclusion_end: Optional[datetime.datetime] = None) Dict[str, str]

Schedule scan for recurring scanning

Note

This feature is still in beta.

Parameters
  • jobid (int) – Job ID

  • scheduleDelta (datetime.timedelta) – interval to schedule at

  • schedule_start (datetime.datetime, optional) – time to start scan schedule. Defaults to None.

  • schedule_end (datetime.datetime, optional) – time to end scan schedule. Defaults to None.

  • exclusionDelta (datetime.timedelta, optional) – interval to exlude during. Defaults to None.

  • exclusion_start (datetime.datetime, optional) – time to start exclusion schedule. Defaults to None.

  • exclusion_end (datetime.datetime, optional) – time to end exclusion schedule. Defaults to None.

Returns

Schedule result

Return type

Dict[str, str]

startjob(jobid: int, action: str = 'run') Dict[str, str]

Start a scan on a job

Parameters
  • jobid (int) – Job ID

  • action (str, optional) – Action to take; only exists for extensibility, as the only supported action as of writing is run. Defaults to ‘run’.

Returns

Result of job start

Return type

Dict[str, str]

startscan(jobid: int, action: str = 'run') Dict[str, str]

Alias for startjob()

References

startjob()

updateapplication(appid: int, appname: str, attributedict: Optional[Dict[str, Any]] = None, appdesc: Optional[str] = None, appoutdated: bool = False, copyappname: Optional[str] = None) Dict[str, Any]

Update application

Parameters
  • appid (int) – App ID

  • appname (str) – Application name

  • attributedict (dict, optional) – Attribute dictionary for application; you can find this by querying applicationattributequery(). Defaults to None.

  • appdesc (str, optional) – App description. Defaults to None.

  • appoutdated (bool, optional) – Is the app outdated. Defaults to False.

  • copyappname (str, optional) – Application to copy and merge attributes. Defaults to None.

Raises

ValueError – Raised when neither attributedict or copyappname are given, although they can both be given to merge attributes

Returns

Result of app creation, including app ID

Return type

Dict[str, Any]

updatefolder(folderid: int, name: Optional[str] = None, description: Optional[str] = None, contact: Optional[str] = None) Dict[str, str]

Update folder

Parameters
  • folderid (int) – Folder ID

  • name (str, optional) – Folder name. Defaults to None.

  • description (str, optional) – Folder description. Defaults to None.

  • contact (str, optional) – Folder contact info. Defaults to None.

Returns

Result of folder update

Return type

Dict[str, str]

updatejob(jobid: int, jobname: str, policyname: Union[int, str], foldername: Union[int, str], templatename: Union[int, str], jobdesc: Optional[str] = None, jobcontact: Optional[str] = None, appname: Optional[Union[str, int]] = None) Dict[str, str]

Update job information

Parameters
  • jobid (int) – Job ID

  • jobname (str) – Job name

  • policyname (int OR str) – Policy ID or Name

  • foldername (int OR str) – Folder ID or Name

  • templatename (int OR str) – Template ID or Name

  • jobdesc (str, optional) – Job Description. Defaults to None.

  • jobcontact (str, optional) – Job contact. Defaults to None.

  • appname (int OR str, optional) – Application ID or Name to associate

  • None. (with the job. Defaults to) –

Returns

Results of job update

Return type

dict

updatescan(jobid: int, data: str, datacode: str = 'url', encrypt: bool = False) Dict[str, Any]

Updates variables in a given job

Parameters
  • jobid (int) – Job ID

  • data (str) – Data value to send to datacode

  • datacode (str, optional) – Data code to apply value to on given job. Defaults to ‘url’. Acceptable entries: * url * username * password * method * header * lockout * additionaldomains * exclusions

  • encrypt (bool, optional) – Whether or not to encrypt data; should be

  • other (done when datacode is username or password or when) –

  • uploaded (sensitive info is being) –

  • False. (like header auth tokens. Defaults to) –

Raises

DataCodeError – When datacode is not valid.

Returns

Result of scan update

Return type

Dict[str, Any]

pyappscan.exceptions module

exception pyappscan.exceptions.AttrError(*args)

Bases: Exception

Bad attribute in app attribute dictionary

exception pyappscan.exceptions.DataCodeError

Bases: Exception

Bad Data Code

exception pyappscan.exceptions.LoginError

Bases: Exception

Login failed

exception pyappscan.exceptions.LogoutError

Bases: Exception

Logout failed

exception pyappscan.exceptions.UserTypeError

Bases: Exception

Bad Usertype

pyappscan.helper module

class pyappscan.helper.Helper(baseurl, username, password, key, apikey, secretkey, verify)

Bases: object

Helper class which is inherited by all other classes; do not use this class directly, use pyappscan.create_engine()

attributecheck(attributedict)

Checks attributes for pyappscan.pyappscan.PyAppscan.createapplication()

Parameters

attributedict (dict) – attribute dictionary

Raises

AttrError – Raised if attribute not present

References

deltaToString(delta: datetime.timedelta) Tuple[str, str]

Converts a python datetime.timedelta object to an appscan scheduling string

Parameters

delta (datetime.timedelta) – python timedelta object

Raises

ValueError – raised when delta is not timedelta

Returns

tuple of the datestring, and the type of datestring respectively

Return type

Tuple[str, str]

dictprint(dic: Dict[Any, Any], string: str = '', tab: int = 0) str
dicttolistofdicts(dic: Dict[str, Any]) List[Dict[str, Any]]

Converts a dictionary to a list of dictionaries

Parameters

dic (Dict[str, Any]) – dictionary to be converted

Returns

list of dictionaries

Return type

List[Dict[str, Any]]

login() requests.sessions.Session

Logs into the server; you shouldn’t have to call this yourself

Raises

LoginError – Raised if Login was unsuccessful

Returns

Requests session with login cookies

Return type

requests.Session

logout(session: requests.sessions.Session) requests.models.Response

Logs out of appscan

Parameters

session (requests.Session) – a requests session object that has been logged into appscan with login()

Raises

LogoutError – Raised when logout failed

Returns

Requests response object after logging out

Return type

requests.Response

queryhelper(url_ext: str, name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Decides how to query endpoint data

If name is given but category is not, returns query of url_ext with name appended for direct item query. If name is not given, it returns the query of url_ext. If name and category are given, it returns the query of url_ext after searching for value name in key category.

Parameters
  • url_ext (str) – Extension of baseurl to query

  • name (str, optional) – Value to search for; either appended to url_ext or searched for in key category. Defaults to None.

  • category (str, optional) – Key to search name in. Defaults to None.

Returns

either returns a dictionary or a list; will return dictionary

if name is given or if name and category are given.

Return type

Union[Dict[str, str], List[str]]

returnhtml(obj: requests.models.Response) bytes

Helper function to return HTML content from a response object

Parameters

obj (requests.Response) – a requests response object from appscan

Returns

Returns binary unicode content that must be decoded

Return type

bytes

returnobject(obj: requests.models.Response) Union[dict, requests.models.Response]

Helper function to return json or log and return errors with the request

Parameters

obj (requests.Response) – a requests response object from appscan

Returns

if json can be coerced, return JSON, else return object back

Return type

Union[dict, requests.Response]

searchdict(dic: Dict[str, list], name: str, category: str) Optional[Dict[str, Any]]

Searches a dictionary of lists for a value

Parameters
  • dic (Dict[str, list]) – Dictionary of lists

  • name (str) – Value to be searched for

  • category (str) – Key to search name in

Raises

TypeError – Raised when dic is not type dict

Returns

returns dict when found, None if not found

Return type

Union[Dict[str, Any], None]

searchlist(liss: List[dict], name: str, category: str) Optional[Dict[str, Any]]

Searches a python list of dictionaries for dict containing value name and key category.

Parameters
  • liss (List[dict]) – List of dictionaries to be searched

  • name (str) – Value to be searched for

  • category (str) – Key to search name in

Raises

TypeError – Raised when liss is not type list

Returns

returns dictionary if found, None if not found.

Return type

Union[Dict[str, Any], None]

version() Dict[str, str]

Returns version of appscan

Returns

Version dictionary

Return type

Dict[str, str]

pyappscan.query module

class pyappscan.query.Query(baseurl: str, username: str, password: str, key: str, apikey: str, secretkey: str, verify: bool)

Bases: pyappscan.helper.Helper

Do not call this directly; use pyappscan.create_engine()

aboutissue(appid: Union[int, str], issueid: int) bytes

Gets HTML document about given issue ID

Parameters
  • appid (Union[int, str]) – Application ID; if string, app ID will be grabbed.

  • issueid (int) – Issue ID

Returns

HTML encoded in UTF-8 format

Return type

bytes

appissuequery(appname: Optional[Union[str, int]] = None, severity: str = 'High', sortBy: str = 'Severity', itemcount: int = 100, includeinfoseverity: bool = False) List[dict]

Queries issues endpoint using application path

Parameters
  • appname (str OR int, optional) – Application ID or name. If str

  • None. (grabs app ID for you. Defaults to) –

  • severity (str, optional) – Severity of issues to include. Defaults to ‘High’.

  • sortBy (str, optional) – Sorting category. Defaults to ‘Severity’.

  • itemcount (int, optional) – Amount of issues to return. Defaults to 100.

  • includeinfoseverity (bool, optional) – Include issues with informational

  • False. (severity. Defaults to) –

Returns

list of issue dictionaries

Return type

list

applicationattributequery(appid: Optional[Union[str, int]] = None) Dict[str, List[dict]]

Gets attributes of application

Parameters

appid (int OR str, optional) – App ID; if string, the app ID is grabbed. Defaults to None.

Returns

dictionary of attributes with attribute list inside.

Return type

Dict[str, List[dict]]

applicationquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries application endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

buildfoldertree() str

Used to print out the entire tree of the folder structure of appscan

Returns

formatted tree string

Return type

str

currentscans(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries scan queue/management endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

dashboardquery(businessunit: str) bytes

Queries dashboard

Note

This is method is still in beta

Parameters

businessunit (str) – Business unit associated with the dashboard

Returns

HTML of dashboard

Return type

bytes

dastquery(jobid: int) Dict[str, str]

Gets the DAST configuration of the job

Parameters

jobid (int) – ID of job

Returns

DAST configuration

Return type

dict

folderitemquery(folderitemid: int, options: bool = False, reports: bool = False, scanlog: bool = False, statistics: bool = False)

Gets a given folder item’s requested information

options returns the options associated with the folder item reports returns report IDs and info associated with the folder item scanlog returns the scan log of the folder item statistics returns the statistics of the folder item

Parameters
  • folderitemid (int) – Folder item ID

  • options (bool, optional) – returns the options associated with the folder item. Defaults to False.

  • reports (bool, optional) – returns report IDs and info associated with the folder item. Defaults to False.

  • scanlog (bool, optional) – returns the scan log of the folder item. Defaults to False.

  • statistics (bool, optional) – returns the statistics of the folder item. Defaults to False.

Raises

ValueError – Raised if you provide a string for folderitemid

Returns

Returns information requested

Return type

dict

folderitemsquery(folderid: Union[int, str], keyword: Optional[str] = None, name: Optional[str] = None, category: Optional[str] = None) Dict[str, Any]

Get all items in a folder, DAST-compliant or not.

Parameters
  • folderid (int OR str) – Folder ID; if string, folder ID will be grabbed.

  • keyword (str, optional) – Keyword if you know the type of folder items you’re

  • values (looking for. Defaults to None. Accepted) – report-pack content-scan-job

  • name (str, optional) – Value to search for in category. Defaults to None.

  • category (str, optional) – Key to search for name. Defaults to None.

Returns

Report pack, scan jobs, or both, depending on the keyword or lack thereof

Return type

dict

References

pyappscan.helper.Helper.queryhelper()

folderjobsquery(foldername: Union[str, int], jobname: Optional[Union[str, int]] = None) Union[List[dict], Dict[str, str]]

Queries jobs endpoint of folder path

Parameters
  • foldername (Union[str, int]) – ID or name of folder to query; if str

  • you (grabs ID for) –

  • jobname (Union[str, int], optional) – Job ID or name; if str grabs ID

  • None. (for you. Defaults to) –

Returns

Returns list if only foldername is given, returns dict otherwise

Return type

Union[List[dict], Dict[str, str]]

folderquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries folder endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

getapikey()

Gets API key and API secret from appscan; requires username and password to work

issueattributequery() Dict[str, List[dict]]

Gets issue attributes JSON schema

Returns

dictionary of attirbutes

Return type

Dict[str, List[dict]]

issuequery(reportid: Optional[int] = None, appid: Optional[Union[str, int]] = None, issueid: Optional[int] = None, zipfile: bool = False, issuecount: int = 100) Union[List[dict], Dict[str, Any]]

Grabs issues from either a report or an app, or grabs issue details

Provided a reportid, this will use reportquery() to grab issues, or if provided an appid, this will use appissuequery() to grab issues, or if provided an issueid in concurrence with either one will return that specific isssue from the requested app or report.

Note

This method is deprecated due to being discouraged when the ability to call reportjsonquery() or appissuequery() is feasible, and for using reportquery() instead of reportjsonquery().

Parameters
  • reportid (int, optional) – Report ID. Defaults to None.

  • appid (Union[str, int], optional) – App ID; if string, app ID will be grabbed. Defaults to None.

  • issueid (int, optional) – Issue ID. Defaults to None.

  • zipfile (bool, optional) – Should the app issues be returned in ZIP format. Note that this cannot be True while reportid is given. Defaults to False.

  • issuecount (int, optional) – Issue count to be returned. Defaults to 100.

Raises

TypeError – Raised if zipfile is True while reportid is given.

Returns

Returns issue list if issueid is not provided, and dict if it is provided.

Return type

Union[List[dict], Dict[str, Any]]

References

issuetypequery(issuetypeid: Optional[int] = None, lookuptype: Optional[str] = None, lookupname: Optional[str] = None) Union[bytes, Dict[str, Any]]

Gets data about issue type depending on information given

Parameters
  • issuetypeid (int, optional) – Issuetype ID. If None, lookupname is required. Defaults to None.

  • lookuptype (str, optional) –

    Type of information to look up; defaults to None. Accepted values are:

    • advisory

    • fix

  • lookupname (str, optional) – Lookup string identifier; usually wf-*. If None, lookup name associated with issue type is looked up and searched. Defaults to None.

Returns

Returns bytes type HTML information for a lookupname or dict when no lookuptype and lookupname is given.

Return type

Union[bytes, Dict[str, Any]]

issuetypes(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries issue type endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

jobsquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries jobs endpoint for a given folder or job

Returns all DAST-configured jobs in a folder. Given a name as a job ID and no category, this will return the entry for the given job ID. If given no name, this will return all jobs in the console. If given a name and a category, this will return the job that matches the category in a manner similar to queryhelper.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

Returns

If you have both or neither, a dict is returned, otherwise list is returned

Return type

dict OR list

References

folderjobsquery()

permissionsquery() Dict[str, str]

Get permissions of the current user

Returns

permissions dictionary

Return type

dict

reportjsonquery(reportid: int, issues: bool = False, summary: bool = False) Union[List[dict], Dict[str, Any]]

Get report data in JSON format

By default you hit the reports/{reportid}/data endpoint, from which you will get a detailed data dictionary in which the issues list usually at wf-security-issues.issue. If you set issues to True, you get a detailed issue dictionary which has the issue list at issues.security-issue. If you set summary to True you will get an issue summary by severity and status.

Parameters
  • reportid (int) – Report ID

  • issues (bool, optional) – Get detailed issues list. Defaults to False.

  • summary (bool, optional) – Get summary of issues. Defaults to False.

Returns

This method tries to filter out the nonsense and leave only the issue lists, but for some reason sometimes the base dictionary structure changes, so sometimes we just return the dictionary.

Return type

Union[List[dict], Dict[str, Any]]

reportquery(reportid: int, issues: bool = False) bytes

Report information from XML reports endpoint; please use reportjsonquery() instead

Note

This only exists for backwards compatibility; please use reportjsonquery() instead

Parameters
  • reportid (int) – Report ID

  • issues (bool, optional) – Whether to get issue report (default is summary report). Defaults to False.

Returns

HTML/XML of the endpoint

Return type

bytes

References

reportjsonquery()

scannerquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries scanner endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

schedulequery(jobid: int) Dict[str, str]

Get the current schedule of the job

Parameters

jobid (int) – ID of the job

Returns

Dictionary of the schedule of the scan

Return type

dict

servergroupquery() Dict[str, dict]
templatequery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries template endpoint.

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

testpolicyquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries test policy endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

userquery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries user endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()

usertypequery(name: Optional[str] = None, category: Optional[str] = None) Union[Dict[str, str], List[dict]]

Queries usertype endpoint

Omit category if using element ID as name argument to query element directly.

Parameters
  • name (str, optional) – Key to search for. Defaults to None.

  • category (str, optional) – Value to search for. Defaults to None.

References

pyappscan.helper.Helper.queryhelper()