forked from p34709852/monkey
Merge pull request #287 from guardicore/feature/change-island-imports
Changed all required imports
This commit is contained in:
commit
10c17b3aae
|
@ -8,26 +8,26 @@ from bson.json_util import dumps
|
|||
from flask import Flask, send_from_directory, make_response, Response
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from cc.auth import init_jwt
|
||||
from cc.database import mongo, database
|
||||
from cc.environment.environment import env
|
||||
from cc.resources.client_run import ClientRun
|
||||
from cc.resources.edge import Edge
|
||||
from cc.resources.local_run import LocalRun
|
||||
from cc.resources.log import Log
|
||||
from cc.resources.island_logs import IslandLog
|
||||
from cc.resources.monkey import Monkey
|
||||
from cc.resources.monkey_configuration import MonkeyConfiguration
|
||||
from cc.resources.island_configuration import IslandConfiguration
|
||||
from cc.resources.monkey_download import MonkeyDownload
|
||||
from cc.resources.netmap import NetMap
|
||||
from cc.resources.node import Node
|
||||
from cc.resources.remote_run import RemoteRun
|
||||
from cc.resources.report import Report
|
||||
from cc.resources.root import Root
|
||||
from cc.resources.telemetry import Telemetry
|
||||
from cc.resources.telemetry_feed import TelemetryFeed
|
||||
from cc.services.config import ConfigService
|
||||
from monkey_island.cc.auth import init_jwt
|
||||
from monkey_island.cc.database import mongo, database
|
||||
from monkey_island.cc.environment.environment import env
|
||||
from monkey_island.cc.resources.client_run import ClientRun
|
||||
from monkey_island.cc.resources.edge import Edge
|
||||
from monkey_island.cc.resources.local_run import LocalRun
|
||||
from monkey_island.cc.resources.log import Log
|
||||
from monkey_island.cc.resources.island_logs import IslandLog
|
||||
from monkey_island.cc.resources.monkey import Monkey
|
||||
from monkey_island.cc.resources.monkey_configuration import MonkeyConfiguration
|
||||
from monkey_island.cc.resources.island_configuration import IslandConfiguration
|
||||
from monkey_island.cc.resources.monkey_download import MonkeyDownload
|
||||
from monkey_island.cc.resources.netmap import NetMap
|
||||
from monkey_island.cc.resources.node import Node
|
||||
from monkey_island.cc.resources.remote_run import RemoteRun
|
||||
from monkey_island.cc.resources.report import Report
|
||||
from monkey_island.cc.resources.root import Root
|
||||
from monkey_island.cc.resources.telemetry import Telemetry
|
||||
from monkey_island.cc.resources.telemetry_feed import TelemetryFeed
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from flask import current_app, abort
|
|||
from flask_jwt import JWT, _jwt_required, JWTError
|
||||
from werkzeug.security import safe_str_cmp
|
||||
|
||||
from cc.environment.environment import env
|
||||
from monkey_island.cc.environment.environment import env
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import cc.auth
|
||||
from cc.environment import Environment
|
||||
import monkey_island.cc.auth
|
||||
from monkey_island.cc.environment import Environment
|
||||
from common.cloud.aws_instance import AwsInstance
|
||||
from Crypto.Hash import SHA3_512
|
||||
|
||||
|
@ -21,5 +21,5 @@ class AwsEnvironment(Environment):
|
|||
|
||||
def get_auth_users(self):
|
||||
return [
|
||||
cc.auth.User(1, 'monkey', self.hash_secret(self._instance_id))
|
||||
monkey_island.cc.auth.User(1, 'monkey', self.hash_secret(self._instance_id))
|
||||
]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import json
|
||||
import logging
|
||||
|
||||
from cc.environment import standard
|
||||
from cc.environment import aws
|
||||
from cc.environment import password
|
||||
from monkey_island.cc.environment import standard
|
||||
from monkey_island.cc.environment import aws
|
||||
from monkey_island.cc.environment import password
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from cc.environment import Environment
|
||||
import cc.auth
|
||||
from monkey_island.cc.environment import Environment
|
||||
import monkey_island.cc.auth
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
@ -8,5 +8,5 @@ class PasswordEnvironment(Environment):
|
|||
|
||||
def get_auth_users(self):
|
||||
return [
|
||||
cc.auth.User(1, self.config['user'], self.config['hash'])
|
||||
monkey_island.cc.auth.User(1, self.config['user'], self.config['hash'])
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import cc.auth
|
||||
from cc.environment import Environment
|
||||
import monkey_island.cc.auth
|
||||
from monkey_island.cc.environment import Environment
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
@ -11,5 +11,5 @@ class StandardEnvironment(Environment):
|
|||
|
||||
def get_auth_users(self):
|
||||
return [
|
||||
cc.auth.User(1, StandardEnvironment.NO_AUTH_CREDS, StandardEnvironment.NO_AUTH_CREDS)
|
||||
monkey_island.cc.auth.User(1, StandardEnvironment.NO_AUTH_CREDS, StandardEnvironment.NO_AUTH_CREDS)
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from cc.environment.environment import load_env_from_file, AWS
|
||||
from cc.report_exporter_manager import ReportExporterManager
|
||||
from cc.resources.aws_exporter import AWSExporter
|
||||
from monkey_island.cc.environment.environment import load_env_from_file, AWS
|
||||
from monkey_island.cc.report_exporter_manager import ReportExporterManager
|
||||
from monkey_island.cc.resources.aws_exporter import AWSExporter
|
||||
|
||||
__author__ = 'maor.rayzin'
|
||||
|
||||
|
|
|
@ -11,17 +11,17 @@ BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
if BASE_PATH not in sys.path:
|
||||
sys.path.insert(0, BASE_PATH)
|
||||
|
||||
from cc.island_logger import json_setup_logging
|
||||
from monkey_island.cc.island_logger import json_setup_logging
|
||||
# This is here in order to catch EVERYTHING, some functions are being called on imports the log init needs to be on top.
|
||||
json_setup_logging(default_path=os.path.join(BASE_PATH, 'cc', 'island_logger_default_config.json'),
|
||||
default_level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from cc.app import init_app
|
||||
from cc.exporter_init import populate_exporter_list
|
||||
from cc.utils import local_ip_addresses
|
||||
from cc.environment.environment import env
|
||||
from cc.database import is_db_server_up
|
||||
from monkey_island.cc.app import init_app
|
||||
from monkey_island.cc.exporter_init import populate_exporter_list
|
||||
from monkey_island.cc.utils import local_ip_addresses
|
||||
from monkey_island.cc.environment.environment import env
|
||||
from monkey_island.cc.database import is_db_server_up
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -4,9 +4,9 @@ from datetime import datetime
|
|||
import boto3
|
||||
from botocore.exceptions import UnknownServiceError
|
||||
|
||||
from cc.resources.exporter import Exporter
|
||||
from cc.services.config import ConfigService
|
||||
from cc.environment.environment import load_server_configuration_from_file
|
||||
from monkey_island.cc.resources.exporter import Exporter
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.environment.environment import load_server_configuration_from_file
|
||||
from common.cloud.aws_instance import AwsInstance
|
||||
|
||||
__author__ = 'maor.rayzin'
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
from flask import request, jsonify
|
||||
import flask_restful
|
||||
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from flask import request
|
||||
import flask_restful
|
||||
|
||||
from cc.services.edge import EdgeService
|
||||
from monkey_island.cc.services.edge import EdgeService
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import json
|
|||
import flask_restful
|
||||
from flask import request, jsonify, abort
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.config import ConfigService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
|
||||
|
||||
class IslandConfiguration(flask_restful.Resource):
|
||||
|
|
|
@ -2,8 +2,8 @@ import logging
|
|||
|
||||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.island_logs import IslandLogService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.island_logs import IslandLogService
|
||||
|
||||
__author__ = "Maor.Rayzin"
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ import sys
|
|||
from flask import request, jsonify, make_response
|
||||
import flask_restful
|
||||
|
||||
from cc.environment.environment import env
|
||||
from cc.resources.monkey_download import get_monkey_executable
|
||||
from cc.services.node import NodeService
|
||||
from cc.utils import local_ip_addresses
|
||||
from monkey_island.cc.environment.environment import env
|
||||
from monkey_island.cc.resources.monkey_download import get_monkey_executable
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.utils import local_ip_addresses
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import flask_restful
|
|||
from bson import ObjectId
|
||||
from flask import request
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.database import mongo
|
||||
from cc.services.log import LogService
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.log import LogService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import dateutil.parser
|
|||
from flask import request
|
||||
import flask_restful
|
||||
|
||||
from cc.database import mongo
|
||||
from cc.services.config import ConfigService
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import json
|
|||
import flask_restful
|
||||
from flask import request, jsonify, abort
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.config import ConfigService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.edge import EdgeService
|
||||
from cc.services.node import NodeService
|
||||
from cc.database import mongo
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.edge import EdgeService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.database import mongo
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from flask import request
|
||||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import json
|
|||
from flask import request, jsonify, make_response
|
||||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.remote_run_aws import RemoteRunAwsService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.remote_run_aws import RemoteRunAwsService
|
||||
from common.cloud.aws_service import AwsService
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import flask_restful
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.services.report import ReportService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.services.report import ReportService
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import logging
|
|||
import flask_restful
|
||||
from flask import request, make_response, jsonify
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.database import mongo
|
||||
from cc.services.config import ConfigService
|
||||
from cc.services.node import NodeService
|
||||
from cc.services.report import ReportService
|
||||
from cc.utils import local_ip_addresses
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.services.report import ReportService
|
||||
from monkey_island.cc.utils import local_ip_addresses
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import dateutil
|
|||
import flask_restful
|
||||
from flask import request
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.database import mongo
|
||||
from cc.services import mimikatz_utils
|
||||
from cc.services.config import ConfigService
|
||||
from cc.services.edge import EdgeService
|
||||
from cc.services.node import NodeService
|
||||
from cc.encryptor import encryptor
|
||||
from cc.services.wmi_handler import WMIHandler
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services import mimikatz_utils
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.edge import EdgeService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.encryptor import encryptor
|
||||
from monkey_island.cc.services.wmi_handler import WMIHandler
|
||||
|
||||
__author__ = 'Barak'
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import flask_restful
|
|||
from flask import request
|
||||
import flask_pymongo
|
||||
|
||||
from cc.auth import jwt_required
|
||||
from cc.database import mongo
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.auth import jwt_required
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = 'itay.mizeretz'
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import logging
|
|||
from jsonschema import Draft4Validator, validators
|
||||
from six import string_types
|
||||
|
||||
from cc.database import mongo
|
||||
from cc.encryptor import encryptor
|
||||
from cc.environment.environment import env
|
||||
from cc.utils import local_ip_addresses
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.encryptor import encryptor
|
||||
from monkey_island.cc.environment.environment import env
|
||||
from monkey_island.cc.utils import local_ip_addresses
|
||||
from config_schema import SCHEMA
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from bson import ObjectId
|
||||
|
||||
from cc.database import mongo
|
||||
import cc.services.node
|
||||
from monkey_island.cc.database import mongo
|
||||
import monkey_island.cc.services.node
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
||||
|
@ -87,7 +87,7 @@ class EdgeService:
|
|||
|
||||
@staticmethod
|
||||
def get_infected_monkey_island_pseudo_edges():
|
||||
monkey = cc.services.node.NodeService.get_monkey_island_monkey()
|
||||
monkey = monkey_island.cc.services.node.NodeService.get_monkey_island_monkey()
|
||||
existing_ids = [x["from"] for x in mongo.db.edge.find({"to": monkey["_id"]})]
|
||||
monkey_ids = [x["_id"] for x in mongo.db.monkey.find({})
|
||||
if ("tunnel" not in x) and (x["_id"] not in existing_ids) and (x["_id"] != monkey["_id"])]
|
||||
|
@ -136,11 +136,11 @@ class EdgeService:
|
|||
{"_id": edge["_id"]},
|
||||
{"$set": {"exploited": True}}
|
||||
)
|
||||
cc.services.node.NodeService.set_node_exploited(edge["to"])
|
||||
monkey_island.cc.services.node.NodeService.set_node_exploited(edge["to"])
|
||||
|
||||
@staticmethod
|
||||
def get_edge_label(edge):
|
||||
NodeService = cc.services.node.NodeService
|
||||
NodeService = monkey_island.cc.services.node.NodeService
|
||||
from_label = NodeService.get_monkey_label(NodeService.get_monkey_by_id(edge["from"]))
|
||||
if edge["to"] == ObjectId("000000000000000000000000"):
|
||||
to_label = 'MonkeyIsland'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from datetime import datetime
|
||||
|
||||
import cc.services.node
|
||||
from cc.database import mongo, database
|
||||
import monkey_island.cc.services.node
|
||||
from monkey_island.cc.database import mongo, database
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
||||
|
@ -15,8 +15,8 @@ class LogService:
|
|||
log = mongo.db.log.find_one({'monkey_id': monkey_id})
|
||||
if log:
|
||||
log_file = database.gridfs.get(log['file_id'])
|
||||
monkey_label = cc.services.node.NodeService.get_monkey_label(
|
||||
cc.services.node.NodeService.get_monkey_by_id(log['monkey_id']))
|
||||
monkey_label = monkey_island.cc.services.node.NodeService.get_monkey_label(
|
||||
monkey_island.cc.services.node.NodeService.get_monkey_by_id(log['monkey_id']))
|
||||
return \
|
||||
{
|
||||
'monkey_label': monkey_label,
|
||||
|
|
|
@ -2,10 +2,10 @@ from datetime import datetime, timedelta
|
|||
|
||||
from bson import ObjectId
|
||||
|
||||
import cc.services.log
|
||||
from cc.database import mongo
|
||||
from cc.services.edge import EdgeService
|
||||
from cc.utils import local_ip_addresses
|
||||
import monkey_island.cc.services.log
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.edge import EdgeService
|
||||
from monkey_island.cc.utils import local_ip_addresses
|
||||
import socket
|
||||
|
||||
__author__ = "itay.mizeretz"
|
||||
|
@ -59,7 +59,7 @@ class NodeService:
|
|||
else:
|
||||
new_node["services"] = []
|
||||
|
||||
new_node['has_log'] = cc.services.log.LogService.log_exists(ObjectId(node_id))
|
||||
new_node['has_log'] = monkey_island.cc.services.log.LogService.log_exists(ObjectId(node_id))
|
||||
return new_node
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from itertools import product
|
||||
|
||||
from cc.database import mongo
|
||||
from monkey_island.cc.database import mongo
|
||||
from bson import ObjectId
|
||||
|
||||
from cc.services.groups_and_users_consts import USERTYPE
|
||||
from cc.services.node import NodeService
|
||||
from monkey_island.cc.services.groups_and_users_consts import USERTYPE
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
|
||||
__author__ = 'maor.rayzin'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from common.cloud.aws_instance import AwsInstance
|
||||
from common.cloud.aws_service import AwsService
|
||||
from common.cmd.aws.aws_cmd_runner import AwsCmdRunner
|
||||
|
|
|
@ -9,12 +9,12 @@ from enum import Enum
|
|||
|
||||
from six import text_type
|
||||
|
||||
from cc.database import mongo
|
||||
from cc.report_exporter_manager import ReportExporterManager
|
||||
from cc.services.config import ConfigService
|
||||
from cc.services.edge import EdgeService
|
||||
from cc.services.node import NodeService
|
||||
from cc.utils import local_ip_addresses, get_subnets
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.report_exporter_manager import ReportExporterManager
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.edge import EdgeService
|
||||
from monkey_island.cc.services.node import NodeService
|
||||
from monkey_island.cc.utils import local_ip_addresses, get_subnets
|
||||
from pth_report import PTHReportService
|
||||
from common.network.network_range import NetworkRange
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from cc.database import mongo
|
||||
from cc.services.groups_and_users_consts import USERTYPE, GROUPTYPE
|
||||
from monkey_island.cc.database import mongo
|
||||
from monkey_island.cc.services.groups_and_users_consts import USERTYPE, GROUPTYPE
|
||||
|
||||
__author__ = 'maor.rayzin'
|
||||
|
||||
|
|
Loading…
Reference in New Issue