Beispiel #1
0
 def deactivate_client(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'DELETE'
     guid = cls._error_if_not_param('guid', **kwargs)
     endpoint = cls._optional_team_endpoint(f'/clients/{guid}', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #2
0
 def create_attack_schedule(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'POST'
     data = cls._error_if_not_json_body(**kwargs)
     endpoint = cls._optional_team_endpoint(f'/schedules/attacks', **kwargs)
     payload = cls._payload(**{'headers': https_client.header(), 'body': data})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #3
0
 def get_attack_schedule(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'GET'
     guid = cls._error_if_not_param('guid', **kwargs)
     endpoint = cls._optional_team_endpoint(f'/schedules/attacks/{guid}', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #4
0
 def report_security_denied_access_auth_enpoinds_by_team(cls, https_client=get_gremlin_httpclient(),
                                                         *args, **kwargs):
     method = 'GET'
     endpoint = cls._team_report_endpoint('/reports/security/deniedAccessAuthEndpointsByTeam', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
 def get_company(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'GET'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     endpoint = f'/companies/{identifier}'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #6
0
 def list_users(cls, https_client=get_gremlin_httpclient(), *args,
                **kwargs):
     method = 'GET'
     endpoint = cls._optional_team_endpoint(f'/users', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #7
0
 def disable_scenario_schedule(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'DELETE'
     guid = cls._error_if_not_param('guid', **kwargs)
     endpoint = cls._optional_team_endpoint(f'/schedules/scenarios/{guid}/enabled', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #8
0
 def renew_user_authorization_rbac(cls,
                                   https_client=get_gremlin_httpclient(),
                                   *args,
                                   **kwargs):
     method = 'GET'
     email = cls._error_if_not_email(**kwargs)
     company_id = kwargs.get('companyId', None)
     team_id = cls._error_if_not_param('teamnId', **kwargs)
     renew_token = kwargs.get('renewToken', None)
     if not company_id:
         error_msg = f'orgId required parameter not supplied: {kwargs}'
         log.fatal(error_msg)
         raise GremlinParameterError(error_msg)
     if not renew_token:
         error_msg = f'renewToken required parameter not supplied: {kwargs}'
         log.fatal(error_msg)
         raise GremlinParameterError(error_msg)
     data = {
         'email': email,
         'companyId': company_id,
         'teamId': team_id,
         'renewToken': renew_token
     }
     endpoint = f'/users/renew/rbac'
     payload = cls._payload(**{
         'headers': https_client.header(),
         'data': data
     })
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #9
0
 def update_contract(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'PATCH'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     data = cls._error_if_not_json_body(**kwargs)
     endpoint = f'/companies/{identifier}/contracts/current'
     payload = cls._payload(**{'headers': https_client.header(), 'body': data})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #10
0
 def delete_company_invite(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'DELETE'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     email = cls._error_if_not_email(**kwargs)
     endpoint = f'/companies/{identifier}/invites/{email}'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #11
0
 def activate_company_user(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'POST'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     email = cls._error_if_not_email(**kwargs)
     endpoint = f'​/companies​/{identifier}​/users​/{email}​/active'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #12
0
 def samllogin(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     params = ['companyName', 'destination', 'acsHandler']
     method = 'GET'
     endpoint = cls._build_query_string_endpoint('/users/auth/saml/login',
                                                 params, **kwargs)
     payload = cls._payload(**{})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #13
0
 def update_scenario_schedule(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'POST'
     guid = cls._error_if_not_param('guid', **kwargs)
     data = cls._error_if_not_json_body(**kwargs)
     endpoint = cls._optional_team_endpoint(f'/schedules/scenarios/{guid}', **kwargs)
     payload = cls._payload(**{'headers': https_client.header(), 'body': data})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #14
0
 def get_saml_metadata(cls,
                       https_client=get_gremlin_httpclient(),
                       *args,
                       **kwargs):
     method = 'GET'
     endpoint = '/users/auth/saml/metadata'
     (resp, body) = https_client.api_call(method, endpoint)
     return body
Beispiel #15
0
 def report_security_denied_user_access(
         cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'GET'
     endpoint = cls._user_report_endpoint(
         '/reports/security/deniedUserAccess', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #16
0
 def report_users(cls,
                  https_client=get_gremlin_httpclient(),
                  *args,
                  **kwargs):
     method = 'GET'
     endpoint = cls._report_endpoint('/reports/users', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #17
0
 def update_company_user_role(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'PUT'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     email = cls._error_if_not_email(**kwargs)
     data = cls._warn_if_not_json_body(**kwargs)
     endpoint = f'​/companies​/{identifier}​/users​/{email}'
     payload = cls._payload(**{'headers': https_client.header(), 'body': data})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #18
0
 def get_user_mfa_status(cls,
                         https_client=get_gremlin_httpclient(),
                         *args,
                         **kwargs):
     method = 'GET'
     endpoint = '/users/auth/mfa/info'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #19
0
 def get_mfa_status(cls,
                    https_client=get_gremlin_httpclient(),
                    *args,
                    **kwargs):
     method = 'GET'
     email = cls._error_if_not_email(**kwargs)
     endpoint = f'/users/auth/mfa/{email}/enabled'
     (resp, body) = https_client.api_call(method, endpoint)
     return body
Beispiel #20
0
 def update_company_prefs(cls, https_client=get_gremlin_httpclient(), **kwargs):
     method = 'POST'
     identifier = cls._error_if_not_param('identifier', **kwargs)
     data = {'domain': cls._warn_if_not_param('domain', **kwargs)}
     data = {k: v for k, v in data.items() if v is not None}
     endpoint = f'/companies/{identifier}/prefs'
     payload = cls._payload(**{'headers': https_client.header(), 'data': data})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #21
0
 def list_aws_services(cls,
                       https_client=get_gremlin_httpclient(),
                       *args,
                       **kwargs):
     method = 'GET'
     endpoint = '/providers/aws'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #22
0
 def get_user_self(cls,
                   https_client=get_gremlin_httpclient(),
                   *args,
                   **kwargs):
     method = 'GET'
     endpoint = f'/users/self'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #23
0
 def invalidate_session(cls,
                        https_client=get_gremlin_httpclient(),
                        *args,
                        **kwargs):
     method = 'DELETE'
     endpoint = '/users/auth'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #24
0
 def list_active_attacks(cls,
                         https_client=get_gremlin_httpclient(),
                         *args,
                         **kwargs):
     method = 'GET'
     endpoint = cls._list_endpoint('/attacks/active', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #25
0
 def halt_all_alfi_experiments(cls,
                               https_client=get_gremlin_httpclient(),
                               *args,
                               **kwargs):
     method = 'DELETE'
     endpoint = cls._optional_team_endpoint('/experiments', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #26
0
 def sessions(cls, https_client=get_gremlin_httpclient(), *args, **kwargs):
     method = 'POST'
     endpoint = '/users/auth/saml/sessions'
     data = {'code': cls._error_if_not_param('code', **kwargs)}
     payload = cls._payload(**{
         'headers': https_client.header(),
         'body': data
     })
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #27
0
 def delete_old_certificate(cls,
                            https_client=get_gremlin_httpclient(),
                            *args,
                            **kwargs):
     method = 'DELETE'
     endpoint = cls._optional_team_endpoint('/orgs/auth/certificate/old',
                                            **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #28
0
 def deactivate_user(cls,
                     https_client=get_gremlin_httpclient(),
                     *args,
                     **kwargs):
     method = 'DELETE'
     email = cls._error_if_not_email(**kwargs)
     endpoint = cls._optional_team_endpoint(f'/users/{email}', **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #29
0
 def halt_all_kubernetes_attacks(cls,
                                 https_client=get_gremlin_httpclient(),
                                 *args,
                                 **kwargs):
     method = 'POST'
     endpoint = cls._optional_team_endpoint('/kubernetes/attacks/halt',
                                            **kwargs)
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body
Beispiel #30
0
 def get_company_affiliations(cls,
                              https_client=get_gremlin_httpclient(),
                              *args,
                              **kwargs):
     method = 'GET'
     email = cls._error_if_not_email(**kwargs)
     endpoint = f'/users/auth/emailCompanies/?email={email}'
     payload = cls._payload(**{'headers': https_client.header()})
     (resp, body) = https_client.api_call(method, endpoint, **payload)
     return body