Skip to content

Commit

Permalink
fix webui_link and more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarman committed May 13, 2016
1 parent 6f28ee9 commit 6a5e492
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/enterprise-protection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ Queries
Models
------

.. autoclass:: cbapi.protection.models.Computer
.. automodule:: cbapi.protection.models
:members:
:inherited-members:
:undoc-members:
13 changes: 2 additions & 11 deletions docs/enterprise-response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@ Queries

Models
------
.. autoclass:: cbapi.response.models.Feed

.. autoclass:: cbapi.response.models.Binary
.. automodule:: cbapi.response.models
:members:
:inherited-members:

.. autoclass:: cbapi.response.models.SensorGroup

Utility Functions
-----------------

.. automodule:: cbapi
:members:
:undoc-members:
1 change: 1 addition & 0 deletions src/cbapi/oldmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def _build_api_request_uri(self):
else:
return baseuri

@property
def webui_link(self):
"""Returns a link associated with this object in the Carbon Black user interface.
Expand Down
1 change: 0 additions & 1 deletion src/cbapi/protection/rest_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from six import iteritems
from ..utils import convert_query_params
from ..query import PaginatedQuery

Expand Down
10 changes: 9 additions & 1 deletion src/cbapi/response/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ def __init__(self, cb, md5sum, initial_data=None):
def _build_api_request_uri(self):
return Binary.urlobject + "/{0:s}/summary".format(self.md5sum)

@property
def webui_link(self):
return '{0:s}/#binary/{1:s}'.format(self._cb.url, self.md5sum)

Expand Down Expand Up @@ -966,6 +967,7 @@ def start(self):

@property
def modloads(self):
"""Generator that returns `:py:class:CbModLoadEvent` associated with this process"""
i = 0
for raw_modload in self._attribute('modload_complete', []):
yield self._event_parser.parse_modload(i, raw_modload)
Expand All @@ -977,41 +979,47 @@ def unsigned_modloads(self):

@property
def filemods(self):
"""Generator that returns :py:class:`CbFileModEvent` objects associated with this process"""
i = 0
for raw_filemod in self._attribute('filemod_complete', []):
yield self._event_parser.parse_filemod(i, raw_filemod)
i += 1

@property
def netconns(self):
"""Generator that returns :py:class:`CbNetConnEvent` objects associated with this process"""
i = 0
for raw_netconn in self._attribute('netconn_complete', []):
yield self._event_parser.parse_netconn(i, raw_netconn)
i += 1

@property
def regmods(self):
"""Generator that returns :py:class:`CbRegModEvent` objects associated with this process"""
i = 0
for raw_regmod in self._attribute('regmod_complete', []):
yield self._event_parser.parse_regmod(i, raw_regmod)
i += 1

@property
def crossprocs(self):
"""Generator that returns :py:class:`CbCrossProcEvent` objects associated with this process"""
i = 0
for raw_crossproc in self._attribute('crossproc_complete', []):
yield self._event_parser.parse_crossproc(i, raw_crossproc)
i += 1

@property
def children(self):
"""Generator that returns :py:class:`CbChildProcEvent` objects associated with this process"""
i = 0
for raw_childproc in self._attribute('childproc_complete', []):
yield self._event_parser.parse_childproc(i, raw_childproc)
i += 1

@property
def all_events(self):
"""Returns a list of all events associated with this process, sorted by timestamp"""
return sorted(list(self.modloads) + list(self.netconns) + list(self.filemods) + \
list(self.children) + list(self.regmods) + list(self.crossprocs))

Expand Down Expand Up @@ -1055,6 +1063,7 @@ def cmdline(self):
def sensor(self):
return self._cb.select(Sensor, int(self._attribute('sensor_id', 0)))

@property
def webui_link(self):
return '%s/#analyze/%s/%s' % (self._cb.url, self.id, self.segment)

Expand All @@ -1072,7 +1081,6 @@ def last_update(self):


def get_constants(prefix):
"""Create a dictionary mapping socket module constants to their names."""
return dict((getattr(socket, n), n)
for n in dir(socket)
if n.startswith(prefix)
Expand Down

0 comments on commit 6a5e492

Please sign in to comment.