Skip to content

Commit

Permalink
Repro #23
Browse files Browse the repository at this point in the history
  • Loading branch information
William Blum committed Jun 24, 2021
1 parent 56fdb67 commit e287436
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions bug23_repro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# %%
from cyberbattle.simulation.environment_generation import create_random_environment
import cyberbattle.simulation.commandcontrol as commandcontrol

# %%
print(commandcontrol.__file__)


# %%
env = create_random_environment('test', 10)
# %%
env
# %%
c2 = commandcontrol.CommandControl(env)
# %%
c2.print_all_attacks()

# %%

c2.list_local_attacks('0')
# %%

# # %%
# !pip freeze

# # %%
# !python - -version
# # %%

# %%
2 changes: 2 additions & 0 deletions cyberbattle/simulation/environment_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ def create_random_environment(name: str, size: int) -> model.Environment:
rand_os: str = os_types[random.randint(0, 1)]
nodes[str(i)] = create_random_node(rand_os, potential_ports)

nodes['0'].agent_installed = True

graph.add_nodes_from([(k, {'data': v}) for (k, v) in list(nodes.items())])

return model.Environment(network=graph, vulnerability_library=local_vuln_lib, identifiers=ENV_IDENTIFIERS)
Expand Down

0 comments on commit e287436

Please sign in to comment.