forked from p15670423/monkey
island: Remove standard environment
This commit is contained in:
parent
7fe9d752fa
commit
e4d75e25bd
|
@ -77,9 +77,6 @@ class Environment(object, metaclass=ABCMeta):
|
||||||
def testing(self, value):
|
def testing(self, value):
|
||||||
self._testing = value
|
self._testing = value
|
||||||
|
|
||||||
def save_config(self):
|
|
||||||
self._config.save_to_file()
|
|
||||||
|
|
||||||
def get_config(self) -> EnvironmentConfig:
|
def get_config(self) -> EnvironmentConfig:
|
||||||
return self._config
|
return self._config
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import monkey_island.cc.resources.auth.user_store as user_store
|
from monkey_island.cc.environment import EnvironmentConfig, aws, password
|
||||||
from monkey_island.cc.environment import EnvironmentConfig, aws, password, standard
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
AWS = "aws"
|
AWS = "aws"
|
||||||
STANDARD = "standard"
|
|
||||||
PASSWORD = "password"
|
PASSWORD = "password"
|
||||||
|
|
||||||
ENV_DICT = {
|
ENV_DICT = {
|
||||||
STANDARD: standard.StandardEnvironment,
|
|
||||||
AWS: aws.AwsEnvironment,
|
AWS: aws.AwsEnvironment,
|
||||||
PASSWORD: password.PasswordEnvironment,
|
PASSWORD: password.PasswordEnvironment,
|
||||||
}
|
}
|
||||||
|
@ -24,16 +21,6 @@ def set_env(env_type: str, env_config: EnvironmentConfig):
|
||||||
env = ENV_DICT[env_type](env_config)
|
env = ENV_DICT[env_type](env_config)
|
||||||
|
|
||||||
|
|
||||||
def set_to_standard():
|
|
||||||
global env
|
|
||||||
if env:
|
|
||||||
env_config = env.get_config()
|
|
||||||
env_config.server_config = "standard"
|
|
||||||
set_env("standard", env_config)
|
|
||||||
env.save_config()
|
|
||||||
user_store.UserStore.set_users(env.get_auth_users())
|
|
||||||
|
|
||||||
|
|
||||||
def initialize_from_file(file_path):
|
def initialize_from_file(file_path):
|
||||||
try:
|
try:
|
||||||
config = EnvironmentConfig(file_path)
|
config = EnvironmentConfig(file_path)
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
from monkey_island.cc.environment import Environment
|
|
||||||
from monkey_island.cc.resources.auth.auth_user import User
|
|
||||||
|
|
||||||
|
|
||||||
class StandardEnvironment(Environment):
|
|
||||||
_credentials_required = False
|
|
||||||
|
|
||||||
NO_AUTH_USER = "1234567890!@#$%^&*()_nothing_up_my_sleeve_1234567890!@#$%^&*()"
|
|
||||||
NO_AUTH_SECRET = "$2b$12$frH7uEwV3jkDNGgReW6j2udw8hy/Yw1SWAqytrcBYK48kn1V5lQIa"
|
|
||||||
|
|
||||||
def get_auth_users(self):
|
|
||||||
return [User(1, StandardEnvironment.NO_AUTH_USER, StandardEnvironment.NO_AUTH_SECRET)]
|
|
Loading…
Reference in New Issue