forked from p15670423/monkey
Common: Remove CloudInstance since aws is the only cloud supported
This change simplifies the codebase by removing unnecessary inheritance and nested directory structure
This commit is contained in:
parent
c5a126ff13
commit
7b2ff1e159
|
@ -6,7 +6,6 @@ from typing import Optional, Tuple
|
|||
|
||||
import requests
|
||||
|
||||
from common.cloud.instance import CloudInstance
|
||||
from common.utils.code_utils import Singleton
|
||||
|
||||
AWS_INSTANCE_METADATA_LOCAL_IP_ADDRESS = "169.254.169.254"
|
||||
|
@ -25,7 +24,7 @@ class AwsInstanceInfo:
|
|||
account_id: Optional[str] = None
|
||||
|
||||
|
||||
class AwsInstance(CloudInstance):
|
||||
class AwsInstance:
|
||||
"""
|
||||
Class which gives useful information about the current instance you're on.
|
||||
"""
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import boto3
|
||||
import botocore
|
||||
|
||||
from common.cloud.aws.aws_instance import AwsInstance
|
||||
from common.aws.aws_instance import AwsInstance
|
||||
|
||||
INSTANCE_INFORMATION_LIST_KEY = "InstanceInformationList"
|
||||
INSTANCE_ID_KEY = "InstanceId"
|
|
@ -1,9 +0,0 @@
|
|||
class CloudInstance(object):
|
||||
"""
|
||||
This is an abstract class which represents a cloud instance.
|
||||
|
||||
The current machine can be a cloud instance (for example EC2 instance or Azure VM).
|
||||
"""
|
||||
|
||||
def is_instance(self) -> bool:
|
||||
raise NotImplementedError()
|
|
@ -1,7 +1,7 @@
|
|||
import logging
|
||||
import time
|
||||
|
||||
from common.cloud.aws.aws_service import AwsService
|
||||
from common.aws.aws_service import AwsService
|
||||
from common.cmd.aws.aws_cmd_result import AwsCmdResult
|
||||
from common.cmd.cmd_runner import CmdRunner
|
||||
from common.cmd.cmd_status import CmdStatus
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
from common.cloud.aws.aws_instance import AwsInstance
|
||||
from common.aws.aws_instance import AwsInstance
|
||||
from infection_monkey.telemetry.aws_instance_telem import AWSInstanceTelemetry
|
||||
from infection_monkey.telemetry.messengers.legacy_telemetry_messenger_adapter import (
|
||||
LegacyTelemetryMessengerAdapter,
|
||||
|
|
|
@ -4,7 +4,7 @@ import flask_restful
|
|||
from botocore.exceptions import ClientError, NoCredentialsError
|
||||
from flask import jsonify, make_response, request
|
||||
|
||||
from common.cloud.aws.aws_service import AwsService
|
||||
from common.aws.aws_service import AwsService
|
||||
from monkey_island.cc.resources.auth.auth import jwt_required
|
||||
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
from threading import Event
|
||||
|
||||
from common.cloud.aws.aws_instance import AwsInstance
|
||||
from common.cloud.aws.aws_service import AwsService
|
||||
from common.aws.aws_instance import AwsInstance
|
||||
from common.aws.aws_service import AwsService
|
||||
from common.cmd.aws.aws_cmd_runner import AwsCmdRunner
|
||||
from common.cmd.cmd import Cmd
|
||||
from common.cmd.cmd_runner import CmdRunner
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||
import boto3
|
||||
from botocore.exceptions import UnknownServiceError
|
||||
|
||||
from common.cloud.aws.aws_instance import AwsInstance
|
||||
from common.aws.aws_instance import AwsInstance
|
||||
from monkey_island.cc.services.reporting.exporter import Exporter
|
||||
|
||||
__authors__ = ["maor.rayzin", "shay.nehmad"]
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
|||
import requests
|
||||
import requests_mock
|
||||
|
||||
from common.cloud.aws.aws_instance import AWS_LATEST_METADATA_URI_PREFIX, AwsInstance
|
||||
from common.aws.aws_instance import AWS_LATEST_METADATA_URI_PREFIX, AwsInstance
|
||||
|
||||
INSTANCE_ID_RESPONSE = "i-1234567890abcdef0"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
from unittest import TestCase
|
||||
|
||||
from common.cloud.aws.aws_service import filter_instance_data_from_aws_response
|
||||
from common.aws.aws_service import filter_instance_data_from_aws_response
|
||||
|
||||
|
||||
class TestAwsService(TestCase):
|
||||
|
|
Loading…
Reference in New Issue