Groupby (risksense_api.__subject.__groupBy.__groupBy)

Groupby module defined for different groupby related api endpoints.

class risksense_api.__subject.__groupBy.__groupBy.GroupBy(profile)[source]

Bases: Subject

Groupby Class

Parameters:

profile (object) –

__init__(profile)[source]

Class for Groupby function defintions.

To utlise groupby function:

Parameters:

profile (object) – Profile Object

Usage:

self.{risksenseobjectname}.groupby.{function}

Examples

To get hostfindings using groupby method,use get_groupby_hostfinding() function

>>> self.{risksenseobject}.groupby.get_groupby_hostfinding(123,'test.csv')
get_groupby_hostfinding(hostfindingkey, metricfields, filters, sortorderfield, client_id=None)[source]

Get groupby values for host finding

Parameters:
  • hostfindingkey (str) – The main key where other metric fields depend on

  • metricfields (list) – The fields that will be populated

  • filters (list) – The filters which will populate in groupby

  • sortorderfield (list) – The order to sort the groupby values, please choose ASC for ascending and DESC for descending

  • client_id (typing.Optional[int]) – The client id , if none, default client id is taken

Return type:

dict

Returns:

The groupby data

Example

To get groupby data

>>> self.{risksenseobject}.groupby.get_groupby_hostfinding(["Host Finding Hosts Count","Host Finding Open Count","Host Finding Closed Count","Host Finding With Threat Count","Host Finding Threat Count"],"Host Finding Asset Tags",[{"field":"criticality","exclusive":false,"operator":"IN","orWithPrevious":false,"implicitFilters":[],"value":"1,"}],[{"field":"Host Finding Asset Tags","direction":"ASC"}])
get_groupby_appfinding(appfindingkey, metricfields, filters, sortorderfield, client_id=None)[source]

Get groupby values for app finding

Parameters:
  • appfindingkey (str) – The main key where other metric fields depend on

  • metricfields (list) – The fields that will be populated

  • filters (list) – The filters which will populate in groupby

  • sortorderfield (list) – The order to sort the groupby values, please choose ASC for ascending and DESC for descending

  • client_id (typing.Optional[int]) – The client id , if none, default client id is taken

Returns:

The groupby data

Example

To get groupby data

>>> self.{risksenseobject}.groupby.get_groupby_appfinding(["App Finding Apps Count","App Finding Open Count","App Finding Closed Count","App Finding VRR Critical Count","App Finding VRR High Count","App Finding VRR Medium Count","App Finding VRR Low Count","App Finding VRR Info Count","App Finding Severity Critical Count","App Finding Severity High Count","App Finding Severity Medium Count","App Finding Severity Low Count","App Finding Severity Info Count","App Finding With Threat Count","App Finding Threat Count","App Finding CVE Count"],"App Finding Asset Criticality",[{"field":"web_app_url","exclusive":false,"operator":"IN","orWithPrevious":false,"implicitFilters":[],"value":"Benchmarx_Arnab,"}],[{"field":"App Finding Asset Criticality","direction":"DESC"}])