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 the main company
entities returns a list of entities
suppliers returns a list of suppliers
competitors returns a list of competitors
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
set_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 The method main_company returns a company identified as the main company.

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

Get the list of entities The method entities returns the list of companies identified as entities.

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

Get the list of suppliers The method suppliers returns the list of companies identified as suppliers.

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

Get the list of competitors The method competitors returns the list of companies identified as competitors.

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

Tag a domain or an AS Number The method set_tags affects a list of tags to a domain name or an AS Number. All assets related with this domain name or with this AS Number will be updated too.

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

Get the list of assets

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

  • asset: the asset name
  • type: type of the asset, may be 'domain', 'host' or 'ip'
  • country: geolocation data for IP assets only
  • entities: list of entities linked with the asset. Entities are the ones included in the subscription.
  • tags: list of tags linked with the asset
  • related: list of assets linked with the asset
  • domains: list of domains linked with the asset
>>> 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.technologies(main_company, assets=cr.assets(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)
[...]

Regression

After version 1.0.15, the method assets returns a list instead of a dictionary

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.17-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file cyrating-1.0.17-py3-none-any.whl.

File metadata

  • Download URL: cyrating-1.0.17-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.17 Linux/5.4.0-150-generic

File hashes

Hashes for cyrating-1.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 64915217beb43b5f329ed0e9a648dfb67d6551a632d0bfcc692d228c5f423960
MD5 4c9ee46365d7bf6de8e71d4dfe19af6d
BLAKE2b-256 3d5458f24f9861996c5bd79a82eb6092bfc7358734e44e82691650a54c30e43c

See more details on using hashes here.

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