mal-lang / mal-simulator

Apache License 2.0
2 stars 1 forks source link

Scenario in gym wrapper #50

Closed mrkickling closed 2 months ago

mrkickling commented 2 months ago

Make use of scenario in GymWrappers, replaces the LazyWrapper.

kasanari commented 2 months ago

Looks good.

kasanari commented 2 months ago
malsim.register_envs()
scenario_file = "/storage/GitHub/malsim-scenarios/scenarios/trainingLang/scenario-phishing-one-host/scenario.yml"
env = gym.make("MALDefenderEnv-v0",
    scenario_file=scenario_file,
)

attack_graph, _ = load_scenario(scenario_file)

Found a potential bug. When I load the scenario with the wrapper, the attack graph has six nodes, but then I load the same scenario with the load_scenario function it has seven.

andrewbwm commented 2 months ago
malsim.register_envs()
scenario_file = "/storage/GitHub/malsim-scenarios/scenarios/trainingLang/scenario-phishing-one-host/scenario.yml"
env = gym.make("MALDefenderEnv-v0",
    scenario_file=scenario_file,
)

attack_graph, _ = load_scenario(scenario_file)

Found a potential bug. When I load the scenario with the wrapper, the attack graph has six nodes, but then I load the same scenario with the load_scenario function it has seven.

That is because the MalSimulator initialization prunes the unnecessary and unviable nodes right now. The load_scenario method does not create the simulator just yet, which is why they are of different sizes.

mrkickling commented 2 months ago

Feels like a design decision, should the graph be pruned by default or not? See #40

andrewbwm commented 2 months ago

Feels like a design decision, should the graph be pruned by default or not? See #40

I think it should be enabled by default because most people don't like seeing untraversable nodes and they might not dig enough to figure out that pruning is even an option.