Skip to main content

Python wrapper for https://www.cyrating.com

Project description

python-cyrating

A python wrapper for Cyrating https://www.cyrating.com.

Latest PyPI Release License Python Support

Installation

pip install cyrating

Then in your application root directory use the following command to set up your configuration including your Cyrating token which is provided in your user interface:

echo -e "[cyrating]\ntoken: cyratingtoken" > cyrating.ini

Usage example

>>> import cyrating
>>> cr = cyrating.init()

The init method takes into account 2 optional parameters:

  • token: the Cyrating token
  • proxies: the list of proxies to use when making a request. See requests docs for more information

Additional methods listed below are available

Method Description
main_company returns the structure of main company
entities returns a list of entities
suppliers returns a list of suppliers
domains returns a list of domains for a company
assets returns a list of assets for a given company
technologies returns a list of identified technologies for a given company
tags sets tags to a given domain (require admin privileges)
facts returns the results of best practices controls
events returns a list of active reputation events
certificate returns a certificate of a given company
members returns a list of members, including child subscriptions' ones (require admin privileges)
rating_history returns a list of the last 52 ratings numbers for a given company
scope returns a list of the last 52 scopes (domain names) taking into account for rating of a given company
scope_updates returns a list of the last scope updates including added and removed domains

Examples

Get info of the main company

>>> cr.main_company()
[...]

Get a list of entities

>>> cr.entities()
[...]

Get a list of suppliers

>>> cr.suppliers()
[...]

Get a list of domains for a given company

>>> cr.domains(main_company)
[...]

Tag a domain or an AS Number

>>> cr.set_tags('example.com', ['tag1', 'tag2'])
[...]
>>> cr.set_tags('ASXXXXX', ['tag3'])
[...]

Get the list of assets

The method assets returns a dictionary of assets with tags and type attributes. Each key of this dictionary represents an asset and is linked to the following attributes:

  • type: type of the asset, may be 'domain', 'host' or 'ip'
  • tags: list of tags linked with the asset
  • domains: list of domains / AS numbers linked with the asset
  • entities: list of entities linked with the asset. Entities are the ones included in the subscription.
>>> cr.assets(main_company)
[...]

Get the list of detected technologies

The method technologies returns a list of detected technologies for a given company. assets parameter is optional and is needed to provide tags association

Each item of the detected technologies includes the following attributes:

  • name: name of the detected technology
  • category: name of the technology category
  • asset: name of the asset supporting the detected technology
  • domain: domain name / AS Number linked with the asset
  • entities: list of entities linked with the asset. Entities are the ones included in the subscription.
  • tags: list of tags linked with the asset
>>> main_company = cr.main_company()
>>> cr.facts(main_company, assets=cr.technologies(main_company))
[...]

Get the results of best practices controls

The method facts returns the results of best practices controls. assets parameter is optional and is needed to provide tags association. extra_filter is also an optional to filter results server-side.

Each item of the results includes the following attributes:

  • domain: domain name / AS Number linked with the asset
  • category: name of the best practice's category
  • entities: list of entities linked with the asset. Entities are the ones included in the subscription.
  • tags: list of tags linked with the asset
  • type: type of the asset, may be 'domain', 'host' or 'ip'
  • name: name of the resource
  • results: raw results of the control
  • grade: unitary score of the control
  • impact: impact on rating of controls which lead to a downgrade.
>>> main_company = cr.main_company()
>>> cr.facts(main_company, assets=cr.assets(main_company))
[...]

Get the list of active reputation events

The method events returns a list of active reputation events. assets parameter is optional and is needed to provide tags association.

An active reputation event includes the following attributes:

  • name: name of the asset concerned
  • category: name of the reputation's category
  • domains: list of domains / AS Numbers linked with the asset
  • entities: list of entities linked with the asset. Entities are the ones included in the subscription.
  • tags: list of tags linked with the asset
  • type: type of the asset, may be 'domain', 'host' or 'ip'
  • source: a dictionary with the tag and the url of the reputation source
  • occurrences: dates of occurrences of the event
  • score: deprecated, replaced by impact
  • impact: impact on rating of the company. Please note that Cyrating algorithm streamlines this score by resource and reputation's category
>>> main_company = cr.main_company()
>>> cr.events(main_company, assets=cr.assets(main_company))
[...]

Returns certificate of a given company

>>> main_company = cr.main_company()
>>> cr.certificate(main_company)

Save the certificate of a given company to a file

>>> main_company = cr.main_company()
>>> cr.certificate(main_company, filename='Cyrating - Certificate of {}.pdf'.format(main_company['name']))

Get the list of members

>>> cr.members()
[...]

Get a list of the last 52 ratings for a given company

>>> main_company = cr.main_company()
>>> cr.rating_history(main_company)
[...]

Get a list of the last 52 scopes for a given company

The method scope returns a list of the last 52 scopes for a given company. A scope is a list of domain names taking into account for rating of a given company

A scope includes the following attribute:

  • domainnames: list of domains names supporting our rating
>>> main_company = cr.main_company()
>>> cr.scope(main_company)
[...]

Get a list of scope updates

An additional method is available to get scope updates for a given company including added domains and removed domains between several ratings.

A scope includes the following attributes:

  • added: domains added to a rating scope
  • removed: domains removed from a rating scope
  • date: date of rating
>>> main_company = cr.main_company()
>>> scope = cr.scope(main_company)
>>> updates = cr.scope_updates(scope)
[...]

Meta

Cyrating – @cyratinghello@cyrating.com

Distributed under the ISCL licence. See LICENSE for more information.

Contributing

  1. Send issues to issues@cyrating.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cyrating-1.0.15-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page