diff --git a/monkey/common/utils/IJSONSerializable.py b/monkey/common/utils/IJSONSerializable.py deleted file mode 100644 index 39eefbf90..000000000 --- a/monkey/common/utils/IJSONSerializable.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import annotations - -from abc import ABC, abstractmethod - - -class IJSONSerializable(ABC): - @classmethod - @abstractmethod - def from_json(cls, json_string: str) -> IJSONSerializable: - pass - - @classmethod - @abstractmethod - def to_json(cls, class_object: IJSONSerializable) -> str: - pass diff --git a/monkey/common/utils/__init__.py b/monkey/common/utils/__init__.py index 1b11c54e3..57725fa62 100644 --- a/monkey/common/utils/__init__.py +++ b/monkey/common/utils/__init__.py @@ -1,2 +1 @@ from .timer import Timer -from .IJSONSerializable import IJSONSerializable diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 353b4ca73..a678ddd9b 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -52,7 +52,6 @@ from monkey_island.cc.resources.version import Version from monkey_island.cc.resources.zero_trust.finding_event import ZeroTrustFindingEvent from monkey_island.cc.resources.zero_trust.zero_trust_report import ZeroTrustReport from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH -from monkey_island.cc.server_utils.custom_json_encoder import CustomJSONEncoder from monkey_island.cc.services.representations import output_json HOME_FILE = "index.html" @@ -97,7 +96,6 @@ def init_app_config(app, mongo_url): app.config["JSON_SORT_KEYS"] = False app.url_map.strict_slashes = False - app.json_encoder = CustomJSONEncoder def init_app_services(app): diff --git a/monkey/monkey_island/cc/server_utils/custom_json_encoder.py b/monkey/monkey_island/cc/server_utils/custom_json_encoder.py deleted file mode 100644 index 0cc2036de..000000000 --- a/monkey/monkey_island/cc/server_utils/custom_json_encoder.py +++ /dev/null @@ -1,12 +0,0 @@ -from bson import ObjectId, json_util -from flask.json import JSONEncoder - - -class CustomJSONEncoder(JSONEncoder): - def default(self, obj): - try: - if isinstance(obj, ObjectId): - return json_util.dumps(obj) - except TypeError: - pass - return JSONEncoder.default(self, obj) diff --git a/monkey/monkey_island/cc/services/representations.py b/monkey/monkey_island/cc/services/representations.py index 19218ba37..56fbb2c24 100644 --- a/monkey/monkey_island/cc/services/representations.py +++ b/monkey/monkey_island/cc/services/representations.py @@ -1,14 +1,12 @@ from datetime import datetime from enum import Enum -from json import JSONEncoder, dumps, loads +from json import JSONEncoder, dumps from typing import Any import bson from flask import make_response from pydantic import BaseModel -from common.utils import IJSONSerializable - class APIEncoder(JSONEncoder): def default(self, value: Any) -> Any: @@ -20,8 +18,6 @@ class APIEncoder(JSONEncoder): return str(value) if issubclass(type(value), Enum): return value.name - if issubclass(type(value), IJSONSerializable): - return loads(value.__class__.to_json(value)) if issubclass(type(value), set): return list(value) if issubclass(type(value), BaseModel): diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/InternalConfig.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/InternalConfig.js deleted file mode 100644 index c14b777f1..000000000 --- a/monkey/monkey_island/cc/ui/src/components/configuration-components/InternalConfig.js +++ /dev/null @@ -1,73 +0,0 @@ -import Form from 'react-jsonschema-form-bs4'; -import React, {useState} from 'react'; -import {Nav} from 'react-bootstrap'; - -const sectionOrder = [ - 'network', - 'exploits', - 'classes', - 'general' -]; -const initialSection = sectionOrder[0]; - -export default function InternalConfig(props) { - const { - schema, - uiSchema, - onChange, - customFormats, - className, - formData - } = props; - const [selectedSection, setSelectedSection] = useState(initialSection); - const [displayedSchema, setDisplayedSchema] = useState(getSchemaByKey(schema, initialSection)); - const [displayedSchemaUi, setDisplayedSchemaUi] = useState(uiSchema[initialSection]); - - const onInnerDataChange = (innerData) => { - formData[selectedSection] = innerData.formData; - onChange({formData: formData}); - } - - const setSection = (sectionKey) => { - setSelectedSection(sectionKey); - setDisplayedSchema(getSchemaByKey(schema, sectionKey)); - setDisplayedSchemaUi(uiSchema[sectionKey]); - } - - const renderNav = () => { - return () - } - - return (