Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit 20e55af

Browse files
Merge pull request #1 from InfosecSapper/1.0-dev
1.0 dev
2 parents 0c8b561 + 8d439b5 commit 20e55af

22 files changed

Lines changed: 555 additions & 144 deletions

BitSightAPI/BitSightAPI.py

Lines changed: 0 additions & 140 deletions
This file was deleted.

BitSightAPI/__init__.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
1-
# __init__.py
2-
from . import BitSightAPI
1+
#!/usr/bin/env python3
2+
# *_* coding: utf-8 *_*
3+
4+
"""
5+
This module is a Python wrapper for the BitSight API.
6+
7+
Only GET requests are supported in the initial release, but post requests
8+
will be added in a future release.
9+
"""
10+
11+
__version__ = "1.0"
12+
__author__ = "InfosecSapper"
13+
14+
# -----------------------------------------------------------------------------
15+
16+
from bitsightapi import alerts
17+
from bitsightapi import companies
18+
from bitsightapi import company_relationships
19+
from bitsightapi import company_requests
20+
from bitsightapi import customers
21+
from bitsightapi import findings
22+
from bitsightapi import folders
23+
from bitsightapi import industries
24+
from bitsightapi import insights
25+
from bitsightapi import news
26+
from bitsightapi import portfolio
27+
from bitsightapi import products
28+
from bitsightapi import rapid_underwriting_assessments
29+
from bitsightapi import reports
30+
from bitsightapi import subscriptions
31+
from bitsightapi import users

BitSightAPI/alerts.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from bitsightapi.client import Session
2+
3+
class Alerts(Session):
4+
"""
5+
This class handles the Alerts API endpoint
6+
"""
7+
def __init__(self, session):
8+
self.api_key = session.api_key
9+
self.api_endpoint = '/v2/alerts'
10+
self.api_variables = {}
11+
self.api_paths = {
12+
'root': '/',
13+
'recent alerts': '/latest'
14+
}
15+
self.api_params = [
16+
'alert_date',
17+
'alert_date_gt',
18+
'alert_date_gte',
19+
'alert_date_lt',
20+
'alert_date_lte',
21+
'alert_type',
22+
'company_guid',
23+
'expand',
24+
'folder_guid',
25+
'limit',
26+
'offset',
27+
'q',
28+
'severity',
29+
'sort'
30+
]
31+
self.alert_types = [
32+
'INFORMATIONAL',
33+
'NIST_CATEGORY',
34+
'PERCENT_CHANGE',
35+
'RATING_THRESHOLD',
36+
'RISK_CATEGORY',
37+
'VULNERABILITY'
38+
]
39+
self.severity_levels = [
40+
'INFORMATIONAL',
41+
'INCREASE',
42+
'WARN',
43+
'CRITICAL'
44+
]

BitSightAPI/companies.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class Companies(Session):
5+
"""
6+
Companies class
7+
"""
8+
9+
def __init__(self, session, company_guid='', domain=''):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/companies'
12+
self.api_variables = {
13+
'company_guid': company_guid,
14+
'domain': domain
15+
}
16+
self.api_paths = {
17+
'root': '/',
18+
'company details': '/%(company_guid)s/',
19+
'asset risk matrix': '/%(company_guid)s/assets/statistics',
20+
'company tree': '/%(company_guid)s/company-tree',
21+
'ip by country': '/%(company_guid)s/countries',
22+
'products by domain': '/%(company_guid)s/domains/%(domain)s/products',
23+
'providers by domain': '/%(company_guid)s/domains/%(domain)s/providers',
24+
'findings': '/%(company_guid)s/findings',
25+
'industry statistics': '/%(company_guid)s/industries/statistics',
26+
'detailed': '/%(company_guid)s/observations',
27+
'products': '/%(company_guid)s/products',
28+
'service providers': '/%(company_guid)s/providers',
29+
'nist report': '/%(company_guid)s/regulatory/nist',
30+
'compare peers': '/%(company_guid)s/reports/company-preview',
31+
'infrastructure': '/%(company_guid)s/reports/infrastructure',
32+
'statistics': '/%(company_guid)s/observations/statistics',
33+
'distribution': '/distribution',
34+
'ratings by date': '/'
35+
}
36+
self.api_params = [
37+
'fields',
38+
'limit',
39+
'offset',
40+
'q',
41+
'sort'
42+
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class CompanyRelationships(Session):
5+
"""
6+
Company Relationships class
7+
"""
8+
9+
def __init__(self, session):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/company-relationships'
12+
self.api_variables = {}
13+
self.api_paths = {
14+
'root': '/'
15+
}
16+
self.api_params = [
17+
'company_guid',
18+
'relationship_type'
19+
]

BitSightAPI/company_requests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class CompanyRequests(Session):
5+
"""
6+
Company Requests class
7+
"""
8+
9+
def __init__(self, session, data_object='', request_guid=''):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/company-requests'
12+
self.api_variables = {
13+
'data_object': data_object,
14+
'request_guid': request_guid
15+
}
16+
self.api_paths = {
17+
'root': '/',
18+
'request status': '/%(request_guid)s'
19+
}
20+
self.api_params = []

BitSightAPI/customers.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class Customers(Session):
5+
"""
6+
Customers class
7+
"""
8+
9+
def __init__(self, session, api_guid=''):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/customers/current/api-tokens'
12+
self.api_variables = {
13+
'api_guid': api_guid
14+
}
15+
self.api_paths = {
16+
'root': '/'
17+
}
18+
self.api_params = [
19+
'data',
20+
'description',
21+
'format',
22+
'group'
23+
]

BitSightAPI/folders.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class Folders(Session):
5+
"""
6+
Folders class
7+
"""
8+
9+
def __init__(self, session, folder_guid='', provider_guid=''):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/folders'
12+
self.api_variables = {
13+
'folderguid': folder_guid,
14+
'providerguid': provider_guid
15+
}
16+
self.api_paths = {
17+
'root': '/',
18+
'folder': '/%(folder_guid)s',
19+
'companies': '/%(folder_guid)s/companies',
20+
'products': '/%(folder_guid)s/products',
21+
'product types': '/%(folder_guid)s/product-types',
22+
'providers': '/%(folder_guid)s/providers',
23+
'dependent companies': '/%(folder_guid)s/providers/%(provider_guid)s/companies',
24+
'provider products': '/%(folder_guid)s/providers/%(provider_guid)s/products'
25+
}
26+
self.api_params = []

BitSightAPI/industries.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class Industries(Session):
5+
"""
6+
Industries class
7+
"""
8+
9+
def __init__(self, session, industry_slug=''):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/industries'
12+
self.api_variables = {
13+
'industry_slug': industry_slug
14+
}
15+
self.api_paths = {
16+
'root': '/',
17+
'industry history': '/%(industry_slug)s'
18+
}
19+
self.api_params = []

BitSightAPI/insights.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from bitsightapi.client import Session
2+
3+
4+
class Insights(Session):
5+
"""
6+
Insights class
7+
"""
8+
9+
def __init__(self, session):
10+
self.api_key = session.api_key
11+
self.api_endpoint = '/v1/insights'
12+
self.api_variables = {}
13+
self.api_paths = {
14+
'root': '/'
15+
}
16+
self.api_params = [
17+
'company',
18+
'start',
19+
'end',
20+
'format',
21+
'score_delta_lt'
22+
]

0 commit comments

Comments
 (0)