Metadata-Version: 2.1
Name: cyrating
Version: 1.0.12
Summary: Python wrapper for https://www.cyrating.com
Home-page: https://www.cyrating.com
License: ISC
Keywords: cyrating
Author: Cyrating
Author-email: tech@cyrating.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Security
Requires-Dist: PyJWT (>=2.1.0,<3.0.0)
Requires-Dist: configparser (>=5.0.2,<6.0.0)
Requires-Dist: requests (>=2.25.1,<3.0.0)
Description-Content-Type: text/markdown

# python-cyrating

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

[![Latest PyPI Release](https://img.shields.io/pypi/v/cyrating.svg)](https://pypi.org/project/cyrating/)
[![License](https://img.shields.io/pypi/l/cyrating.svg)](https://github.com/wq/python-requirejs/blob/master/LICENSE)
[![Python Support](https://img.shields.io/pypi/pyversions/cyrating.svg)](https://pypi.org/project/cyrating/)

## Installation
```sh
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:

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


## Usage example

```python
>>> 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](https://requests.readthedocs.io/en/master/user/advanced/#proxies) for more information

Additional methods listed below are available

Method  | Description
------------- | -------------
main_company | returns main company
entities  | returns list of entities
suppliers | returns list of suppliers
domains | return list of domains for a company
assets | get assets for a company
technologies | get identified technologies for a company
tags | set tags to a specified domain (require admin privileges)
facts | get results of best practices controls
events | get list of active reputation events
certificate | returns certificate of a specific company
members | returns list of members, including child subscriptions' ones (require admin privileges)
rating_history | returns list of last 52 ratings numbers

# Examples

**Returns main company**
```python
>>> cr.main_company()
[...]
```

**Returns list of entities**
```python
>>> cr.entities()
[...]
```

**Returns list of suppliers**
```python
>>> cr.suppliers()
[...]
```

**Returns domains of a company**
```python
>>> cr.domains(main_company)
[...]
```

**Tag a domain or an AS Number**
```python
>>> cr.set_tags('example.com', ['tag1', 'tag2'])
[...]
>>> cr.set_tags('ASXXXXX', ['tag3'])
[...]
```

**Get 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.



```python
>>> cr.assets(main_company)
[...]
```

**Get identified technologies**

The method technologies returns a list of identified technologies for a company. _assets_
parameter is optional and is needed to provide tags association

Each item of the identified technologies includes the following attributes:

- name: name of the identified technology
- category: name of the technology category
- asset: name of the asset supporting the identified 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

```python
>>> main_company = cr.main_company()
>>> cr.facts(main_company, assets=cr.technologies(main_company))
[...]
```

**Get 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: for Unexpected Services controls only, impact on rating of the company. Please note that Cyrating algorithm streamlines this score by IP address and control

```python
>>> 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

```python
>>> main_company = cr.main_company()
>>> cr.events(main_company, assets=cr.assets(main_company))
[...]
```

**Returns certificate of a specific company**
```python
>>> main_company = cr.main_company()
>>> cr.certificate(main_company)
```

**Save certificate of a specific company to a file**
```python
>>> main_company = cr.main_company()
>>> cr.certificate(main_company, filename='Cyrating - Certificate of {}.pdf'.format(main_company['name']))
```

**Get list of members**
```python
>>> cr.members()
[...]
```

**Get list of last 52 ratings**
```python
>>> main_company = cr.main_company()
>>> cr.rating_history(main_company)
[...]
```

## Meta

Cyrating – [@cyrating](https://twitter.com/cyrating) – hello@cyrating.com

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


## Contributing

1. Send issues to issues@cyrating.com

