# ---1# jupyter:2# jupytext:3# formats: py:percent,ipynb4# text_representation:5# extension: .py6# format_name: percent7# format_version: '1.3'8# jupytext_version: 1.16.49# kernelspec:10# display_name: Python 3 (ipykernel)11# language: python12# name: python313# ---1415# %% [markdown]16# pyright: reportUnusedExpression=false1718# %% [markdown]19# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.20#21# # Capture the Flag Toy Example - Interactive (Human player)2223# %% [markdown]24# This is a blank instantiaion of the Capture The Flag network to be played interactively by a human player (not via the gym envrionment).25# The interface exposed to the attacker is given by the following commands:26# - c2.print_all_attacks()27# - c2.run_attack(node, attack_id)28# - c2.run_remote_attack(source_node, target_node, attack_id)29# - c2.connect_and_infect(source_node, target_node, port_name, credential_id)3031# %%32import sys, logging33import cyberbattle.simulation.model as model34import cyberbattle.simulation.commandcontrol as commandcontrol35import cyberbattle.samples.toyctf.toy_ctf as ctf36import plotly.offline as plo3738plo.init_notebook_mode(connected=True) # type: ignore39logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(levelname)s: %(message)s")40# %matplotlib inline4142# %%43network = model.create_network(ctf.nodes)44env = model.Environment(network=network, vulnerability_library=dict([]), identifiers=ctf.ENV_IDENTIFIERS)45env4647# %%48env.plot_environment_graph()4950# %%51c2 = commandcontrol.CommandControl(env)52dbg = commandcontrol.EnvironmentDebugging(c2)535455def plot():56dbg.plot_discovered_network()57c2.print_all_attacks()585960plot()616263