Git Product home page Git Product logo

cyberbattlesim's Introduction

CyberBattleSim

April 8th, 2021: See the announcement on the Microsoft Security Blog.

CyberBattleSim is an experimentation research platform to investigate the interaction of automated agents operating in a simulated abstract enterprise network environment. The simulation provides a high-level abstraction of computer networks and cyber security concepts. Its Python-based Open AI Gym interface allows for the training of automated agents using reinforcement learning algorithms.

The simulation environment is parameterized by a fixed network topology and a set of vulnerabilities that agents can utilize to move laterally in the network. The goal of the attacker is to take ownership of a portion of the network by exploiting vulnerabilities that are planted in the computer nodes. While the attacker attempts to spread throughout the network, a defender agent watches the network activity and tries to detect any attack taking place and mitigate the impact on the system by evicting the attacker. We provide a basic stochastic defender that detects and mitigates ongoing attacks based on pre-defined probabilities of success. We implement mitigation by re-imaging the infected nodes, a process abstractly modeled as an operation spanning over multiple simulation steps.

To compare the performance of the agents we look at two metrics: the number of simulation steps taken to attain their goal and the cumulative rewards over simulation steps across training epochs.

Project goals

We view this project as an experimentation platform to conduct research on the interaction of automated agents in abstract simulated network environments. By open-sourcing it, we hope to encourage the research community to investigate how cyber-agents interact and evolve in such network environments.

The simulation we provide is admittedly simplistic, but this has advantages. Its highly abstract nature prohibits direct application to real-world systems thus providing a safeguard against potential nefarious use of automated agents trained with it. At the same time, its simplicity allows us to focus on specific security aspects we aim to study and quickly experiment with recent machine learning and AI algorithms.

For instance, the current implementation focuses on the lateral movement cyber-attacks techniques, with the hope of understanding how network topology and configuration affects them. With this goal in mind, we felt that modeling actual network traffic was not necessary. This is just one example of a significant limitation in our system that future contributions might want to address.

On the algorithmic side, we provide some basic agents as starting points, but we would be curious to find out how state-of-the-art reinforcement learning algorithms compare to them. We found that the large action space intrinsic to any computer system is a particular challenge for Reinforcement Learning, in contrast to other applications such as video games or robot control. Training agents that can store and retrieve credentials is another challenge faced when applying RL techniques where agents typically do not feature internal memory. These are other areas of research where the simulation could be used for benchmarking purposes.

Other areas of interest include the responsible and ethical use of autonomous cyber-security systems: How to design an enterprise network that gives an intrinsic advantage to defender agents? How to conduct safe research aimed at defending enterprises against autonomous cyber-attacks while preventing nefarious use of such technology?

Documentation

Read the Quick introduction to the project.

Build status

Type Branch Status
CI master .github/workflows/ci.yml
Docker image master .github/workflows/build-container.yml

Benchmark

See Benchmark.

Setting up a dev environment

It is strongly recommended to work under a Linux environment, either directly or via WSL on Windows. Running Python on Windows directly should work but is not supported anymore.

Start by checking out the repository:

git clone https://github.com/microsoft/CyberBattleSim.git

OS components

If you get the following error when running the papermill on the notebooks (or alternatively when running orca --help)

/home/wiblum/miniconda3/envs/cybersim/lib/orca_app/orca: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

or other share libraries like libgdk_pixbuf-2.0.so.0, Then run the following command:

sudo apt install libnss3-dev libgtk-3-0 libxss1 libasound2-dev libgtk2.0-0 libgconf-2-4

On Linux or WSL

The instructions were tested on a Linux Ubuntu distribution (both native and via WSL).

If conda is not installed already, you need to install it by running the install_conda.sh script.

bash install-conda.sh

Once this is done, open a new terminal and run the initialization script:

bash init.sh

This will create a conda environmen named cybersim with all the required OS and python dependencies.

To activate the environment run:

conda activate cybersim

Windows Subsystem for Linux

The supported dev environment on Windows is via WSL. You first need to install an Ubuntu WSL distribution on your Windows machine, and then proceed with the Linux instructions (next section).

Git authentication from WSL

To authenticate with Git, you can either use SSH-based authentication or alternatively use the credential-helper trick to automatically generate a PAT token. The latter can be done by running the following command under WSL (more info here):

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"

Docker on WSL

To run your environment within a docker container, we recommend running docker via Windows Subsystem on Linux (WSL) using the following instructions: Installing Docker on Windows under WSL).

Windows (unsupported)

This method is not maintained anymore, please prefer instead running under a WSL subsystem Linux environment. But if you insist you want to start by installing Python 3.9 then in a Powershell prompt run the ./init.ps1 script.

Getting started quickly using Docker

The quickest method to get up and running is via the Docker container.

NOTE: For licensing reasons, we do not publicly redistribute any build artifact. In particular, the docker registry spinshot.azurecr.io referred to in the commands below is kept private to the project maintainers only.

As a workaround, you can recreate the docker image yourself using the provided Dockerfile, publish the resulting image to your own docker registry and replace the registry name in the commands below.

Running from Docker registry

commit=7c1f8c80bc53353937e3c69b0f5f799ebb2b03ee
docker login spinshot.azurecr.io
docker pull spinshot.azurecr.io/cyberbattle:$commit
docker run -it spinshot.azurecr.io/cyberbattle:$commit python -m cyberbattle.agents.baseline.run

Recreating the Docker image

docker build -t cyberbattle:1.1 .
docker run -it -v "$(pwd)":/source --rm cyberbattle:1.1 python -m cyberbattle.agents.baseline.run

Check your environment

Run the following commands to run a simulation with a baseline RL agent:

python -m cyberbattle.agents.baseline.run --training_episode_count 5 --eval_episode_count 3 --iteration_count 100 --rewardplot_width 80  --chain_size=4 --ownership_goal 0.2

python -m cyberbattle.agents.baseline.run --training_episode_count 5 --eval_episode_count 3 --iteration_count 100 --rewardplot_width 80  --chain_size=4 --reward_goal 50 --ownership_goal 0

If everything is setup correctly you should get an output that looks like this:

torch cuda available=True
###### DQL
Learning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
  ## Episode: 1/1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
Episode 1|Iteration 10|reward:  139.0|Elapsed Time: 0:00:00|###################################################################|
###### Random search
Learning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0,
  ## Episode: 1/1 'Random search' ϵ=1.0000,
Episode 1|Iteration 10|reward:  194.0|Elapsed Time: 0:00:00|###################################################################|
simulation ended
Episode duration -- DQN=Red, Random=Green
   10.00  ┼
Cumulative rewards -- DQN=Red, Random=Green
  194.00  ┼      ╭──╴
  174.60  ┤      │
  155.20  ┤╭─────╯
  135.80  ┤│     ╭──╴
  116.40  ┤│     │
   97.00  ┤│    ╭╯
   77.60  ┤│    │
   58.20  ┤╯ ╭──╯
   38.80  ┤  │
   19.40  ┤  │
    0.00  ┼──╯

Jupyter notebooks

To quickly get familiar with the project, you can open one of the provided Jupyter notebooks to play interactively with the gym environments. At the root of the repository run the following command and then open the notebook in the notebooks folder from the Jupyter interface:

export PYTHONPATH=$(pwd)
jupyter lab

Some notebooks to get started:

How to instantiate the Gym environments?

The following code shows how to create an instance of the OpenAI Gym environment CyberBattleChain-v0, an environment based on a chain-like network structure, with 10 nodes (size=10) where the agent's goal is to either gain full ownership of the network (own_atleast_percent=1.0) or break the 80% network availability SLA (maintain_sla=0.80), while the network is being monitored and protected by the basic probalistically-modelled defender (defender_agent=ScanAndReimageCompromisedMachines):

import cyberbattle._env.cyberbattle_env

cyberbattlechain_defender =
  gym.make('CyberBattleChain-v0',
      size=10,
      attacker_goal=AttackerGoal(
          own_atleast=0,
          own_atleast_percent=1.0
      ),
      defender_constraint=DefenderConstraint(
          maintain_sla=0.80
      ),
      defender_agent=ScanAndReimageCompromisedMachines(
          probability=0.6,
          scan_capacity=2,
          scan_frequency=5))

To try other network topologies, take example on chainpattern.py to define your own set of machines and vulnerabilities, then add an entry in the module initializer to declare and register the Gym environment.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Ideas for contributions

Here are some ideas on how to contribute: enhance the simulation (event-based, refined the simulation, …), train an RL algorithm on the existing simulation, implement benchmark to evaluate and compare novelty of agents, add more network generative modes to train RL-agent on, contribute to the doc, fix bugs.

See also the wiki for more ideas.

Citing this project

@misc{msft:cyberbattlesim,
  Author = {Microsoft Defender Research Team.}
  Note = {Created by Christian Seifert, Michael Betser, William Blum, James Bono, Kate Farris, Emily Goren, Justin Grana, Kristian Holsheimer, Brandon Marken, Joshua Neil, Nicole Nichols, Jugal Parikh, Haoran Wei.},
  Publisher = {GitHub},
  Howpublished = {\url{https://github.com/microsoft/cyberbattlesim}},
  Title = {CyberBattleSim},
  Year = {2021}
}

Note on privacy

This project does not include any customer data. The provided models and network topologies are purely fictitious. Users of the provided code provide all the input to the simulation and must have the necessary permissions to use any provided data.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

cyberbattlesim's People

Contributors

adamhghs avatar blumu avatar br0kej avatar dependabot[bot] avatar eyast avatar filipe1417 avatar francescoluciano avatar ghost-pep avatar jaromiru avatar syfanx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cyberbattlesim's Issues

Can't run the example code

After installed, I ran the following:

$ python cyberbattle/agents/baseline/run.py --training_episode_count 1 --eval_episode_count 1 --iteration_count 10 --rewardplot_with 80  --chain_size=20 --ownership_goal 1.0
torch cuda available=False
###### DQL
Learning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
  ## Episode: 1/1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
Episode 1|Iteration 0|reward: ------|Elapsed Time: 0:00:00|                                                                                                                                                      |Traceback (most recent call last):
  File "cyberbattle/agents/baseline/run.py", line 77, in <module>
    dqn_learning_run = learner.epsilon_greedy_search(
  File "/home/jaromiru/Documents/wrk/rrl/CyberBattleSim/cyberbattle/agents/baseline/learner.py", line 257, in epsilon_greedy_search
    action_style, gym_action, action_metadata = learner.explore(wrapped_env)
  File "/home/jaromiru/Documents/wrk/rrl/CyberBattleSim/cyberbattle/agents/baseline/agent_dql.py", line 402, in explore
    gym_action = wrapped_env.env.sample_valid_action(kinds=[0, 1, 2])
  File "/home/jaromiru/Documents/wrk/rrl/CyberBattleSim/cyberbattle/_env/cyberbattle_env.py", line 938, in sample_valid_action
    action = self.sample_action_in_range(kinds)
  File "/home/jaromiru/Documents/wrk/rrl/CyberBattleSim/cyberbattle/_env/cyberbattle_env.py", line 884, in sample_action_in_range
    kind = np_random.choice(kinds)
AttributeError: 'NoneType' object has no attribute 'choice'

generate_random_traffic_network intended behavior?

For generate_random_traffic_network in generate_network.py, the resulting network has less nodes than n_clients. Is this intentional?
I believe the reason is that when building up edge_labels , the datatype is a set (which makes sense). This means that duplicate edges can't exist. However, when creating the traffic graph, edge_labels is iterated over.

import cyberbattle.simulation.generate_network as gn
import networkx as nx

random_traffic = gn.generate_random_traffic_network(n_clients=10,n_servers={"A":1})
random_traffic.number_of_nodes()

yields 5 nodes for me.

If the above is not the intended behavior, should there really be the sum of the values in the n_servers dict plus n_clients?
So in my above example 10+1 nodes total representing 10 clients and 1 server.

That (10+1 from above) seems to be the behavior in the networkx example of stochastic_block_model (used to create the traffic). Although, that leaves the opportunity for nodes to not be connected to any other nodes.

import networkx as nx
sizes = [10,1]
probs = [[0.25, 0.05], [0.05, 0.35]]
g = nx.stochastic_block_model(sizes, probs, seed=0)
g.number_of_nodes()

yields 11 nodes for me

Please let me know if you need further clarification on my question.

Red Agent Making Illegal Moves

Hi,

Just double checking - there may be a small bug with the red agent choosing invalid actions from the action space. Repro can be found here - second_bug_branch - with an example case shown in 'notebooks/Random_Network_Invalid_Move.ipynb'.

Additional nodes are set up with create_node_data_two, such that the firewall conf is set to block all and there are no SMB / RDP vulns present. Only one edge is made for each new node, between the local machine that has the "knows_on_capture" exploit and the target node it pivots to. The idea is that once the knows_on_capture exploit is launched, essentially its like finding handwritten credentials, auto granting access to the remote machine.

From the ipynb file we can see that there are many attempted remote connections between these additional nodes and the original nodes in the network. Edges are added with the EdgeAnnotation.REMOTE as it tries to exploit RDP / SMB connections which shouldn't be possible. The local vulnerability library of the new nodes are empty { }, firewall rules are set to block all and no edges were formed when generating the nx graph in edges_labels dict.

The agent doesn't appear successful with its attacks, and if it helps I'm fairly confident that these attacks are only attempted at the very end of all its other potential attack routes, but I find it strange that it can try make these moves in the first place. This would add a +1 move which could skew results if the agent shouldn't be able to select from these moves to begin with.

Not sure if related but could be due to the way we are calling __mark_node_as_owned directly?

Thanks in advanced!

No attribute 'rewardplot_with'

Hi,

I have three errors to check my environment.

After I set up the dev environment, I ran the following command:

python cyberbattle/agents/baseline/run.py --training_episode_count 1 --eval_episode_count 1 --iteration_count 10 --rewardplot_width 80  --chain_size=20 --ownership_goal 1.0                                 ✘ 1

1st error. ModuleNotFoundError: No module named 'asciichartpy'

import cyberbattle
>>> Traceback (most recent call last):
  File "/home/XXX/CyberBattleSim/cyberbattle/agents/baseline/run.py", line 20, in <module>
    import asciichartpy
ModuleNotFoundError: No module named 'asciichartpy'

To solve it, I installed 'asciichartpy'.

2nd error. ModuleNotFoundError: No module named 'cyberbattle.agents.baseline'

python cyberbattle/agents/baseline/run.py --training_episode_count 1 --eval_episode_count 1 --iteration_count 10 --rewardplot_width 80  --chain_size=20 --ownership_goal 1.0

>>> 

raceback (most recent call last):
  File "/home/XXX/CyberBattleSim/cyberbattle/agents/baseline/run.py", line 22, in <module>
    import cyberbattle._env.cyberbattle_env as cyberbattle_env
  File "<frozen zipimport>", line 259, in load_module
  File "/home/XXX/mambaforge/lib/python3.9/site-packages/loonshot_sim-0.1-py3.9.egg/cyberbattle/__init__.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/XXX/mambaforge/lib/python3.9/site-packages/loonshot_sim-0.1-py3.9.egg/cyberbattle/agents/__init__.py", line 9, in <module>
ModuleNotFoundError: No module named 'cyberbattle.agents.baseline'

I stored "__init__.py" in "./cyberbattle/agents/baseline".

3rd error. AttributeError: 'Namespace' object has no attribute 'rewardplot_with'

torch cuda available=False
###### DQL
Learning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
  ## Episode: 1/1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
Episode 1|Iteration 10|reward:    9.0|last_reward_at:    6|Elapsed Time: 0:00:00|####################################################################################################################################################################################################|
  Episode 1 stopped at t=10
  Breakdown [Reward/NoReward (Success rate)]
    explore-local: 1/1 (0.50)
    explore-remote: 0/5 (0.00)
    explore-connect: 0/3 (0.00)
    exploit-local: 0/0 (NaN)
    exploit-remote: 0/0 (NaN)
    exploit-connect: 0/0 (NaN)
  exploit deflected to exploration: 1
            id      status properties              local_attacks              remote_attacks
0        start       owned         []  [ScanExplorerRecentFiles]                          []
1  1_LinuxNode  discovered        NaN                       None  [ProbeWindows, ProbeLinux]
simulation ended
###### Random search
Learning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0,
  ## Episode: 1/1 'Random search' ϵ=1.0000,
Episode 1|Iteration 10|reward:    0.0|last_reward_at: ----|Elapsed Time: 0:00:00|####################################################################################################################################################################################################|
  Episode 1 stopped at t=10
  Breakdown [Reward/NoReward (Success rate)]
    explore-local: 0/0 (NaN)
    explore-remote: 0/10 (0.00)
    explore-connect: 0/0 (NaN)
    exploit-local: 0/0 (NaN)
    exploit-remote: 0/0 (NaN)
    exploit-connect: 0/0 (NaN)
  exploit deflected to exploration: 0
simulation ended
Episode duration -- DQN=Red, Random=Green
   10.00  ┼
Cumulative rewards -- DQN=Red, Random=Green
Traceback (most recent call last):
  File "/home/XXX/CyberBattleSim/cyberbattle/agents/baseline/run.py", line 120, in <module>
    c = p.averaged_cummulative_rewards(all_runs, args.rewardplot_with)
AttributeError: 'Namespace' object has no attribute 'rewardplot_with'

I'd be grateful if you could give me advice about these issues.

Many thanks

The instructions are incomplete or the project dependencies are not correct.

Branch: master

Expected the following to produce output indicating the project is running:

docker build -t cyberbattle:1.1 .
docker run -it -v "$(pwd)":/source --rm cyberbattle:1.1 cyberbattle/agents/baseline/run.py

Resulted in:

Traceback (most recent call last):
File "cyberbattle/agents/baseline/run.py", line 16, in
import torch
ModuleNotFoundError: No module named 'torch'

Maximum number of iterations per episode

Hello: Thanks for this interesting and beneficial tool
In case of
iteration_count = 150 (for example) and gymid = "CyberBattleTiny-v0"

I found that sometimes while implementing your DQL agent ,and my customized DQL and other agents. The maximum number of iterations in each episode is not 150 iterations for my agents, while when I implement your DQN agent, I find that the iterations are always 150 (the maximum iteration). Even though the cumulative reward is almost the same and performance is comparable. Also, although I'm using almost the same code except for some changes in online and target networks.

Is there a problem in my agents?
What is the attacker's target of capturing the flag in the CyberBattle tool: is it just to own the nodes or must complete all iterations as well along with owning the nodes.
Thanks

install in WSL fails due to missing dependency

virgin WSL w ubuntu 20.04 LTS

init.sh gives

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
launchpadlib 1.10.13 requires testresources, which is not installed.

Question about rewards in chain environment

Hello, I am testing the chain environment with 10 nodes in interactive mode. The minimum amount of steps required to get the flag is 22 and the respective total_reward from the environment is 2154.0. This is achieved with 11 local exploits and 11 "connect and infect" actions.

What I don't understand is how the reported cumulative rewards in the baselines in notebook_benchmark-chain.ipynb reach 6000.0 or more. How is this possible?

In the DQL exploit run there is this printout for example:

Episode 2|Iteration 22|reward: 6099.0|last_reward_at:   22|Elapsed Time: 0:00:00||

  Episode 2 ended at t=22 
  Breakdown [Reward/NoReward (Success rate)]
    explore-local: 0/0 (NaN)
    explore-remote: 0/0 (NaN)
    explore-connect: 0/0 (NaN)
    exploit-local: 11/0 (1.00)
    exploit-remote: 0/0 (NaN)
    exploit-connect: 11/0 (1.00)
  exploit deflected to exploration: 0

Can you exploit how does the DQL agent get a reward of 6099.0 in 22 steps? I would appreciate a clarification since it is needed for a paper comparison.

Thank you!

environment_generation.py not working properly

Environment instantiated with create_random_environment() from environment_generation.py is not working properly.

Minimal code:

from cyberbattle.simulation.environment_generation import create_random_environment
import cyberbattle.simulation.commandcontrol as commandcontrol

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

Exception:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-3-b4d0a458d7ea> in <module>
      4 env = create_random_environment('test', 10)
      5 c2 = commandcontrol.CommandControl(env)
----> 6 c2.print_all_attacks()

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/commandcontrol.py in print_all_attacks(self)
    101     def print_all_attacks(self) -> None:
    102         """Pretty print list of all possible attacks from all the nodes currently owned by the attacker"""
--> 103         return self._actuator.print_all_attacks()
    104 
    105     def run_attack(self,

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in print_all_attacks(self)
    542     def print_all_attacks(self) -> None:
    543         """Pretty print list of all possible attacks from all the nodes currently owned by the attacker"""
--> 544         d.display(pd.DataFrame.from_dict(self.list_all_attacks()))  # type: ignore
    545 
    546 

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in list_all_attacks(self)
    525     def list_all_attacks(self) -> List[Dict[str, object]]:
    526         """List all possible attacks from all the nodes currently owned by the attacker"""
--> 527         on_owned_nodes: List[Dict[str, object]] = [
    528             {'id': n['id'],
    529              'status': n['status'],

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in <listcomp>(.0)
    530              'properties': self._environment.get_node(n['id']).properties,
    531              'local_attacks': self.list_local_attacks(n['id']),
--> 532              'remote_attacks': self.list_remote_attacks(n['id'])
    533              }
    534             for n in self.list_nodes() if n['status'] == 'owned']

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in list_remote_attacks(self, node_id)
    507     def list_remote_attacks(self, node_id: model.NodeID) -> List[model.VulnerabilityID]:
    508         """Return list of all remote attacks that may be executed onto the specified node."""
--> 509         attacks: List[model.VulnerabilityID] = self.list_vulnerabilities_in_target(
    510             node_id, model.VulnerabilityType.REMOTE)
    511         return attacks

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in list_vulnerabilities_in_target(self, target, type_filter)
    149         target_node_data: model.NodeInfo = self._environment.get_node(target)
    150 
--> 151         global_vuln: Set[model.VulnerabilityID] = {
    152             vuln_id
    153             for vuln_id, vulnerability in self._environment.vulnerability_library.items()

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in <setcomp>(.0)
    153             for vuln_id, vulnerability in self._environment.vulnerability_library.items()
    154             if (type_filter is None or vulnerability.type == type_filter)
--> 155             and self._check_prerequisites(target, vulnerability)
    156         }
    157 

~/Documents/wrk/rrl/CyberBattleSim/notebooks/../cyberbattle/simulation/actions.py in _check_prerequisites(self, target, vulnerability)
    131         mapping = {i: ALGEBRA.TRUE if str(i) in node_flags else ALGEBRA.FALSE for i in expr.get_symbols()}
    132 
--> 133         is_true: bool = cast(boolean.Expression, expr.subs(mapping)).simplify() == ALGEBRA.TRUE
    134         return is_true
    135 

~/miniconda3/envs/cyberbattle/lib/python3.8/site-packages/boolean/boolean.py in simplify(self, sort)
   1185         # Create new instance of own class with canonical args.
   1186         # TODO: Only create new class if some args changed.
-> 1187         expr = self.__class__(*args)
   1188 
   1189         # Literalize before doing anything, this also applies De Morgan's Law

~/miniconda3/envs/cyberbattle/lib/python3.8/site-packages/boolean/boolean.py in __init__(self, arg1, arg2, *args)
   1466 
   1467     def __init__(self, arg1, arg2, *args):
-> 1468         super(AND, self).__init__(arg1, arg2, *args)
   1469         self.identity = self.TRUE
   1470         self.annihilator = self.FALSE

~/miniconda3/envs/cyberbattle/lib/python3.8/site-packages/boolean/boolean.py in __init__(self, arg1, arg2, *args)
   1132 
   1133     def __init__(self, arg1, arg2, *args):
-> 1134         super(DualBase, self).__init__(arg1, arg2, *args)
   1135 
   1136         # identity element for the specific operation.

~/miniconda3/envs/cyberbattle/lib/python3.8/site-packages/boolean/boolean.py in __init__(self, *args)
    943         self.operator = None
    944 
--> 945         assert all(isinstance(arg, Expression) for arg in args), \
    946             'Bad arguments: all arguments must be an Expression: %r' % (args,)
    947         self.args = tuple(args)

AssertionError: Bad arguments: all arguments must be an Expression: (FALSE, <class 'boolean.boolean._TRUE'>)

I have traced the error to this potential_linux_vulns:

    "SudoCaching":
    model.VulnerabilityInfo(
        description="Escalating privileges from poorly configured sudo on linux/unix machines",
        type=model.VulnerabilityType.REMOTE,
        URL="https://attack.mitre.org/techniques/T1206/",
        precondition=model.Precondition(f"Linux&(~{ADMINTAG})"),
        outcome=model.AdminEscalation(),
        rates=model.Rates(0, 1.0, 1.0))

The precondition is translated into AND(FALSE, NOT(FALSE)) which fails to be simplified with the boolean library.
The used workaround in actions.py (from bastikr/boolean.py#82) does not help:

ALGEBRA.TRUE.dual = type(ALGEBRA.FALSE)
ALGEBRA.FALSE.dual = type(ALGEBRA.TRUE)

Convert action to string

When I print action from the following:

action_type, action, action_metadata = l.exploit(wrapped_env, observation)

I get something like: {'remote_vulnerability': array([2, 5, 5])}, which doesn't really give me any information on what the remote vulnerability is. Is there any way to view a pretty-print version of the action, such as the model.VulnerabilityID?

Dockerfile doesn't build correctly

There are several issues when trying to build the included Dockerfile the output below is taken from a single docker build but has been truncated to only show the errors happy to include the full output if it will help.

  • Ubuntu 20.04.2 LTS
  • Linux ip-172-31-9-167 5.4.0-1038-aws #40-Ubuntu SMP Fri Feb 5 23:50:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Docker version 19.03.8, build afacb8b7f0
ubuntu@ip-172-31-9-167:~/CyberBattleSim$ sudo docker build -t cyberbattlesim . 
Sending build context to Docker daemon  22.37MB
Step 1/9 : FROM mcr.microsoft.com/azureml/onnxruntime:latest-cuda
latest-cuda: Pulling from azureml/onnxruntime
92dc2a97ff99: Pull complete 
be13a9d27eb8: Pull complete 

...

Reading state information...
11 packages can be upgraded. Run 'apt list --upgradable' to see them.
./init.sh: line 70: curl: command not found
Reading package lists...
Building dependency tree...

...

Setting up libxml-parser-perl (2.44-2build3) ...
Setting up intltool (0.51.0-5ubuntu1) ...
Setting up python-distutils-extra (2.41ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
./init.sh: line 81: npm: command not found
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python (python) in auto mode
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python3 (python3) in auto mode
Checking node version...
Node version 8.10.0 too old, min expected is 10.15.2, run:
 npm -g upgrade node
Installing the Plotly orca dependency for plotly figure export
Reading package lists...
Building dependency tree...

...

  xfonts-encodings xfonts-utils xkb-data xserver-common xvfb
0 upgraded, 196 newly installed, 0 to remove and 11 not upgraded.
Need to get 109 MB of archives.
After this operation, 394 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
./install-orca.sh: line 16: npm: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1882k  100 1882k    0     0  25.8M      0 --:--:-- --:--:-- --:--:-- 25.8M
Python 3.8.9
Collecting pip

...

Collecting numpy_stubs@ git+https://github.com/numpy/numpy-stubs/@master#egg=numpy_stubs
  Cloning https://github.com/numpy/numpy-stubs/ (to revision master) to /tmp/pip-install-9fc0qms6/numpy-stubs_634e348c036d4d6daa4c3dbd265e72ce
  Running command git clone -q https://github.com/numpy/numpy-stubs/ /tmp/pip-install-9fc0qms6/numpy-stubs_634e348c036d4d6daa4c3dbd265e72ce
  ERROR: Error [Errno 2] No such file or directory: 'git' while executing command git clone -q https://github.com/numpy/numpy-stubs/ /tmp/pip-install-9fc0qms6/numpy-stubs_634e348c036d4d6daa4c3dbd265e72ce
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
./init.sh: line 125: pre-commit: command not found
Compatible version 3.8.9 of Python detected at /usr/bin/python3.8
Creating type stubs
./createstubs.sh: line 14: pyright: command not found
~
Removing intermediate container 27bc944a639d
 ---> 8f1bc73cb557

Typo in run.py

Hi. there is a typo in run.py at line 120.
It should be named rewardplot_width instead of rewardplot_with.

Action_space dimensions formally too large

Dear all,

With latest update, which allowed to increase the number of maximum nodes using kwargs dict inside registry(...) function, the default parameters are 100 nodes,

maximum_node_count: int = 100,
, which makes action_space for local, remote and connect to be especially large.
Although, that does not change the logic of computing action_mask and set valid node id to be nax number of discovered nodes, internally vector is set to be too big.

  1. Question: I want to ask for the logic of change from using max_node_count parameter here
    max_node_count = self.bounds.maximum_node_count
    , why we want to have option to enlarge the maximum nodes count using registry and this we had to change the value from inferred form initial_network to the one included in bounds for registry function?
  2. Solution: The workaround as I see can be simply to make this parameters maximum_node_count: int | None and then make if else logic for setting them equal to initial number of parameters from network (done in previous commits from main)

requirements.dev.txt

The requirements.dev.txt has the wrong format for pip install

which causes

  File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3103, in __init__
    raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Parse error at "'(===1.5.'": Expected stringEnd
Installing collected packages: psutil, numpy-stubs, loonshot-sim, data-science-types, asciichartpy, asciichart
    Running setup.py install for psutil ... error
    ERROR: Command errored out with exit status 1:

I think this should be torch==1.5.1

Play the environment with other RL algorithms

Hi everyone,
I'm interested in how the environment in this project performs under other reinforcement algorithms. But I'm new to reinforcement learning and not yet capable of implementing other reinforcement learning algorithms on my own.
I noticed that algorithms such as Q-Learning and DQN have been implemented in the baselines directory. And the definition of the environment is quite different from some basic gym environments (e.g. CartPole), which made it difficult for me to understand.
I wonder if it is possible to implement different RL algorithms in the environments of this project with the help of some RL algorithm libraries? (e.g. Stable-Baselines3, Keras-rl)
I would greatly appreciate the help.
Thank you

Qt platform issue in benchmark

When I run notebook_benchmark in jupyter it works fine, plots of benchmark appear, while executing it on pycharm, the below error appears due to a Qt platform issue even though I've reinstalled it several times and the agents are trained and all codes are implemented successfully except only ploting part.

##################### Error#############################
QObject::moveToThread: Current thread (0x20247e0) is not the object's thread (0x5c0a590).
Cannot move to target thread (0x20247e0)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ahmed/PhD/CyberBattleSim/CyberBattleSim/cybervenv/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
###########################################################

Has anyone encountered such a problem?

How to setup machine/program for use

Hello, Is there a video or FAQ page or more detailed guide about how to setup my machine and how to run the software for use, I am having issues getting the program to work as some of the commands outlined are not working for me such as the ./init.sh file is not downloading all of the dependencies to my machine.

I greatly appreciate the help.

The repeated discovery of the same node via different methods leads to reward

I noticed by generating a random CyberBattleRandom-v0 environment and using the agent with random actions, that if the same node is discovered with different methods (e.g., traceroute / shared files) it leads to a repeated reward.

It seems as incorrect behaviour, because this way the agent is incentivized to repeatedly discover the same nodes with different actions.

E: Unable to locate package python3.9

Problem

When using a Dockerfile to build the CyberBattleSim image, you will encounter an error message similar to the following:

...
E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'

data['kind'] missing & unexpected red agent behaviour

Hi,

I have modified the environment to include additional nodes / vulns / attack vectors, keeping things mostly the same with respect to environment generation; graph = graph.add_edge[(s, t), (port)] which models fine and AIGym seems happy with the change. The only difference in network generation is that I am using an erdos-renyi generator instead of the nx.stochastic_block_model included in environment_generation.py

The issue is that when running the simulation, i'm met with two unexpected behaviors;

  1. KeyError: 'kind' from commandcontrol.py.

This appears to fail randomly on certain nodes, but with no obvious pattern. For example, one play-through fails when data['kind'] from node 6 to node 3 is missing (default nodes, not ones I have added) which in-turn ends the simulation. E: Just to add, I guess i'm asking if there are any instances where a node wouldn't be assigned an EdgeAnnotation or is it likely something I've done that has broken something / not accounted for a change. This only seems to be an issue with the rendering of the network in network_as_plotly_traces(_) in cyberbattle_env.py and doesn't appear to affect the game.

  1. Red agent can try to exploit RDP / SMB in targets that it shouldn't be able to

It seems that the attacker can try to exploit nodes it shouldn't be able to see. In the network, one node is selected to be a pivot point between other networks, this node has a single vulnerability allowing the pivot, with firewall settings set to block all. The red agent still appears to be able to scan this node for SMB / RDP from any node, and assigns them each EdgeAnnotation.REMOTE, which shouldn't be considered valid moves.

Any advice on where to look would be greatly appreciated,

Thanks

Key for how the simulation is working

I am new to this sort of content and am struggling to know the difference between 'owned' and 'discovered'. To add to this, I want to increase the nodes/networks the attacker has to traverse through before it gets a reward. I believe it is a matter of adding more nodes like this for example.

"Website.Directory": m.NodeInfo(
services=[m.ListeningService("HTTPS")],
value=50,
properties=["Ubuntu", "nginx/1.10.3",
"CTFFLAG:Readme.txt-Discover secret data"
],
vulnerabilities=dict(
NavigateWebDirectoryFurther=m.VulnerabilityInfo(
description="Discover MYSQL credentials MySql for user "
"'web' in (getting-started.txt)",
type=m.VulnerabilityType.REMOTE,
outcome=m.LeakedCredentials(credentials=[
m.CachedCredential(node="Website", port="MySQL",
credential="ReusedMySqlCred-web")]),
reward_string="Discover browseable web directory: Navigating to parent URL revealed file readme.txt"
"with secret data (aflag); and getting-started.txt with MYSQL credentials",
cost=1.0
),
NavigateWebDirectory=m.VulnerabilityInfo(
description="Discover URL to external sharepoint website "
"(in deprecation-checklist.txt)",
type=m.VulnerabilityType.REMOTE,
outcome=m.LeakedNodesId(["Sharepoint"]),
reward_string="Navigating to parent URL revealed file deprecation-checklist.txt containing"
"a URL to an external sharepoint website",
cost=1.0
)
)),

Something wrong with the node's last owned time and last reimaged time?

Sorry to bother.

I am wondering if class NodeTrackingInformation is not indicating the right occurrence time of the last attack?

The time() func at line 248 and 671 in actions.py would set the nodes's last_reimaging_time and last_owned time to be '00:00:00'. So when the cyber attacker attempts to re-connect to a conquered but lately reimaged node, func __is_node_owned_history at line 483 would recognize the reimaged node as a currently owned node. Therefore the cyber attacker can never connect to a reimaged node successfully.

Is it true, or am I mistaking something here😂?

ModuleNotFound

I had this issue when I tried to run the simulation.
"No module named 'cyberbattle'."
I tried to export the path but did not work.

Installation on Ubuntu 18.04 requires root authority

Thank you for sharing this wonderful job! I met some problem while installation: I tried to run init.sh on a shared server which ubuntu version is 18.04 so it reminded me to use apt to download something, however I do not have root authority or sudo account. What should I do now?

ModuleNotFoundError: No module named 'cyberbattle'

When I call

docker run -it -v "$(pwd)":/source --rm cyberbattle:1.1 /bin/bash
python cyberbattle/agents/baseline/run.py --training_episode_count 5 --eval_episode_count 3 --iteration_count 100 --rewardplot_width 80  --chain_size=4 --ownership_goal 0.2

The output is

ModuleNotFoundError: No module named 'cyberbattle'

But using Ipython, it is normal.

init.sh doesn't work

(CBS) xzh@xzh-virtual-machine:~/Desktop/CyberBattleSim$ ./init.sh
++ dirname ./init.sh

  • pushd .
    ~/Desktop/CyberBattleSim ~/Desktop/CyberBattleSim
    ++ lsb_release -rs
  • UBUNTU_VERSION=20.04
  • verlte 20.04 20
    ++ echo -e '20.04\n20'
    ++ head -n1
    ++ sort -V
  • '[' 20.04 = 20 ']'
  • OLDER_UBUNTU=0
  • '[' 0 == 1 ']'
  • ADD_PYTHON39_APTREPO=0
  • '[' '' '!=' '' ']'
  • CREATE_VENV=1
  • getopts nr opt
  • SUDO=
  • (( 1000 != 0 ))
  • SUDO='sudo -E'
  • '[' '!' -z '' ']'
  • '[' 0 == 1 ']'
  • sudo -E apt update
    [sudo] password for xzh:
    Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
    Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease
    Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease
    Hit:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    539 packages can be upgraded. Run 'apt list --upgradable' to see them.
  • sudo -E apt-get install curl -y
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
    libcurl4
    The following NEW packages will be installed:
    curl libcurl4
    0 upgraded, 2 newly installed, 0 to remove and 539 not upgraded.
    Need to get 396 kB of archives.
    After this operation, 1,123 kB of additional disk space will be used.
    Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libcurl4 amd64 7.68.0-1ubuntu2.14 [235 kB]
    Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 curl amd64 7.68.0-1ubuntu2.14 [161 kB]
    Fetched 396 kB in 1s (559 kB/s)
    Selecting previously unselected package libcurl4:amd64.
    (Reading database ... 157868 files and directories currently installed.)
    Preparing to unpack .../libcurl4_7.68.0-1ubuntu2.14_amd64.deb ...
    Unpacking libcurl4:amd64 (7.68.0-1ubuntu2.14) ...
    Selecting previously unselected package curl.
    Preparing to unpack .../curl_7.68.0-1ubuntu2.14_amd64.deb ...
    Unpacking curl (7.68.0-1ubuntu2.14) ...
    Setting up libcurl4:amd64 (7.68.0-1ubuntu2.14) ...
    Setting up curl (7.68.0-1ubuntu2.14) ...
    Processing triggers for man-db (2.9.1-1) ...
    Processing triggers for libc-bin (2.31-0ubuntu9) ...
  • curl -sL https://deb.nodesource.com/setup_16.x
  • sudo -E bash -

Installing the NodeSource Node.js 16.x repo...

Populating apt-get cache...

Confirming "focal" is supported...

Adding the NodeSource signing key to your keyring...

Creating apt sources list file for the NodeSource Node.js 16.x repo...

Running apt-get update for you...

Run sudo apt-get install -y nodejs to install Node.js 16.x and npm

You may also need development tools to build native addons:

 sudo apt-get install gcc g++ make

To install the Yarn package manager, run:

 curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
 echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
 sudo apt-get update && sudo apt-get install yarn
  • '[' 0 == 1 ']'
  • cat apt-requirements.txt
  • sudo -E xargs apt-get install -y
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    lsb-release is already the newest version (11.1.0ubuntu2).
    lsb-release set to manually installed.
    git is already the newest version (1:2.25.1-1ubuntu3.6).
    The following additional packages will be installed:
    autoconf automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp-9 dpkg-dev fakeroot freeglut3 g++ g++-9 gcc gcc-10-base gcc-9 gcc-9-base gettext gnupg gnupg-l10n gnupg-utils gpg gpg-agent
    gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv intltool libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6 libc6-dbg libc6-dev libcc1-0
    libcroco3 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libexpat1 libexpat1-dev libfakeroot libgcc-9-dev libgcc-s1 libgomp1 libitm1 liblsan0 libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libpython3-dev
    libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib libpython3.9 libpython3.9-dev libpython3.9-minimal libpython3.9-stdlib libquadmath0 libsigsegv2 libstdc++-9-dev libstdc++6 libtsan0 libubsan1
    linux-libc-dev m4 make manpages-dev python-pip-whl python-pkg-resources python2 python2-minimal python2.7 python2.7-minimal python3-atomicwrites python3-attr python3-importlib-metadata python3-lib2to3
    python3-more-itertools python3-packaging python3-pluggy python3-py python3-pyparsing python3-software-properties python3-wcwidth python3-zipp python3.8 python3.8-dev python3.8-minimal python3.9-minimal
    software-properties-gtk zlib1g zlib1g-dev
    Suggested packages:
    autoconf-archive gnu-standards autoconf-doc libtool binutils-doc gcc-9-locales tor debian-keyring g++-multilib g++-9-multilib gcc-9-doc gcc-multilib flex bison gcc-doc gcc-9-multilib gettext-doc autopoint
    libasprintf-dev libgettextpo-dev parcimonie xloadimage scdaemon glibc-doc bzr libstdc++-9-doc m4-doc make-doc devscripts python-setuptools python2-doc python-tk python2.7-doc binfmt-support python-attr-doc python3-tk
    python3-numpy libgle3 subversion python-pyparsing-doc python-setuptools-doc python3.8-venv python3.8-doc python3.9-doc
    The following NEW packages will be installed:
    apt-transport-https autoconf automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential dpkg-dev fakeroot freeglut3 g++ g++-9 gcc gcc-9 gettext intltool libalgorithm-diff-perl
    libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcroco3 libcrypt-dev libctf-nobfd0 libctf0 libexpat1-dev libfakeroot libgcc-9-dev libitm1 liblsan0
    libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libpython3-dev libpython3.8-dev libpython3.9 libpython3.9-dev libpython3.9-minimal libpython3.9-stdlib libquadmath0 libsigsegv2 libstdc++-9-dev libtsan0
    libubsan1 linux-libc-dev m4 make manpages-dev nodejs python-distutils-extra python-pip-whl python-pkg-resources python2 python2-minimal python2.7 python2.7-minimal python3-atomicwrites python3-attr python3-dev
    python3-distutils python3-importlib-metadata python3-lib2to3 python3-more-itertools python3-opengl python3-packaging python3-pluggy python3-py python3-pyparsing python3-pytest python3-setuptools python3-wcwidth
    python3-zipp python3.8-dev python3.9 python3.9-dev python3.9-minimal python3.9-venv zlib1g-dev
    The following packages will be upgraded:
    ca-certificates cpp-9 dirmngr gcc-10-base gcc-9-base gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gpgv libc6 libc6-dbg libcc1-0 libdpkg-perl libexpat1 libgcc-s1 libgomp1
    libpython3.8 libpython3.8-minimal libpython3.8-stdlib libstdc++6 python3-software-properties python3.8 python3.8-minimal software-properties-common software-properties-gtk zlib1g
    32 upgraded, 82 newly installed, 0 to remove and 507 not upgraded.
    Need to get 112 MB/130 MB of archives.
    After this operation, 393 MB of additional disk space will be used.
    Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libc6-dbg amd64 2.31-0ubuntu9.9 [20.0 MB]
    Get:2 https://deb.nodesource.com/node_16.x focal/main amd64 nodejs amd64 16.19.0-deb-1nodesource1 [27.2 MB]
    Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libc6 amd64 2.31-0ubuntu9.9 [2,722 kB]
    Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython2.7-minimal amd64 2.7.18-120.04.3 [336 kB]
    Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python2.7-minimal amd64 2.7.18-1
    20.04.3 [1,280 kB]
    Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python2-minimal amd64 2.7.17-2ubuntu4 [27.5 kB]
    Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython2.7-stdlib amd64 2.7.18-120.04.3 [1,888 kB]
    Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python2.7 amd64 2.7.18-1
    20.04.3 [248 kB]
    Get:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 libpython2-stdlib amd64 2.7.17-2ubuntu4 [7,072 B]
    Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python2 amd64 2.7.17-2ubuntu4 [26.5 kB]
    Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython3.9-minimal amd64 3.9.5-3ubuntu020.04.1 [756 kB]
    Get:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3.9-minimal amd64 3.9.5-3ubuntu0
    20.04.1 [2,022 kB]
    Get:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 apt-transport-https all 2.0.9 [1,704 B]
    Get:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libsigsegv2 amd64 2.12-2 [13.9 kB]
    Get:15 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 m4 amd64 1.4.18-4 [199 kB]
    Get:16 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 autoconf all 2.69-11.1 [321 kB]
    Get:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 autotools-dev all 20180224.1 [39.6 kB]
    Get:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 automake all 1:1.16.1-4ubuntu6 [522 kB]
    Get:19 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 binutils-common amd64 2.34-6ubuntu1.4 [207 kB]
    Get:20 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libbinutils amd64 2.34-6ubuntu1.4 [474 kB]
    Get:21 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libctf-nobfd0 amd64 2.34-6ubuntu1.4 [47.2 kB]
    Get:22 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libctf0 amd64 2.34-6ubuntu1.4 [46.6 kB]
    Get:23 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 binutils-x86-64-linux-gnu amd64 2.34-6ubuntu1.4 [1,613 kB]
    Get:24 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 binutils amd64 2.34-6ubuntu1.4 [3,380 B]
    Get:25 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libc-dev-bin amd64 2.31-0ubuntu9.9 [71.8 kB]
    Get:26 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-135.152 [1,121 kB]
    Get:27 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libcrypt-dev amd64 1:4.4.10-10ubuntu4 [104 kB]
    Get:28 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libc6-dev amd64 2.31-0ubuntu9.9 [2,519 kB]
    Get:29 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libitm1 amd64 10.3.0-1ubuntu120.04 [26.2 kB]
    Get:30 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libasan5 amd64 9.4.0-1ubuntu1
    20.04.1 [2,751 kB]
    Get:31 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 liblsan0 amd64 10.3.0-1ubuntu120.04 [835 kB]
    Get:32 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libtsan0 amd64 10.3.0-1ubuntu1
    20.04 [2,009 kB]
    Get:33 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libubsan1 amd64 10.3.0-1ubuntu120.04 [784 kB]
    Get:34 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libquadmath0 amd64 10.3.0-1ubuntu1
    20.04 [146 kB]
    Get:35 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.4.0-1ubuntu120.04.1 [2,359 kB]
    Get:36 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 gcc-9 amd64 9.4.0-1ubuntu1
    20.04.1 [8,274 kB]
    Get:37 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1ubuntu2 [5,208 B]
    Get:38 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libstdc++-9-dev amd64 9.4.0-1ubuntu120.04.1 [1,722 kB]
    Get:39 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 g++-9 amd64 9.4.0-1ubuntu1
    20.04.1 [8,420 kB]
    Get:40 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1ubuntu2 [1,604 B]
    Get:41 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 make amd64 4.2.1-1.2 [162 kB]
    Get:42 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 dpkg-dev all 1.19.7ubuntu3.2 [679 kB]
    Get:43 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 build-essential amd64 12.8ubuntu1.1 [4,664 B]
    Get:44 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libfakeroot amd64 1.24-1 [25.7 kB]
    Get:45 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 fakeroot amd64 1.24-1 [62.6 kB]
    Get:46 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 freeglut3 amd64 2.8.1-3 [73.6 kB]
    Get:47 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libcroco3 amd64 0.6.13-1 [82.5 kB]
    Get:48 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 gettext amd64 0.19.8.1-10build1 [895 kB]
    Get:49 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 intltool all 0.51.0-5ubuntu1 [44.6 kB]
    Get:50 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libalgorithm-diff-perl all 1.19.03-2 [46.6 kB]
    Get:51 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libalgorithm-diff-xs-perl amd64 0.04-6 [11.3 kB]
    Get:52 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
    Get:53 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
    Get:54 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu120.04.6 [3,949 kB]
    Get:55 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
    Get:56 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython3.9-stdlib amd64 3.9.5-3ubuntu0
    20.04.1 [1,778 kB]
    Get:57 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython3.9 amd64 3.9.5-3ubuntu020.04.1 [1,714 kB]
    Get:58 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
    Get:59 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 libpython3.9-dev amd64 3.9.5-3ubuntu0
    20.04.1 [4,126 kB]
    Get:60 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 manpages-dev all 5.05-1 [2,266 kB]
    Get:61 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python-pkg-resources all 44.0.0-2 [129 kB]
    Get:62 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python-distutils-extra all 2.43 [21.3 kB]
    Get:63 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
    Get:64 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python3-atomicwrites all 1.1.5-2build1 [7,016 B]
    Get:65 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-attr all 19.3.0-2 [33.9 kB]
    Get:66 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu120.04.6 [514 kB]
    Get:67 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 python3-lib2to3 all 3.8.10-0ubuntu1
    20.04 [76.3 kB]
    Get:68 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu120.04 [141 kB]
    Get:69 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
    Get:70 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-more-itertools all 4.2.0-1build1 [39.4 kB]
    Get:71 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-zipp all 1.0.0-1 [5,312 B]
    Get:72 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-importlib-metadata all 1.5.0-1 [9,992 B]
    Get:73 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python3-opengl all 3.1.0+dfsg-2build1 [486 kB]
    Get:74 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-pyparsing all 2.4.6-1 [61.3 kB]
    Get:75 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-packaging all 20.3-1 [26.8 kB]
    Get:76 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python3-pluggy all 0.13.0-2 [18.4 kB]
    Get:77 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3-py all 1.8.1-1ubuntu0.1 [65.6 kB]
    Get:78 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-wcwidth all 0.1.8+dfsg1-3 [17.4 kB]
    Get:79 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 python3-pytest all 4.6.9-1 [178 kB]
    Get:80 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
    Get:81 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 software-properties-common all 0.99.9.8 [10.6 kB]
    Get:82 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 software-properties-gtk all 0.99.9.8 [66.0 kB]
    Get:83 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 python3-software-properties all 0.99.9.8 [24.9 kB]
    Get:84 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3.9 amd64 3.9.5-3ubuntu0
    20.04.1 [423 kB]
    Get:85 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3.9-dev amd64 3.9.5-3ubuntu020.04.1 [510 kB]
    Get:86 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 python3.9-venv amd64 3.9.5-3ubuntu0
    20.04.1 [5,452 B]
    Fetched 105 MB in 22s (4,781 kB/s)
    Extracting templates from packages: 100%
    Preconfiguring packages ...
    (Reading database ... 157881 files and directories currently installed.)
    Preparing to unpack .../libc6-dbg_2.31-0ubuntu9.9_amd64.deb ...
    Unpacking libc6-dbg:amd64 (2.31-0ubuntu9.9) over (2.31-0ubuntu9) ...
    Preparing to unpack .../libgomp1_10.3.0-1ubuntu120.04_amd64.deb ...
    Unpacking libgomp1:amd64 (10.3.0-1ubuntu1
    20.04) over (10-20200411-0ubuntu1) ...
    Preparing to unpack .../gcc-10-base_10.3.0-1ubuntu120.04_amd64.deb ...
    Unpacking gcc-10-base:amd64 (10.3.0-1ubuntu1
    20.04) over (10-20200411-0ubuntu1) ...
    Setting up gcc-10-base:amd64 (10.3.0-1ubuntu120.04) ...
    (Reading database ... 158063 files and directories currently installed.)
    Preparing to unpack .../libgcc-s1_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libgcc-s1:amd64 (10.3.0-1ubuntu120.04) over (10-20200411-0ubuntu1) ...
    Setting up libgcc-s1:amd64 (10.3.0-1ubuntu1
    20.04) ...
    (Reading database ... 158063 files and directories currently installed.)
    Preparing to unpack .../libcc1-0_10.3.0-1ubuntu120.04_amd64.deb ...
    Unpacking libcc1-0:amd64 (10.3.0-1ubuntu1
    20.04) over (10-20200411-0ubuntu1) ...
    Preparing to unpack .../libstdc++6_10.3.0-1ubuntu120.04_amd64.deb ...
    Unpacking libstdc++6:amd64 (10.3.0-1ubuntu1
    20.04) over (10-20200411-0ubuntu1) ...
    Setting up libstdc++6:amd64 (10.3.0-1ubuntu120.04) ...
    (Reading database ... 158063 files and directories currently installed.)
    Preparing to unpack .../libc6_2.31-0ubuntu9.9_amd64.deb ...
    Unpacking libc6:amd64 (2.31-0ubuntu9.9) over (2.31-0ubuntu9) ...
    Setting up libc6:amd64 (2.31-0ubuntu9.9) ...
    (Reading database ... 158063 files and directories currently installed.)
    Preparing to unpack .../libexpat1_2.2.9-1ubuntu0.6_amd64.deb ...
    Unpacking libexpat1:amd64 (2.2.9-1ubuntu0.6) over (2.2.9-1build1) ...
    Preparing to unpack .../zlib1g_1%3a1.2.11.dfsg-2ubuntu1.5_amd64.deb ...
    Unpacking zlib1g:amd64 (1:1.2.11.dfsg-2ubuntu1.5) over (1:1.2.11.dfsg-2ubuntu1) ...
    Setting up zlib1g:amd64 (1:1.2.11.dfsg-2ubuntu1.5) ...
    (Reading database ... 158063 files and directories currently installed.)
    Preparing to unpack .../00-libpython3.8_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking libpython3.8:amd64 (3.8.10-0ubuntu120.04.6) over (3.8.2-1ubuntu1.2) ...
    Preparing to unpack .../01-python3.8_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking python3.8 (3.8.10-0ubuntu120.04.6) over (3.8.2-1ubuntu1.2) ...
    Preparing to unpack .../02-libpython3.8-stdlib_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking libpython3.8-stdlib:amd64 (3.8.10-0ubuntu120.04.6) over (3.8.2-1ubuntu1.2) ...
    Preparing to unpack .../03-python3.8-minimal_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking python3.8-minimal (3.8.10-0ubuntu120.04.6) over (3.8.2-1ubuntu1.2) ...
    Preparing to unpack .../04-libpython3.8-minimal_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu120.04.6) over (3.8.2-1ubuntu1.2) ...
    Selecting previously unselected package libpython2.7-minimal:amd64.
    Preparing to unpack .../05-libpython2.7-minimal_2.7.18-1
    20.04.3_amd64.deb ...
    Unpacking libpython2.7-minimal:amd64 (2.7.18-120.04.3) ...
    Selecting previously unselected package python2.7-minimal.
    Preparing to unpack .../06-python2.7-minimal_2.7.18-1
    20.04.3_amd64.deb ...
    Unpacking python2.7-minimal (2.7.18-120.04.3) ...
    Selecting previously unselected package python2-minimal.
    Preparing to unpack .../07-python2-minimal_2.7.17-2ubuntu4_amd64.deb ...
    Unpacking python2-minimal (2.7.17-2ubuntu4) ...
    Selecting previously unselected package libpython2.7-stdlib:amd64.
    Preparing to unpack .../08-libpython2.7-stdlib_2.7.18-1
    20.04.3_amd64.deb ...
    Unpacking libpython2.7-stdlib:amd64 (2.7.18-120.04.3) ...
    Selecting previously unselected package python2.7.
    Preparing to unpack .../09-python2.7_2.7.18-1
    20.04.3_amd64.deb ...
    Unpacking python2.7 (2.7.18-120.04.3) ...
    Selecting previously unselected package libpython2-stdlib:amd64.
    Preparing to unpack .../10-libpython2-stdlib_2.7.17-2ubuntu4_amd64.deb ...
    Unpacking libpython2-stdlib:amd64 (2.7.17-2ubuntu4) ...
    Setting up libpython2.7-minimal:amd64 (2.7.18-1
    20.04.3) ...
    Setting up python2.7-minimal (2.7.18-120.04.3) ...
    Linking and byte-compiling packages for runtime python2.7...
    Setting up python2-minimal (2.7.17-2ubuntu4) ...
    Selecting previously unselected package python2.
    (Reading database ... 158810 files and directories currently installed.)
    Preparing to unpack .../00-python2_2.7.17-2ubuntu4_amd64.deb ...
    Unpacking python2 (2.7.17-2ubuntu4) ...
    Selecting previously unselected package libpython3.9-minimal:amd64.
    Preparing to unpack .../01-libpython3.9-minimal_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking libpython3.9-minimal:amd64 (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package python3.9-minimal.
    Preparing to unpack .../02-python3.9-minimal_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking python3.9-minimal (3.9.5-3ubuntu020.04.1) ...
    Preparing to unpack .../03-gpg-wks-client_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpg-wks-client (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../04-dirmngr_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking dirmngr (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../05-gnupg-utils_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gnupg-utils (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../06-gpg-wks-server_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpg-wks-server (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../07-gpg-agent_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpg-agent (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../08-gpg_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpg (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../09-gpgconf_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpgconf (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../10-gnupg-l10n_2.2.19-3ubuntu2.2_all.deb ...
    Unpacking gnupg-l10n (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../11-gnupg_2.2.19-3ubuntu2.2_all.deb ...
    Unpacking gnupg (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../12-gpgsm_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpgsm (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Preparing to unpack .../13-gpgv_2.2.19-3ubuntu2.2_amd64.deb ...
    Unpacking gpgv (2.2.19-3ubuntu2.2) over (2.2.19-3ubuntu2) ...
    Setting up gpgv (2.2.19-3ubuntu2.2) ...
    (Reading database ... 159122 files and directories currently installed.)
    Preparing to unpack .../00-ca-certificates_20211016ubuntu0.20.04.1_all.deb ...
    Unpacking ca-certificates (20211016ubuntu0.20.04.1) over (20190110ubuntu1.1) ...
    Selecting previously unselected package apt-transport-https.
    Preparing to unpack .../01-apt-transport-https_2.0.9_all.deb ...
    Unpacking apt-transport-https (2.0.9) ...
    Selecting previously unselected package libsigsegv2:amd64.
    Preparing to unpack .../02-libsigsegv2_2.12-2_amd64.deb ...
    Unpacking libsigsegv2:amd64 (2.12-2) ...
    Selecting previously unselected package m4.
    Preparing to unpack .../03-m4_1.4.18-4_amd64.deb ...
    Unpacking m4 (1.4.18-4) ...
    Selecting previously unselected package autoconf.
    Preparing to unpack .../04-autoconf_2.69-11.1_all.deb ...
    Unpacking autoconf (2.69-11.1) ...
    Selecting previously unselected package autotools-dev.
    Preparing to unpack .../05-autotools-dev_20180224.1_all.deb ...
    Unpacking autotools-dev (20180224.1) ...
    Selecting previously unselected package automake.
    Preparing to unpack .../06-automake_1%3a1.16.1-4ubuntu6_all.deb ...
    Unpacking automake (1:1.16.1-4ubuntu6) ...
    Selecting previously unselected package binutils-common:amd64.
    Preparing to unpack .../07-binutils-common_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking binutils-common:amd64 (2.34-6ubuntu1.4) ...
    Selecting previously unselected package libbinutils:amd64.
    Preparing to unpack .../08-libbinutils_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking libbinutils:amd64 (2.34-6ubuntu1.4) ...
    Selecting previously unselected package libctf-nobfd0:amd64.
    Preparing to unpack .../09-libctf-nobfd0_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking libctf-nobfd0:amd64 (2.34-6ubuntu1.4) ...
    Selecting previously unselected package libctf0:amd64.
    Preparing to unpack .../10-libctf0_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking libctf0:amd64 (2.34-6ubuntu1.4) ...
    Selecting previously unselected package binutils-x86-64-linux-gnu.
    Preparing to unpack .../11-binutils-x86-64-linux-gnu_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking binutils-x86-64-linux-gnu (2.34-6ubuntu1.4) ...
    Selecting previously unselected package binutils.
    Preparing to unpack .../12-binutils_2.34-6ubuntu1.4_amd64.deb ...
    Unpacking binutils (2.34-6ubuntu1.4) ...
    Selecting previously unselected package libc-dev-bin.
    Preparing to unpack .../13-libc-dev-bin_2.31-0ubuntu9.9_amd64.deb ...
    Unpacking libc-dev-bin (2.31-0ubuntu9.9) ...
    Selecting previously unselected package linux-libc-dev:amd64.
    Preparing to unpack .../14-linux-libc-dev_5.4.0-135.152_amd64.deb ...
    Unpacking linux-libc-dev:amd64 (5.4.0-135.152) ...
    Selecting previously unselected package libcrypt-dev:amd64.
    Preparing to unpack .../15-libcrypt-dev_1%3a4.4.10-10ubuntu4_amd64.deb ...
    Unpacking libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
    Selecting previously unselected package libc6-dev:amd64.
    Preparing to unpack .../16-libc6-dev_2.31-0ubuntu9.9_amd64.deb ...
    Unpacking libc6-dev:amd64 (2.31-0ubuntu9.9) ...
    Preparing to unpack .../17-cpp-9_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking cpp-9 (9.4.0-1ubuntu120.04.1) over (9.3.0-10ubuntu2) ...
    Preparing to unpack .../18-gcc-9-base_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking gcc-9-base:amd64 (9.4.0-1ubuntu120.04.1) over (9.3.0-10ubuntu2) ...
    Selecting previously unselected package libitm1:amd64.
    Preparing to unpack .../19-libitm1_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libitm1:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libatomic1:amd64.
    Preparing to unpack .../20-libatomic1_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libatomic1:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libasan5:amd64.
    Preparing to unpack .../21-libasan5_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking libasan5:amd64 (9.4.0-1ubuntu120.04.1) ...
    Selecting previously unselected package liblsan0:amd64.
    Preparing to unpack .../22-liblsan0_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking liblsan0:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libtsan0:amd64.
    Preparing to unpack .../23-libtsan0_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libtsan0:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libubsan1:amd64.
    Preparing to unpack .../24-libubsan1_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libubsan1:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libquadmath0:amd64.
    Preparing to unpack .../25-libquadmath0_10.3.0-1ubuntu1
    20.04_amd64.deb ...
    Unpacking libquadmath0:amd64 (10.3.0-1ubuntu120.04) ...
    Selecting previously unselected package libgcc-9-dev:amd64.
    Preparing to unpack .../26-libgcc-9-dev_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking libgcc-9-dev:amd64 (9.4.0-1ubuntu120.04.1) ...
    Selecting previously unselected package gcc-9.
    Preparing to unpack .../27-gcc-9_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking gcc-9 (9.4.0-1ubuntu120.04.1) ...
    Selecting previously unselected package gcc.
    Preparing to unpack .../28-gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
    Unpacking gcc (4:9.3.0-1ubuntu2) ...
    Selecting previously unselected package libstdc++-9-dev:amd64.
    Preparing to unpack .../29-libstdc++-9-dev_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking libstdc++-9-dev:amd64 (9.4.0-1ubuntu120.04.1) ...
    Selecting previously unselected package g++-9.
    Preparing to unpack .../30-g++-9_9.4.0-1ubuntu1
    20.04.1_amd64.deb ...
    Unpacking g++-9 (9.4.0-1ubuntu120.04.1) ...
    Selecting previously unselected package g++.
    Preparing to unpack .../31-g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
    Unpacking g++ (4:9.3.0-1ubuntu2) ...
    Selecting previously unselected package make.
    Preparing to unpack .../32-make_4.2.1-1.2_amd64.deb ...
    Unpacking make (4.2.1-1.2) ...
    Preparing to unpack .../33-libdpkg-perl_1.19.7ubuntu3.2_all.deb ...
    Unpacking libdpkg-perl (1.19.7ubuntu3.2) over (1.19.7ubuntu3) ...
    Selecting previously unselected package dpkg-dev.
    Preparing to unpack .../34-dpkg-dev_1.19.7ubuntu3.2_all.deb ...
    Unpacking dpkg-dev (1.19.7ubuntu3.2) ...
    Selecting previously unselected package build-essential.
    Preparing to unpack .../35-build-essential_12.8ubuntu1.1_amd64.deb ...
    Unpacking build-essential (12.8ubuntu1.1) ...
    Selecting previously unselected package libfakeroot:amd64.
    Preparing to unpack .../36-libfakeroot_1.24-1_amd64.deb ...
    Unpacking libfakeroot:amd64 (1.24-1) ...
    Selecting previously unselected package fakeroot.
    Preparing to unpack .../37-fakeroot_1.24-1_amd64.deb ...
    Unpacking fakeroot (1.24-1) ...
    Selecting previously unselected package freeglut3:amd64.
    Preparing to unpack .../38-freeglut3_2.8.1-3_amd64.deb ...
    Unpacking freeglut3:amd64 (2.8.1-3) ...
    Selecting previously unselected package libcroco3:amd64.
    Preparing to unpack .../39-libcroco3_0.6.13-1_amd64.deb ...
    Unpacking libcroco3:amd64 (0.6.13-1) ...
    Selecting previously unselected package gettext.
    Preparing to unpack .../40-gettext_0.19.8.1-10build1_amd64.deb ...
    Unpacking gettext (0.19.8.1-10build1) ...
    Selecting previously unselected package intltool.
    Preparing to unpack .../41-intltool_0.51.0-5ubuntu1_all.deb ...
    Unpacking intltool (0.51.0-5ubuntu1) ...
    Selecting previously unselected package libalgorithm-diff-perl.
    Preparing to unpack .../42-libalgorithm-diff-perl_1.19.03-2_all.deb ...
    Unpacking libalgorithm-diff-perl (1.19.03-2) ...
    Selecting previously unselected package libalgorithm-diff-xs-perl.
    Preparing to unpack .../43-libalgorithm-diff-xs-perl_0.04-6_amd64.deb ...
    Unpacking libalgorithm-diff-xs-perl (0.04-6) ...
    Selecting previously unselected package libalgorithm-merge-perl.
    Preparing to unpack .../44-libalgorithm-merge-perl_0.08-3_all.deb ...
    Unpacking libalgorithm-merge-perl (0.08-3) ...
    Selecting previously unselected package libexpat1-dev:amd64.
    Preparing to unpack .../45-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
    Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
    Selecting previously unselected package libpython3.8-dev:amd64.
    Preparing to unpack .../46-libpython3.8-dev_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking libpython3.8-dev:amd64 (3.8.10-0ubuntu120.04.6) ...
    Selecting previously unselected package libpython3-dev:amd64.
    Preparing to unpack .../47-libpython3-dev_3.8.2-0ubuntu2_amd64.deb ...
    Unpacking libpython3-dev:amd64 (3.8.2-0ubuntu2) ...
    Selecting previously unselected package libpython3.9-stdlib:amd64.
    Preparing to unpack .../48-libpython3.9-stdlib_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking libpython3.9-stdlib:amd64 (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package libpython3.9:amd64.
    Preparing to unpack .../49-libpython3.9_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking libpython3.9:amd64 (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package zlib1g-dev:amd64.
    Preparing to unpack .../50-zlib1g-dev_1%3a1.2.11.dfsg-2ubuntu1.5_amd64.deb ...
    Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu1.5) ...
    Selecting previously unselected package libpython3.9-dev:amd64.
    Preparing to unpack .../51-libpython3.9-dev_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking libpython3.9-dev:amd64 (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package manpages-dev.
    Preparing to unpack .../52-manpages-dev_5.05-1_all.deb ...
    Unpacking manpages-dev (5.05-1) ...
    Selecting previously unselected package nodejs.
    Preparing to unpack .../53-nodejs_16.19.0-deb-1nodesource1_amd64.deb ...
    Unpacking nodejs (16.19.0-deb-1nodesource1) ...
    Selecting previously unselected package python-pkg-resources.
    Preparing to unpack .../54-python-pkg-resources_44.0.0-2_all.deb ...
    Unpacking python-pkg-resources (44.0.0-2) ...
    Selecting previously unselected package python-distutils-extra.
    Preparing to unpack .../55-python-distutils-extra_2.43_all.deb ...
    Unpacking python-distutils-extra (2.43) ...
    Selecting previously unselected package python-pip-whl.
    Preparing to unpack .../56-python-pip-whl_20.0.2-5ubuntu1.6_all.deb ...
    Unpacking python-pip-whl (20.0.2-5ubuntu1.6) ...
    Selecting previously unselected package python3-atomicwrites.
    Preparing to unpack .../57-python3-atomicwrites_1.1.5-2build1_all.deb ...
    Unpacking python3-atomicwrites (1.1.5-2build1) ...
    Selecting previously unselected package python3-attr.
    Preparing to unpack .../58-python3-attr_19.3.0-2_all.deb ...
    Unpacking python3-attr (19.3.0-2) ...
    Selecting previously unselected package python3.8-dev.
    Preparing to unpack .../59-python3.8-dev_3.8.10-0ubuntu1
    20.04.6_amd64.deb ...
    Unpacking python3.8-dev (3.8.10-0ubuntu120.04.6) ...
    Selecting previously unselected package python3-lib2to3.
    Preparing to unpack .../60-python3-lib2to3_3.8.10-0ubuntu1
    20.04_all.deb ...
    Unpacking python3-lib2to3 (3.8.10-0ubuntu120.04) ...
    Selecting previously unselected package python3-distutils.
    Preparing to unpack .../61-python3-distutils_3.8.10-0ubuntu1
    20.04_all.deb ...
    Unpacking python3-distutils (3.8.10-0ubuntu120.04) ...
    Selecting previously unselected package python3-dev.
    Preparing to unpack .../62-python3-dev_3.8.2-0ubuntu2_amd64.deb ...
    Unpacking python3-dev (3.8.2-0ubuntu2) ...
    Selecting previously unselected package python3-more-itertools.
    Preparing to unpack .../63-python3-more-itertools_4.2.0-1build1_all.deb ...
    Unpacking python3-more-itertools (4.2.0-1build1) ...
    Selecting previously unselected package python3-zipp.
    Preparing to unpack .../64-python3-zipp_1.0.0-1_all.deb ...
    Unpacking python3-zipp (1.0.0-1) ...
    Selecting previously unselected package python3-importlib-metadata.
    Preparing to unpack .../65-python3-importlib-metadata_1.5.0-1_all.deb ...
    Unpacking python3-importlib-metadata (1.5.0-1) ...
    Selecting previously unselected package python3-opengl.
    Preparing to unpack .../66-python3-opengl_3.1.0+dfsg-2build1_all.deb ...
    Unpacking python3-opengl (3.1.0+dfsg-2build1) ...
    Selecting previously unselected package python3-pyparsing.
    Preparing to unpack .../67-python3-pyparsing_2.4.6-1_all.deb ...
    Unpacking python3-pyparsing (2.4.6-1) ...
    Selecting previously unselected package python3-packaging.
    Preparing to unpack .../68-python3-packaging_20.3-1_all.deb ...
    Unpacking python3-packaging (20.3-1) ...
    Selecting previously unselected package python3-pluggy.
    Preparing to unpack .../69-python3-pluggy_0.13.0-2_all.deb ...
    Unpacking python3-pluggy (0.13.0-2) ...
    Selecting previously unselected package python3-py.
    Preparing to unpack .../70-python3-py_1.8.1-1ubuntu0.1_all.deb ...
    Unpacking python3-py (1.8.1-1ubuntu0.1) ...
    Selecting previously unselected package python3-wcwidth.
    Preparing to unpack .../71-python3-wcwidth_0.1.8+dfsg1-3_all.deb ...
    Unpacking python3-wcwidth (0.1.8+dfsg1-3) ...
    Selecting previously unselected package python3-pytest.
    Preparing to unpack .../72-python3-pytest_4.6.9-1_all.deb ...
    Unpacking python3-pytest (4.6.9-1) ...
    Selecting previously unselected package python3-setuptools.
    Preparing to unpack .../73-python3-setuptools_45.2.0-1_all.deb ...
    Unpacking python3-setuptools (45.2.0-1) ...
    Preparing to unpack .../74-software-properties-common_0.99.9.8_all.deb ...
    Unpacking software-properties-common (0.99.9.8) over (0.98.9.1) ...
    Preparing to unpack .../75-software-properties-gtk_0.99.9.8_all.deb ...
    Unpacking software-properties-gtk (0.99.9.8) over (0.98.9.1) ...
    Preparing to unpack .../76-python3-software-properties_0.99.9.8_all.deb ...
    Unpacking python3-software-properties (0.99.9.8) over (0.98.9.1) ...
    Selecting previously unselected package python3.9.
    Preparing to unpack .../77-python3.9_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking python3.9 (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package python3.9-dev.
    Preparing to unpack .../78-python3.9-dev_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking python3.9-dev (3.9.5-3ubuntu020.04.1) ...
    Selecting previously unselected package python3.9-venv.
    Preparing to unpack .../79-python3.9-venv_3.9.5-3ubuntu0
    20.04.1_amd64.deb ...
    Unpacking python3.9-venv (3.9.5-3ubuntu020.04.1) ...
    Setting up libexpat1:amd64 (2.2.9-1ubuntu0.6) ...
    Setting up python3-more-itertools (4.2.0-1build1) ...
    Setting up python3-attr (19.3.0-2) ...
    Setting up manpages-dev (5.05-1) ...
    Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1
    20.04.6) ...
    Setting up freeglut3:amd64 (2.8.1-3) ...
    Setting up apt-transport-https (2.0.9) ...
    Setting up python3-py (1.8.1-1ubuntu0.1) ...
    Setting up libalgorithm-diff-perl (1.19.03-2) ...
    Setting up libpython3.9-minimal:amd64 (3.9.5-3ubuntu020.04.1) ...
    Setting up binutils-common:amd64 (2.34-6ubuntu1.4) ...
    Setting up linux-libc-dev:amd64 (5.4.0-135.152) ...
    Setting up libctf-nobfd0:amd64 (2.34-6ubuntu1.4) ...
    Setting up python3-zipp (1.0.0-1) ...
    Setting up python3-opengl (3.1.0+dfsg-2build1) ...
    Setting up libgomp1:amd64 (10.3.0-1ubuntu1
    20.04) ...
    Setting up libfakeroot:amd64 (1.24-1) ...
    Setting up libc6-dbg:amd64 (2.31-0ubuntu9.9) ...
    Setting up python3-atomicwrites (1.1.5-2build1) ...
    Setting up libpython2.7-stdlib:amd64 (2.7.18-120.04.3) ...
    Setting up fakeroot (1.24-1) ...
    update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
    Setting up ca-certificates (20211016ubuntu0.20.04.1) ...
    Updating certificates in /etc/ssl/certs...
    rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
    28 added, 31 removed; done.
    Setting up autotools-dev (20180224.1) ...
    Setting up python3-wcwidth (0.1.8+dfsg1-3) ...
    Setting up python3-pyparsing (2.4.6-1) ...
    Setting up make (4.2.1-1.2) ...
    Setting up gnupg-l10n (2.2.19-3ubuntu2.2) ...
    Setting up libsigsegv2:amd64 (2.12-2) ...
    Setting up libquadmath0:amd64 (10.3.0-1ubuntu1
    20.04) ...
    Setting up libatomic1:amd64 (10.3.0-1ubuntu120.04) ...
    Setting up libcroco3:amd64 (0.6.13-1) ...
    Setting up libdpkg-perl (1.19.7ubuntu3.2) ...
    Setting up libubsan1:amd64 (10.3.0-1ubuntu1
    20.04) ...
    Setting up python3.8-minimal (3.8.10-0ubuntu120.04.6) ...
    Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
    Setting up gpgconf (2.2.19-3ubuntu2.2) ...
    Setting up python-pip-whl (20.0.2-5ubuntu1.6) ...
    Setting up python3.9-minimal (3.9.5-3ubuntu0
    20.04.1) ...
    Setting up libbinutils:amd64 (2.34-6ubuntu1.4) ...
    Setting up libpython3.8-stdlib:amd64 (3.8.10-0ubuntu120.04.6) ...
    Setting up libc-dev-bin (2.31-0ubuntu9.9) ...
    Setting up python3.8 (3.8.10-0ubuntu1
    20.04.6) ...
    Setting up python3-lib2to3 (3.8.10-0ubuntu120.04) ...
    Setting up libalgorithm-diff-xs-perl (0.04-6) ...
    Setting up libcc1-0:amd64 (10.3.0-1ubuntu1
    20.04) ...
    Setting up gpg (2.2.19-3ubuntu2.2) ...
    Setting up liblsan0:amd64 (10.3.0-1ubuntu120.04) ...
    Setting up libitm1:amd64 (10.3.0-1ubuntu1
    20.04) ...
    Setting up libpython3.9-stdlib:amd64 (3.9.5-3ubuntu020.04.1) ...
    Setting up gcc-9-base:amd64 (9.4.0-1ubuntu1
    20.04.1) ...
    Setting up libalgorithm-merge-perl (0.08-3) ...
    Setting up gnupg-utils (2.2.19-3ubuntu2.2) ...
    Setting up libtsan0:amd64 (10.3.0-1ubuntu120.04) ...
    Setting up libctf0:amd64 (2.34-6ubuntu1.4) ...
    Setting up python3-distutils (3.8.10-0ubuntu1
    20.04) ...
    Setting up gettext (0.19.8.1-10build1) ...
    Setting up gpg-agent (2.2.19-3ubuntu2.2) ...
    Setting up python3-importlib-metadata (1.5.0-1) ...
    Setting up python3-setuptools (45.2.0-1) ...
    Setting up python2.7 (2.7.18-120.04.3) ...
    Setting up libpython2-stdlib:amd64 (2.7.17-2ubuntu4) ...
    Setting up gpgsm (2.2.19-3ubuntu2.2) ...
    Setting up m4 (1.4.18-4) ...
    Setting up nodejs (16.19.0-deb-1nodesource1) ...
    Setting up python2 (2.7.17-2ubuntu4) ...
    Setting up dirmngr (2.2.19-3ubuntu2.2) ...
    Setting up libasan5:amd64 (9.4.0-1ubuntu1
    20.04.1) ...
    Setting up python3-packaging (20.3-1) ...
    Setting up libpython3.9:amd64 (3.9.5-3ubuntu020.04.1) ...
    Setting up python3-software-properties (0.99.9.8) ...
    Setting up libpython3.8:amd64 (3.8.10-0ubuntu1
    20.04.6) ...
    Setting up autoconf (2.69-11.1) ...
    Setting up python3-pluggy (0.13.0-2) ...
    Setting up gpg-wks-server (2.2.19-3ubuntu2.2) ...
    Setting up cpp-9 (9.4.0-1ubuntu120.04.1) ...
    Setting up libc6-dev:amd64 (2.31-0ubuntu9.9) ...
    Setting up python3.9 (3.9.5-3ubuntu0
    20.04.1) ...
    Setting up binutils-x86-64-linux-gnu (2.34-6ubuntu1.4) ...
    Setting up automake (1:1.16.1-4ubuntu6) ...
    update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode
    Setting up gpg-wks-client (2.2.19-3ubuntu2.2) ...
    Setting up python-pkg-resources (44.0.0-2) ...
    Setting up python3-pytest (4.6.9-1) ...
    Setting up binutils (2.34-6ubuntu1.4) ...
    Setting up software-properties-common (0.99.9.8) ...
    Setting up dpkg-dev (1.19.7ubuntu3.2) ...
    Setting up libgcc-9-dev:amd64 (9.4.0-1ubuntu120.04.1) ...
    Setting up libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
    Setting up libpython3.8-dev:amd64 (3.8.10-0ubuntu1
    20.04.6) ...
    Setting up intltool (0.51.0-5ubuntu1) ...
    Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu1.5) ...
    Setting up gnupg (2.2.19-3ubuntu2.2) ...
    Setting up python3.9-venv (3.9.5-3ubuntu020.04.1) ...
    Setting up python-distutils-extra (2.43) ...
    Setting up gcc-9 (9.4.0-1ubuntu1
    20.04.1) ...
    Setting up libpython3-dev:amd64 (3.8.2-0ubuntu2) ...
    Setting up libstdc++-9-dev:amd64 (9.4.0-1ubuntu120.04.1) ...
    Setting up software-properties-gtk (0.99.9.8) ...
    Setting up libpython3.9-dev:amd64 (3.9.5-3ubuntu0
    20.04.1) ...
    Setting up gcc (4:9.3.0-1ubuntu2) ...
    Setting up g++-9 (9.4.0-1ubuntu120.04.1) ...
    Setting up python3.8-dev (3.8.10-0ubuntu1
    20.04.6) ...
    Setting up g++ (4:9.3.0-1ubuntu2) ...
    update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
    Setting up python3.9-dev (3.9.5-3ubuntu020.04.1) ...
    Setting up build-essential (12.8ubuntu1.1) ...
    Setting up python3-dev (3.8.2-0ubuntu2) ...
    Processing triggers for install-info (6.7.0.dfsg.2-5) ...
    Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
    Processing triggers for mime-support (3.64ubuntu1) ...
    Processing triggers for hicolor-icon-theme (0.17-2) ...
    Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
    Processing triggers for libglib2.0-0:amd64 (2.64.3-1
    ubuntu20.04.1) ...
    Processing triggers for libc-bin (2.31-0ubuntu9) ...
    Processing triggers for man-db (2.9.1-1) ...
    Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
    Processing triggers for shared-mime-info (1.15-1) ...
    Processing triggers for ca-certificates (20211016ubuntu0.20.04.1) ...
    Updating certificates in /etc/ssl/certs...
    0 added, 0 removed; done.
    Running hooks in /etc/ca-certificates/update.d...
    done.
  • sudo -E npm install -g --unsafe-perm=true --allow-root npm

removed 14 packages, changed 75 packages, and audited 232 packages in 6s

14 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

  • sudo -E update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2
    update-alternatives: using /usr/bin/python3.9 to provide /usr/bin/python (python) in auto mode
  • sudo -E update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
    update-alternatives: using /usr/bin/python3.9 to provide /usr/bin/python3 (python3) in auto mode
  • sudo -E update-alternatives --set python /usr/bin/python3.9
  • sudo -E update-alternatives --set python3 /usr/bin/python3.9
  • update-alternatives --query python
    Name: python
    Link: /usr/bin/python
    Status: manual
    Best: /usr/bin/python3.9
    Value: /usr/bin/python3.9

Alternative: /usr/bin/python3.9
Priority: 2

  • export PATH=/usr/bin:/home/xzh/.conda/envs/CBS/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • PATH=/usr/bin:/home/xzh/.conda/envs/CBS/bin:/opt/miniconda3/condabin:/opt/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • ./pyright.sh --version
    Checking node version...
    Checking node_modules dir...
    Checking pyright exists...
    ...installing pyright

added 1 package in 6s
done.
pyright 1.1.271

  • ./install-orca.sh
    Installing the Plotly orca dependency for plotly figure export
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

The following packages have unmet dependencies:
npm : Depends: nodejs (>= 6.11~)
Depends: node-abbrev (>= 1.1.1~) but it is not going to be installed
Depends: node-ajv but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-ansi-regex (>= 3.0~) but it is not going to be installed
Depends: node-ansi-styles but it is not going to be installed
Depends: node-ansistyles but it is not going to be installed
Depends: node-aproba but it is not going to be installed
Depends: node-archy (>= 1.0~) but it is not going to be installed
Depends: node-are-we-there-yet but it is not going to be installed
Depends: node-asap but it is not going to be installed
Depends: node-asn1 but it is not going to be installed
Depends: node-assert-plus but it is not going to be installed
Depends: node-asynckit but it is not going to be installed
Depends: node-aws4 but it is not going to be installed
Depends: node-aws-sign2 but it is not going to be installed
Depends: node-balanced-match but it is not going to be installed
Depends: node-bcrypt-pbkdf but it is not going to be installed
Depends: node-bl but it is not going to be installed
Depends: node-bluebird but it is not going to be installed
Depends: node-boxen but it is not going to be installed
Depends: node-brace-expansion but it is not going to be installed
Depends: node-builtin-modules but it is not going to be installed
Depends: node-builtins but it is not going to be installed
Depends: node-cacache but it is not going to be installed
Depends: node-call-limit but it is not going to be installed
Depends: node-camelcase but it is not going to be installed
Depends: node-caseless but it is not going to be installed
Depends: node-chalk but it is not going to be installed
Depends: node-chownr but it is not going to be installed
Depends: node-ci-info but it is not going to be installed
Depends: node-cli-boxes but it is not going to be installed
Depends: node-cliui but it is not going to be installed
Depends: node-clone but it is not going to be installed
Depends: node-co but it is not going to be installed
Depends: node-color-convert but it is not going to be installed
Depends: node-color-name but it is not going to be installed
Depends: node-colors but it is not going to be installed
Depends: node-columnify but it is not going to be installed
Depends: node-combined-stream but it is not going to be installed
Depends: node-concat-map but it is not going to be installed
Depends: node-concat-stream but it is not going to be installed
Depends: node-config-chain but it is not going to be installed
Depends: node-configstore but it is not going to be installed
Depends: node-console-control-strings but it is not going to be installed
Depends: node-copy-concurrently but it is not going to be installed
Depends: node-core-util-is but it is not going to be installed
Depends: node-cross-spawn but it is not going to be installed
Depends: node-crypto-random-string but it is not going to be installed
Depends: node-cyclist but it is not going to be installed
Depends: node-dashdash but it is not going to be installed
Depends: node-debug but it is not going to be installed
Depends: node-decamelize but it is not going to be installed
Depends: node-deep-extend but it is not going to be installed
Depends: node-defaults but it is not going to be installed
Depends: node-define-properties but it is not going to be installed
Depends: node-delayed-stream but it is not going to be installed
Depends: node-delegates but it is not going to be installed
Depends: node-detect-indent but it is not going to be installed
Depends: node-detect-newline but it is not going to be installed
Depends: node-dot-prop but it is not going to be installed
Depends: node-duplexer3 but it is not going to be installed
Depends: node-duplexify but it is not going to be installed
Depends: node-ecc-jsbn but it is not going to be installed
Depends: node-editor but it is not going to be installed
Depends: node-encoding but it is not going to be installed
Depends: node-end-of-stream but it is not going to be installed
Depends: node-err-code but it is not going to be installed
Depends: node-errno but it is not going to be installed
Depends: node-es6-promise but it is not going to be installed
Depends: node-escape-string-regexp but it is not going to be installed
Depends: node-execa but it is not going to be installed
Depends: node-extend but it is not going to be installed
Depends: node-extsprintf but it is not going to be installed
Depends: node-fast-deep-equal but it is not going to be installed
Depends: node-find-up but it is not going to be installed
Depends: node-flush-write-stream but it is not going to be installed
Depends: node-forever-agent but it is not going to be installed
Depends: node-form-data but it is not going to be installed
Depends: node-from2 but it is not going to be installed
Depends: node-fs.realpath but it is not going to be installed
Depends: node-fs-vacuum but it is not going to be installed
Depends: node-fs-write-stream-atomic but it is not going to be installed
Depends: node-function-bind but it is not going to be installed
Depends: node-gauge but it is not going to be installed
Depends: node-genfun but it is not going to be installed
Depends: node-get-caller-file but it is not going to be installed
Depends: node-getpass but it is not going to be installed
Depends: node-glob (>= 7.1.2~) but it is not going to be installed
Depends: node-got but it is not going to be installed
Depends: node-graceful-fs (>= 4.1.11~) but it is not going to be installed
Depends: node-gyp (>= 3.6.2~) but it is not going to be installed
Depends: node-har-schema but it is not going to be installed
Depends: node-har-validator but it is not going to be installed
Depends: node-has-flag but it is not going to be installed
Depends: node-has-unicode but it is not going to be installed
Depends: node-hosted-git-info (>= 2.6~) but it is not going to be installed
Depends: node-http-signature but it is not going to be installed
Depends: node-iconv-lite but it is not going to be installed
Depends: node-iferr but it is not going to be installed
Depends: node-import-lazy but it is not going to be installed
Depends: node-imurmurhash but it is not going to be installed
Depends: node-inflight but it is not going to be installed
Depends: node-inherits (>= 2.0.3~) but it is not going to be installed
Depends: node-ini (>= 1.3.5~) but it is not going to be installed
Depends: node-invert-kv but it is not going to be installed
Depends: node-ip but it is not going to be installed
Depends: node-ip-regex but it is not going to be installed
Depends: node-isarray but it is not going to be installed
Depends: node-isexe but it is not going to be installed
Depends: node-is-npm but it is not going to be installed
Depends: node-is-obj but it is not going to be installed
Depends: node-is-path-inside but it is not going to be installed
Depends: node-is-retry-allowed but it is not going to be installed
Depends: node-is-stream but it is not going to be installed
Depends: node-isstream but it is not going to be installed
Depends: node-is-typedarray but it is not going to be installed
Depends: node-jsbn but it is not going to be installed
Depends: node-jsonparse but it is not going to be installed
Depends: node-json-parse-better-errors but it is not going to be installed
Depends: node-json-schema but it is not going to be installed
Depends: node-json-schema-traverse but it is not going to be installed
Depends: node-jsonstream (>= 1.3.2~) but it is not going to be installed
Depends: node-json-stringify-safe but it is not going to be installed
Depends: node-jsprim but it is not going to be installed
Depends: node-latest-version but it is not going to be installed
Depends: node-lazy-property but it is not going to be installed
Depends: node-lcid but it is not going to be installed
Depends: node-libnpx but it is not going to be installed
Depends: node-locate-path but it is not going to be installed
Depends: node-lodash but it is not going to be installed
Depends: node-lockfile (>= 1.0.3~) but it is not going to be installed
Depends: node-lowercase-keys but it is not going to be installed
Depends: node-lru-cache (>= 4.1.1~) but it is not going to be installed
Depends: node-make-dir but it is not going to be installed
Depends: node-mem but it is not going to be installed
Depends: node-mime but it is not going to be installed
Depends: node-mime-types but it is not going to be installed
Depends: node-mimic-fn but it is not going to be installed
Depends: node-minimatch but it is not going to be installed
Depends: node-minimist but it is not going to be installed
Depends: node-mississippi but it is not going to be installed
Depends: node-mkdirp (>= 0.5.1~) but it is not going to be installed
Depends: node-move-concurrently but it is not going to be installed
Depends: node-ms but it is not going to be installed
Depends: node-mute-stream but it is not going to be installed
Depends: node-nopt but it is not going to be installed
Depends: node-normalize-package-data (>= 2.4~) but it is not going to be installed
Depends: node-npm-bundled but it is not going to be installed
Depends: node-npm-package-arg (>= 6.1.1) but it is not going to be installed
Depends: node-npmlog (>= 4.1.2~) but it is not going to be installed
Depends: node-number-is-nan but it is not going to be installed
Depends: node-oauth-sign but it is not going to be installed
Depends: node-object-assign but it is not going to be installed
Depends: node-once (>= 1.4~) but it is not going to be installed
Depends: node-opener but it is not going to be installed
Depends: node-osenv (>= 0.1.5~) but it is not going to be installed
Depends: node-os-locale but it is not going to be installed
Depends: node-os-tmpdir but it is not going to be installed
Depends: node-package-json but it is not going to be installed
Depends: node-parallel-transform but it is not going to be installed
Depends: node-path-exists but it is not going to be installed
Depends: node-path-is-absolute but it is not going to be installed
Depends: node-path-is-inside but it is not going to be installed
Depends: node-promise-inflight but it is not going to be installed
Depends: node-promise-retry but it is not going to be installed
Depends: node-promzard but it is not going to be installed
Depends: node-performance-now but it is not going to be installed
Depends: node-p-finally but it is not going to be installed
Depends: node-p-is-promise but it is not going to be installed
Depends: node-pify but it is not going to be installed
Depends: node-p-limit but it is not going to be installed
Depends: node-p-locate but it is not going to be installed
Depends: node-prepend-http but it is not going to be installed
Depends: node-process-nextick-args but it is not going to be installed
Depends: node-proto-list but it is not going to be installed
Depends: node-prr but it is not going to be installed
Depends: node-pseudomap but it is not going to be installed
Depends: node-psl but it is not going to be installed
Depends: node-pump but it is not going to be installed
Depends: node-pumpify but it is not going to be installed
Depends: node-punycode but it is not going to be installed
Depends: node-qs but it is not going to be installed
Depends: node-qw but it is not going to be installed
Depends: node-rc but it is not going to be installed
Depends: node-read (>= 1.0.7~) but it is not going to be installed
Depends: node-readable-stream but it is not going to be installed
Depends: node-read-package-json (>= 2.0.13~) but it is not going to be installed
Depends: node-registry-auth-token but it is not going to be installed
Depends: node-registry-url but it is not going to be installed
Depends: node-request (>= 2.83~) but it is not going to be installed
Depends: node-require-main-filename but it is not going to be installed
Depends: node-require-directory but it is not going to be installed
Depends: node-resolve-from (>= 4.0~) but it is not going to be installed
Depends: node-retry (>= 0.10.1~) but it is not going to be installed
Depends: node-rimraf (>= 2.6.2~) but it is not going to be installed
Depends: node-run-queue but it is not going to be installed
Depends: node-safe-buffer but it is not going to be installed
Depends: node-semver (>= 5.5~) but it is not going to be installed
Depends: node-set-blocking but it is not going to be installed
Depends: node-sha (>= 2.0.1~) but it is not going to be installed
Depends: node-shebang-command but it is not going to be installed
Depends: node-shebang-regex but it is not going to be installed
Depends: node-signal-exit but it is not going to be installed
Depends: node-slide (>= 1.1.6~) but it is not going to be installed
Depends: node-sorted-object but it is not going to be installed
Depends: node-slash but it is not going to be installed
Depends: node-semver-diff but it is not going to be installed
Depends: node-spdx-correct but it is not going to be installed
Depends: node-spdx-exceptions but it is not going to be installed
Depends: node-spdx-expression-parse but it is not going to be installed
Depends: node-spdx-license-ids but it is not going to be installed
Depends: node-sshpk but it is not going to be installed
Depends: node-ssri but it is not going to be installed
Depends: node-stream-each but it is not going to be installed
Depends: node-stream-iterate but it is not going to be installed
Depends: node-stream-shift but it is not going to be installed
Depends: node-strict-uri-encode but it is not going to be installed
Depends: node-string-decoder but it is not going to be installed
Depends: node-string-width but it is not going to be installed
Depends: node-strip-ansi (>= 4.0~) but it is not going to be installed
Depends: node-strip-json-comments but it is not going to be installed
Depends: node-strip-eof but it is not going to be installed
Depends: node-supports-color but it is not going to be installed
Depends: node-tar (>= 4.4~) but it is not going to be installed
Depends: node-term-size but it is not going to be installed
Depends: node-text-table but it is not going to be installed
Depends: node-through but it is not going to be installed
Depends: node-through2 but it is not going to be installed
Depends: node-timed-out but it is not going to be installed
Depends: node-tough-cookie but it is not going to be installed
Depends: node-tunnel-agent but it is not going to be installed
Depends: node-tweetnacl but it is not going to be installed
Depends: node-typedarray but it is not going to be installed
Depends: node-uid-number but it is not going to be installed
Depends: node-unique-filename but it is not going to be installed
Depends: node-unique-string but it is not going to be installed
Depends: node-unpipe but it is not going to be installed
Depends: node-url-parse-lax but it is not going to be installed
Depends: node-util-deprecate but it is not going to be installed
Depends: node-uuid but it is not going to be installed
Depends: node-validate-npm-package-name but it is not going to be installed
Depends: node-verror but it is not going to be installed
Depends: node-which (>= 1.3~) but it is not going to be installed
Depends: node-which-module but it is not going to be installed
Depends: node-wide-align but it is not going to be installed
Depends: node-widest-line but it is not going to be installed
Depends: node-wrap-ansi but it is not going to be installed
Depends: node-wrappy but it is not going to be installed
Depends: node-wcwidth.js but it is not going to be installed
Depends: node-write-file-atomic but it is not going to be installed
Depends: node-xdg-basedir but it is not going to be installed
Depends: node-xtend but it is not going to be installed
Depends: node-yargs but it is not going to be installed
Depends: node-yargs-parser but it is not going to be installed
Depends: node-yallist but it is not going to be installed
Depends: node-y18n but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
npm WARN deprecated [email protected]: use String.prototype.padStart()
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: Please use @electron/get moving forward.
npm ERR! code EEXIST
npm ERR! path /usr/bin/orca
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/bin/orca
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/xzh/.npm/_logs/2022-12-21T12_39_06_767Z-debug-0.log
(CBS) xzh@xzh-virtual-machine:~/Desktop/CyberBattleSim$ npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR! /home/xzh/.npm/_logs/2022-12-21T12_40_17_566Z-debug-0.log

Regression: node incorrectly intepreted as previously owned

The following call to __is_node_owned_history has the unfortunate side effect of updating the field containing the time of last ownership for the node. Subsequently this causes the reward calculation code to interpret the node as already owned, thus stealing future rewards deserved for the attacker when actually taking ownership of the node:

was_previously_owned_at, is_currently_owned = self.__is_node_owned_history(node_id, node_info)

ModuleNotFoundError: No module named 'cyberbattle.agents.baseline'

ran init.sh but I'm getting the following error:

File "app.py", line 6, in <module> import cyberbattle.simulation.model as model File "<frozen zipimport>", line 259, in load_module File "/usr/local/lib/python3.8/dist-packages/loonshot_sim-0.1-py3.8.egg/cyberbattle/__init__.py", line 9, in <module> File "<frozen zipimport>", line 259, in load_module File "/usr/local/lib/python3.8/dist-packages/loonshot_sim-0.1-py3.8.egg/cyberbattle/agents/__init__.py", line 9, in <module> ModuleNotFoundError: No module named 'cyberbattle.agents.baseline'

I'm running on Ubuntu 18.04, not sure what's going on or what I should do.

Issues with random graph

Hi, I am working on generating the random graph and I found some logical issues with the random graph generation design (maybe).

  1. First, I think the add_leak_neighbors_vulnerability function in generate_network.py should not return library directly. Since it is a global dictionary, using it to assign the vulnerability will make all nodes share the same vulnerability outcomes which is not reasonable. It can be fixed by return return copy.deepcopy(library)
  2. Here the nodes except the entry node are iteratively assigned with vulnerabilities and services. However, some nodes may be assigned empty services before their corresponding access passwords are generated in the assigned_passwords. I fix this issue simply by repeating the loop.

I am not familiar with network attacks, so would it be convenient for you to check whether the editions are right? Thx a lot.

How To Run

Hello,

I want to experiment with your CyberBattleSim, but I do not understand how to run the code. I followed the steps outlined on the GitHub page but could not get the program to run. Can you provide a detailed explanation of how I can run this code in WSL or a python IDE, such as PyCharm, or if possible both, in a tutorial or documentation that clearly explains how to run the program?

I would greatly appreciate the help.
Thank you

Consider designing defender as RL agent

I'm curious if this project will follow up by designing defender as an agent that can be trained with reinforcement learning algorithms and how we will achieve this based on the existing environment? Thanks in advance.

A question about 'pretty_print_internal_action'

Hi,

When I try to use the member function 'pretty_print_internal_action' of CyberBattleEnv, I found that the return for 'connect' action is always "connect(invalid)", even when I use member function 'sample_valid_action' to get a valid 'connect' action. So I check the code and found the following paragraph:

elif "connect" in action:
    source_node, target_node, port_index, credential_cache_index = action["connect"]
    assert credential_cache_index >= 0
    if credential_cache_index < len(self.__credential_cache):
        return "connect(invalid)"
    source_node_id = self.__internal_node_id_from_external_node_index(source_node)
    target_node_id = self.__internal_node_id_from_external_node_index(target_node)
    return f"connect(`{source_node_id}, `{target_node_id}, {self.__index_to_port_name(port_index)}, {self.__credential_cache[credential_cache_index].credential})"

Is there an error in line 5? I suppose the '<' sign shoud be changed to '>=', which seems to be correct in terms of results.

# before
if credential_cache_index < len(self.__credential_cache):
# after
if credential_cache_index >= len(self.__credential_cache):

Hope this helps

convert NamedTuples to @dataclass

Hi, I'm creating a frontend wrapper for this project and noticed that NamedTuple and @dataclasses are used almost interchangeably in model.py. I was wondering why that's the case and if it would be possible to just change all NamedTuples to @dataclasses. This would make the model more consistent. I tried changing it for a couple classes and didn't notice anything breaking.

Making reward non-zero, what is the reason?

Checking the code and why there is no negative reward due to penalties or repetition I have noticed, that code reward = max(0., reward) makes it always non-zero here.

What was the reason to make all rewards non-zero?

Error Running Notebooks `NetworkXError: random_state_index is incorrect`

This applies to several notebooks but using randomnetwork.ipynb as the example

Running the first two cells results in a couple of errors.

Cell contents

traffic = g.generate_random_traffic_network(
    seed=1, n_clients=50, 
    n_servers={
                "SMB": 15,
                "HTTP": 15,
                "RDP": 15,
            },
    alpha=np.array([(1, 1), (0.2, 0.5)], dtype=float),
    beta=np.array([(1000, 10), (10, 100)], dtype=float),
)

Ouptut from Cell

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/networkx/utils/decorators.py in _random_state(func, *args, **kwargs)
    451         try:
--> 452             random_state_arg = args[random_state_index]
    453         except TypeError:

IndexError: tuple index out of range

During handling of the above exception, another exception occurred:

NetworkXError                             Traceback (most recent call last)
<ipython-input-2-d4d566484044> in <module>
----> 1 traffic = g.generate_random_traffic_network(
      2     seed=1, n_clients=50,
      3     n_servers={
      4                 "SMB": 15,
      5                 "HTTP": 15,

/opt/CyberBattleSim/cyberbattle/simulation/generate_network.py in generate_random_traffic_network(n_clients, n_servers, seed, tolerance, alpha, beta)
     72 
     73         # sample edges using block models given edge probabilities
---> 74         di_graph_for_protocol = nx.stochastic_block_model(
     75             sizes=sizes, p=probs, directed=True, seed=seed)
     76 

/usr/local/lib/python3.8/dist-packages/decorator.py in fun(*args, **kw)
    229             if not kwsyntax:
    230                 args, kw = fix(args, kw, sig)
--> 231             return caller(func, *(extras + args), **kw)
    232     fun.__name__ = func.__name__
    233     fun.__doc__ = func.__doc__

/usr/local/lib/python3.8/dist-packages/networkx/utils/decorators.py in _random_state(func, *args, **kwargs)
    454             raise nx.NetworkXError("random_state_index must be an integer")
    455         except IndexError:
--> 456             raise nx.NetworkXError("random_state_index is incorrect")
    457 
    458         # Create a numpy.random.RandomState instance

NetworkXError: random_state_index is incorrect

torch cuda=false

When I use this command:‘python cyberbattle/agents/baseline/run.py --training_episode_count 1 --eval_episode_count 1 --iteration_count 10 --rewardplot_with 80 --chain_size=20 --ownership_goal 1.0’

I actually get the result. It shows the number of 'explore-local', 'explore-remote' and so on. Only difference is that it shows that torch cuda avaliable=False. Is that neccessary? Will it lead to some problems in future research of using cyberbattlesim?
My result is below.

`torch cuda available=False

DQL

Learning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10

Episode: 1/1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,

batch=512, target_update=10
Episode 1|Iteration 10|reward: 94.0|Elapsed Time: 0:00:00|##########################################################|
Episode 1 stopped at t=10
Breakdown [Reward/NoReward (Success rate)]
explore-local: 1/1 (0.50)
explore-remote: 1/6 (0.14)
explore-connect: 0/1 (0.00)
exploit-local: 0/0 (NaN)
exploit-remote: 0/0 (NaN)
exploit-connect: 0/0 (NaN)
exploit deflected to exploration: 3
simulation ended

Random search

Learning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0,

Episode: 1/1 'Random search' ϵ=1.0000,

Episode 1|Iteration 10|reward: 139.0|Elapsed Time: 0:00:00|##########################################################|
Episode 1 stopped at t=10
Breakdown [Reward/NoReward (Success rate)]
explore-local: 1/0 (1.00)
explore-remote: 2/5 (0.29)
explore-connect: 0/2 (0.00)
exploit-local: 0/0 (NaN)
exploit-remote: 0/0 (NaN)
exploit-connect: 0/0 (NaN)
exploit deflected to exploration: 0
simulation ended
Episode duration -- DQN=Red, Random=Green
10.00 ┼
Cumulative rewards -- DQN=Red, Random=Green
/home/fei/.local/lib/python3.8/site-packages/numpy/lib/function_base.py:380: RuntimeWarning: Mean of empty slice.
avg = a.mean(axis)
/home/fei/.local/lib/python3.8/site-packages/numpy/core/_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
139.00 ┼ ╭╴
125.10 ┤ │
111.20 ┤ │
97.30 ┤ ╭───╭╯╴
83.40 ┤ │ │
69.50 ┤ │ │
55.60 ┤ ╭─╭───╯
41.70 ┤ │ │
27.80 ┤ │ │
13.90 ┤ │ │
0.00 ┼───╯
`

Jupyter notebook run issue from docker container

Hi all,

I have encountered issue when running jupyter notebook inside docker container. While forwarding the port from docker container, I still cannot connect to it from browser. It does not work both on local machine and remote server I use.

Sample command is:

git clone https://github.com/microsoft/CyberBattleSim.git
cd CyberBattleSim
nvidia-docker build -t cyberbattle:1.1 .
nvidia-docker run -p 6789:8888 -it --name cyber_test cyberbattle:1.1 /bin/bash -c "jupyter notebook --no-browser --allow-root --port=8888"

[browser] localhost:6789
[Error] "Hmmm… can't reach this page\n Localhost refused to connect.

Cannot run c2_interactive_interface.ipynb

When running the second code block of notebooks/c2_interactive_interface.ipynb, I am getting the following traceback:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-0094a0a41ada> in <module>
      1 g = nx.erdos_renyi_graph(35,0.05,directed=True)
      2 g = model.assign_random_labels(g)
----> 3 env = model.Environment(network=g, vulnerability_library=dict([]))

TypeError: __new__() missing 1 required positional argument: 'identifiers'

I was able to fix this by adding some sample identifiers:

SAMPLE_IDENTIFIERS = Identifiers(
    ports=['RDP', 'SSH', 'SMB', 'HTTP', 'HTTPS', 'WMI', 'SQL'],
    properties=[
        'Windows', 'Linux', 'HyperV-VM', 'Azure-VM', 'Win7', 'Win10',
        'PortRDPOpen', 'GuestAccountEnabled']
)
env = model.Environment(network=g, vulnerability_library=dict([]), identifiers=SAMPLE_IDENTIFIERS)

However, when I run the code block: "outcome = c.run_attack(starting_node, 'RecentlyAccessedMachines')"

I am getting the following traceback:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-7735b8f3df39> in <module>
----> 1 outcome = c.run_attack(starting_node, 'RecentlyAccessedMachines')
      2 outcome

~/ms/CyberBattleSim/cyberbattle/simulation/commandcontrol.py in run_attack(self, node_id, vulnerability_id)
    108                    ) -> Optional[model.VulnerabilityOutcome]:
    109         """Run an attack and attempt to exploit a vulnerability on the specified node."""
--> 110         result = self._actuator.exploit_local_vulnerability(node_id, vulnerability_id)
    111         if result.outcome is not None:
    112             self.__save_credentials(result.outcome)

~/ms/CyberBattleSim/cyberbattle/simulation/actions.py in exploit_local_vulnerability(self, node_id, vulnerability_id)
    376             raise ValueError(f"Agent does not owned the node '{node_id}'")
    377 
--> 378         succeeded, result = self.__process_outcome(
    379             model.VulnerabilityType.LOCAL,
    380             vulnerability_id,

~/ms/CyberBattleSim/cyberbattle/simulation/actions.py in __process_outcome(self, expected_type, vulnerability_id, node_id, node_info, local_or_remote, failed_penalty, throw_if_vulnerability_not_present)
    265         else:
    266             if throw_if_vulnerability_not_present:
--> 267                 raise ValueError(f"Vulnerability '{vulnerability_id}' not supported by node='{node_id}'")
    268             else:
    269                 logger.info(f"Vulnerability '{vulnerability_id}' not supported by node '{node_id}'")

ValueError: Vulnerability 'RecentlyAccessedMachines' not supported by node='8'

And now I'm not so sure how to fix this

NPM Depends Errors & RuntimeWarning: Mean of empty slice.

Using Ubuntu 20.04.2 LTS on AWS

Linux ip-172-31-9-167 5.4.0-1038-aws #40-Ubuntu SMP Fri Feb 5 23:50:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Running ./init.sh -n to use a global install.

there are a lot of NPM errors during the installation

pyright 1.1.130
Installing the Plotly orca dependency for plotly figure export
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 npm : Depends: nodejs (>= 6.11~)
       Depends: node-abbrev (>= 1.1.1~) but it is not going to be installed
       Depends: node-ajv but it is not going to be installed
       Depends: node-ansi but it is not going to be installed
       Depends: node-ansi-regex (>= 3.0~) but it is not going to be installed
       Depends: node-ansi-styles but it is not going to be installed
       Depends: node-ansistyles but it is not going to be installed
       Depends: node-aproba but it is not going to be installed
       Depends: node-archy (>= 1.0~) but it is not going to be installed
       Depends: node-are-we-there-yet but it is not going to be installed
       Depends: node-asap but it is not going to be installed
       Depends: node-asn1 but it is not going to be installed
       Depends: node-assert-plus but it is not going to be installed
       Depends: node-asynckit but it is not going to be installed
       Depends: node-aws4 but it is not going to be installed
       Depends: node-aws-sign2 but it is not going to be installed
       Depends: node-balanced-match but it is not going to be installed
       Depends: node-bcrypt-pbkdf but it is not going to be installed
       Depends: node-bl but it is not going to be installed
       Depends: node-bluebird but it is not going to be installed
       Depends: node-boxen but it is not going to be installed
       Depends: node-brace-expansion but it is not going to be installed
       Depends: node-builtin-modules but it is not going to be installed
       Depends: node-builtins but it is not going to be installed
       Depends: node-cacache but it is not going to be installed
       Depends: node-call-limit but it is not going to be installed
       Depends: node-camelcase but it is not going to be installed
       Depends: node-caseless but it is not going to be installed
       Depends: node-chalk but it is not going to be installed
       Depends: node-chownr but it is not going to be installed
       Depends: node-ci-info but it is not going to be installed
       Depends: node-cli-boxes but it is not going to be installed
       Depends: node-cliui but it is not going to be installed
       Depends: node-clone but it is not going to be installed
       Depends: node-co but it is not going to be installed
       Depends: node-color-convert but it is not going to be installed
       Depends: node-color-name but it is not going to be installed
       Depends: node-colors but it is not going to be installed
       Depends: node-columnify but it is not going to be installed
       Depends: node-combined-stream but it is not going to be installed
       Depends: node-concat-map but it is not going to be installed
       Depends: node-concat-stream but it is not going to be installed
       Depends: node-config-chain but it is not going to be installed
       Depends: node-configstore but it is not going to be installed
       Depends: node-console-control-strings but it is not going to be installed
       Depends: node-copy-concurrently but it is not going to be installed
       Depends: node-core-util-is but it is not going to be installed
       Depends: node-cross-spawn but it is not going to be installed
       Depends: node-crypto-random-string but it is not going to be installed
       Depends: node-cyclist but it is not going to be installed
       Depends: node-dashdash but it is not going to be installed
       Depends: node-debug but it is not going to be installed
       Depends: node-decamelize but it is not going to be installed
       Depends: node-deep-extend but it is not going to be installed
       Depends: node-defaults but it is not going to be installed
       Depends: node-define-properties but it is not going to be installed
       Depends: node-delayed-stream but it is not going to be installed
       Depends: node-delegates but it is not going to be installed
       Depends: node-detect-indent but it is not going to be installed
       Depends: node-detect-newline but it is not going to be installed
       Depends: node-dot-prop but it is not going to be installed
       Depends: node-duplexer3 but it is not going to be installed
       Depends: node-duplexify but it is not going to be installed
       Depends: node-ecc-jsbn but it is not going to be installed
       Depends: node-editor but it is not going to be installed
       Depends: node-encoding but it is not going to be installed
       Depends: node-end-of-stream but it is not going to be installed
       Depends: node-err-code but it is not going to be installed
       Depends: node-errno but it is not going to be installed
       Depends: node-es6-promise but it is not going to be installed
       Depends: node-escape-string-regexp but it is not going to be installed
       Depends: node-execa but it is not going to be installed
       Depends: node-extend but it is not going to be installed
       Depends: node-extsprintf but it is not going to be installed
       Depends: node-fast-deep-equal but it is not going to be installed
       Depends: node-find-up but it is not going to be installed
       Depends: node-flush-write-stream but it is not going to be installed
       Depends: node-forever-agent but it is not going to be installed
       Depends: node-form-data but it is not going to be installed
       Depends: node-from2 but it is not going to be installed
       Depends: node-fs.realpath but it is not going to be installed
       Depends: node-fs-vacuum but it is not going to be installed
       Depends: node-fs-write-stream-atomic but it is not going to be installed
       Depends: node-function-bind but it is not going to be installed
       Depends: node-gauge but it is not going to be installed
       Depends: node-genfun but it is not going to be installed
       Depends: node-get-caller-file but it is not going to be installed
       Depends: node-getpass but it is not going to be installed
       Depends: node-glob (>= 7.1.2~) but it is not going to be installed
       Depends: node-got but it is not going to be installed
       Depends: node-graceful-fs (>= 4.1.11~) but it is not going to be installed
       Depends: node-gyp (>= 3.6.2~) but it is not going to be installed
       Depends: node-har-schema but it is not going to be installed
       Depends: node-har-validator but it is not going to be installed
       Depends: node-has-flag but it is not going to be installed
       Depends: node-has-unicode but it is not going to be installed
       Depends: node-hosted-git-info (>= 2.6~) but it is not going to be installed
       Depends: node-http-signature but it is not going to be installed
       Depends: node-iconv-lite but it is not going to be installed
       Depends: node-iferr but it is not going to be installed
       Depends: node-import-lazy but it is not going to be installed
       Depends: node-imurmurhash but it is not going to be installed
       Depends: node-inflight but it is not going to be installed
       Depends: node-inherits (>= 2.0.3~) but it is not going to be installed
       Depends: node-ini (>= 1.3.5~) but it is not going to be installed
       Depends: node-invert-kv but it is not going to be installed
       Depends: node-ip but it is not going to be installed
       Depends: node-ip-regex but it is not going to be installed
       Depends: node-isarray but it is not going to be installed
       Depends: node-isexe but it is not going to be installed
       Depends: node-is-npm but it is not going to be installed
       Depends: node-is-obj but it is not going to be installed
       Depends: node-is-path-inside but it is not going to be installed
       Depends: node-is-retry-allowed but it is not going to be installed
       Depends: node-is-stream but it is not going to be installed
       Depends: node-isstream but it is not going to be installed
       Depends: node-is-typedarray but it is not going to be installed
       Depends: node-jsbn but it is not going to be installed
       Depends: node-jsonparse but it is not going to be installed
       Depends: node-json-parse-better-errors but it is not going to be installed
       Depends: node-json-schema but it is not going to be installed
       Depends: node-json-schema-traverse but it is not going to be installed
       Depends: node-jsonstream (>= 1.3.2~) but it is not going to be installed
       Depends: node-json-stringify-safe but it is not going to be installed
       Depends: node-jsprim but it is not going to be installed
       Depends: node-latest-version but it is not going to be installed
       Depends: node-lazy-property but it is not going to be installed
       Depends: node-lcid but it is not going to be installed
       Depends: node-libnpx but it is not going to be installed
       Depends: node-locate-path but it is not going to be installed
       Depends: node-lodash but it is not going to be installed
       Depends: node-lockfile (>= 1.0.3~) but it is not going to be installed
       Depends: node-lowercase-keys but it is not going to be installed
       Depends: node-lru-cache (>= 4.1.1~) but it is not going to be installed
       Depends: node-make-dir but it is not going to be installed
       Depends: node-mem but it is not going to be installed
       Depends: node-mime but it is not going to be installed
       Depends: node-mime-types but it is not going to be installed
       Depends: node-mimic-fn but it is not going to be installed
       Depends: node-minimatch but it is not going to be installed
       Depends: node-minimist but it is not going to be installed
       Depends: node-mississippi but it is not going to be installed
       Depends: node-mkdirp (>= 0.5.1~) but it is not going to be installed
       Depends: node-move-concurrently but it is not going to be installed
       Depends: node-ms but it is not going to be installed
       Depends: node-mute-stream but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-normalize-package-data (>= 2.4~) but it is not going to be installed
       Depends: node-npm-bundled but it is not going to be installed
       Depends: node-npm-package-arg (>= 6.1.1) but it is not going to be installed
       Depends: node-npmlog (>= 4.1.2~) but it is not going to be installed
       Depends: node-number-is-nan but it is not going to be installed
       Depends: node-oauth-sign but it is not going to be installed
       Depends: node-object-assign but it is not going to be installed
       Depends: node-once (>= 1.4~) but it is not going to be installed
       Depends: node-opener but it is not going to be installed
       Depends: node-osenv (>= 0.1.5~) but it is not going to be installed
       Depends: node-os-locale but it is not going to be installed
       Depends: node-os-tmpdir but it is not going to be installed
       Depends: node-package-json but it is not going to be installed
       Depends: node-parallel-transform but it is not going to be installed
       Depends: node-path-exists but it is not going to be installed
       Depends: node-path-is-absolute but it is not going to be installed
       Depends: node-path-is-inside but it is not going to be installed
       Depends: node-promise-inflight but it is not going to be installed
       Depends: node-promise-retry but it is not going to be installed
       Depends: node-promzard but it is not going to be installed
       Depends: node-performance-now but it is not going to be installed
       Depends: node-p-finally but it is not going to be installed
       Depends: node-p-is-promise but it is not going to be installed
       Depends: node-pify but it is not going to be installed
       Depends: node-p-limit but it is not going to be installed
       Depends: node-p-locate but it is not going to be installed
       Depends: node-prepend-http but it is not going to be installed
       Depends: node-process-nextick-args but it is not going to be installed
       Depends: node-proto-list but it is not going to be installed
       Depends: node-prr but it is not going to be installed
       Depends: node-pseudomap but it is not going to be installed
       Depends: node-psl but it is not going to be installed
       Depends: node-pump but it is not going to be installed
       Depends: node-pumpify but it is not going to be installed
       Depends: node-punycode but it is not going to be installed
       Depends: node-qs but it is not going to be installed
       Depends: node-qw but it is not going to be installed
       Depends: node-rc but it is not going to be installed
       Depends: node-read (>= 1.0.7~) but it is not going to be installed
       Depends: node-readable-stream but it is not going to be installed
       Depends: node-read-package-json (>= 2.0.13~) but it is not going to be installed
       Depends: node-registry-auth-token but it is not going to be installed
       Depends: node-registry-url but it is not going to be installed
       Depends: node-request (>= 2.83~) but it is not going to be installed
       Depends: node-require-main-filename but it is not going to be installed
       Depends: node-require-directory but it is not going to be installed
       Depends: node-resolve-from (>= 4.0~) but it is not going to be installed
       Depends: node-retry (>= 0.10.1~) but it is not going to be installed
       Depends: node-rimraf (>= 2.6.2~) but it is not going to be installed
       Depends: node-run-queue but it is not going to be installed
       Depends: node-safe-buffer but it is not going to be installed
       Depends: node-semver (>= 5.5~) but it is not going to be installed
       Depends: node-set-blocking but it is not going to be installed
       Depends: node-sha (>= 2.0.1~) but it is not going to be installed
       Depends: node-shebang-command but it is not going to be installed
       Depends: node-shebang-regex but it is not going to be installed
       Depends: node-signal-exit but it is not going to be installed
       Depends: node-slide (>= 1.1.6~) but it is not going to be installed
       Depends: node-sorted-object but it is not going to be installed
       Depends: node-slash but it is not going to be installed
       Depends: node-semver-diff but it is not going to be installed
       Depends: node-spdx-correct but it is not going to be installed
       Depends: node-spdx-exceptions but it is not going to be installed
       Depends: node-spdx-expression-parse but it is not going to be installed
       Depends: node-spdx-license-ids but it is not going to be installed
       Depends: node-sshpk but it is not going to be installed
       Depends: node-ssri but it is not going to be installed
       Depends: node-stream-each but it is not going to be installed
       Depends: node-stream-iterate but it is not going to be installed
       Depends: node-stream-shift but it is not going to be installed
       Depends: node-strict-uri-encode but it is not going to be installed
       Depends: node-string-decoder but it is not going to be installed
       Depends: node-string-width but it is not going to be installed
       Depends: node-strip-ansi (>= 4.0~) but it is not going to be installed
       Depends: node-strip-json-comments but it is not going to be installed
       Depends: node-strip-eof but it is not going to be installed
       Depends: node-supports-color but it is not going to be installed
       Depends: node-tar (>= 4.4~) but it is not going to be installed
       Depends: node-term-size but it is not going to be installed
       Depends: node-text-table but it is not going to be installed
       Depends: node-through but it is not going to be installed
       Depends: node-through2 but it is not going to be installed
       Depends: node-timed-out but it is not going to be installed
       Depends: node-tough-cookie but it is not going to be installed
       Depends: node-tunnel-agent but it is not going to be installed
       Depends: node-tweetnacl but it is not going to be installed
       Depends: node-typedarray but it is not going to be installed
       Depends: node-uid-number but it is not going to be installed
       Depends: node-unique-filename but it is not going to be installed
       Depends: node-unique-string but it is not going to be installed
       Depends: node-unpipe but it is not going to be installed
       Depends: node-url-parse-lax but it is not going to be installed
       Depends: node-util-deprecate but it is not going to be installed
       Depends: node-uuid but it is not going to be installed
       Depends: node-validate-npm-package-name but it is not going to be installed
       Depends: node-verror but it is not going to be installed
       Depends: node-which (>= 1.3~) but it is not going to be installed
       Depends: node-which-module but it is not going to be installed
       Depends: node-wide-align but it is not going to be installed
       Depends: node-widest-line but it is not going to be installed
       Depends: node-wrap-ansi but it is not going to be installed
       Depends: node-wrappy but it is not going to be installed
       Depends: node-wcwidth.js but it is not going to be installed
       Depends: node-write-file-atomic but it is not going to be installed
       Depends: node-xdg-basedir but it is not going to be installed
       Depends: node-xtend but it is not going to be installed
       Depends: node-yargs but it is not going to be installed
       Depends: node-yargs-parser but it is not going to be installed
       Depends: node-yallist but it is not going to be installed
       Depends: node-y18n but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: use String.prototype.padStart()
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

changed 287 packages, and audited 288 packages in 9s


And then trying to run the example test

/CyberBattleSim$ python cyberbattle/agents/baseline/run.py --training_episode_count 1 --eval_episode_count 1 --iteration_count 10 --rewardplot_with 80  --chain_size=20 --ownership_goal 1.0
torch cuda available=False
###### DQL
Learning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
  ## Episode: 1/1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,
batch=512, target_update=10
Episode 1|Iteration 10|reward:  139.0|Elapsed Time: 0:00:00|##################|
  Episode 1 stopped at t=10 
  Breakdown [Reward/NoReward (Success rate)]
    explore-local: 1/1 (0.50)
    explore-remote: 2/5 (0.29)
    explore-connect: 0/1 (0.00)
    exploit-local: 0/0 (NaN)
    exploit-remote: 0/0 (NaN)
    exploit-connect: 0/0 (NaN)
  exploit deflected to exploration: 2
simulation ended
###### Random search
Learning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0, 
  ## Episode: 1/1 'Random search' ϵ=1.0000, 
Episode 1|Iteration 10|reward:   94.0|Elapsed Time: 0:00:00|##################|
  Episode 1 stopped at t=10 
  Breakdown [Reward/NoReward (Success rate)]
    explore-local: 1/1 (0.50)
    explore-remote: 1/4 (0.20)
    explore-connect: 0/3 (0.00)
    exploit-local: 0/0 (NaN)
    exploit-remote: 0/0 (NaN)
    exploit-connect: 0/0 (NaN)
  exploit deflected to exploration: 0
simulation ended
Episode duration -- DQN=Red, Random=Green
   10.00  ┼
Cumulative rewards -- DQN=Red, Random=Green
/home/ubuntu/.local/lib/python3.8/site-packages/numpy/lib/function_base.py:380: RuntimeWarning: Mean of empty slice.
  avg = a.mean(axis)
/home/ubuntu/.local/lib/python3.8/site-packages/numpy/core/_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
  139.00  ┼     ╭───╴
  125.10  ┤     │
  111.20  ┤     │
   97.30  ┤  ╭──╯╭──╴
   83.40  ┤  │   │
   69.50  ┤  │   │
   55.60  ┼──╭───╯
   41.70  ┤  │
   27.80  ┤  │
   13.90  ┤  │
    0.00  ┤──╯

Negative rewards and rewarding new successful attack to already owned nodes

  1. In here, the reward at each step is calculated as reward = max(0., reward). I see the code about penalty in actions.py and I understand why you cancel that. When I tried to remove this max() operation, the reward became highly negative and the agent learns nothing. However, it makes the agent overfit because the reward is so sparse. I think adding some time cost is necessary such as -1 or -0.5.
  2. In here, when giving the reward for NEW_SUCCESSFULL_ATTACK_REWARD, it does not take into consideration whether the attacked the node is already owned. It's meaningless to attack a node already owned by the attacker. It will make the agent repeatedly launch attacks between owned nodes and ignore discovering new nodes.

In my experiment, I trained an agent with the original reward design in the chain env. The agent can perfectly take ownership of the network in training. When I saved the model and evaluate it with epsilon-greedy, the success rate is only about 90%. When I patched the two points I proposed above and trained an agent with the same parameters, the successful rate for evaluation is about 100%. I think the original reward design makes the agent overfit.

Could you please take a look at the two points and give some feedback? Anyway, thanks again for your codes, it helps with my research, and I even would like to use them in my next research project about online learning :)

Originally posted by @sherdencooper in #46 (comment)

Dockerfile not working

Hello,

Just letting you know that building the container using the included Dockerfile does not work starting from commit 9b4d294 from September 22nd 2022 updating to python 3.9.
Previous commit c289695 "CI Fixes, requires networkx upgrade to 2.8.6 (#85)" does work.

Discovered Node Properties Don't Have to be Revealed for Property Dependent Precondition?

I'm trying to setup an environment that first requires the agent to probe a remote system to learn a property. That property is a precondition to a different remote exploit on the system. In a variant of the manually solved notebook, I can bypass the precondition even though the property has yet to be discovered.

In other words, vulnerability A reveals PROPERTY and PROPERTY is the precondition to vulnerability B.
The attack sequence must be A->B.

This seems to be because in actions.py _check_prerequisites is dealing with the actual node properties instead of the discovered node properties.

If I try to instantiate a node with an empty properties list and then probe for the desired property, I hit the elif condition on line 329 of actions.py.

Am I misunderstanding the use case of a vulnerability with a ProbeSucceeded outcome, or is this a bug?

init.sh doesn't work

I've tried to clone the repo and setup CyberBattleSim on a windows machine running WSL2 with Ubuntu 20.04.3 LTS as well as a linux machine running Ubuntu 20.04.02 LTS. I follow the instructions in the readme and simply run ./init.sh

This results in a venv being created and the libraries being downloaded, but seemingly not all are installed. There are several warnings and errors that occur during the execution of the script.

If need be, I can post the output from my install attempt, but it's quite long.

Correction of benchmark results

Hi everyone,

Found several bugs while checking the code of ipynb notebooks with benchmark results for 3 environments TinyToy, ToyCTF, Chain.

I think my findings might be useful for community, who uses this nice implementation of cyberattacks simulation.

MOVED TO SEPARATE ISSUE #115

  1. Issue 1: learner.epsilon_greedy_search(...) is often used for training agents with different algorithms, including DQL in the dql_run. However dql_exploit_run with input network dql_run as policy-agent and eval_episode_count parameter for the number of episodes, gives an impression that runs are used for evaluation of the trained DQN. The only distinguishable difference between 2 runs is epsilon queal to 0, which leads to exploitation mode of training, but does not exclude training, because during run with learner.epsilon_greedy_search the optimizer.step() is executed on each step of training in the file agent_dql.py, function call learner.on_step(...).
  1. Issue 2: During training each episode ends only within the maximum number of iterations, which is due to the mistype in AttackerGoal class. Default value for parameter own_atleast_percent: float 1.0 is included as condition with AND, for raising flag done = True, thus for TinyToy and ToyCTF (not Chain) leads to long duration of training, wrong RL signal for evaluating Q function and low sample-efficiency.

MOVED TO SEPARATE ISSUE #115
3. Issue 3: ToyCTF benchmark is inaccurate, because with correct evaluation procedure, like with chain network configuration, agent does not reqch goal of 6 owned nodes after 200 training episodes.

More realistic random domain generation required

The static toy environments are not suitable for training an agent for generalization. The chainpattern is solvable with a trivial strategy, which is not enough to demonstrate that a certain method is good enough.

The random environment in cyberbattle.simulation.generate_network is not realistic and deep enough. In a random network of 50 nodes, only 1 or 2 are actually hackable.

The random environment in cyberbattle.simulation.environment_generation seem to be very limited as well (usually, no other nodes discovered).

To train generalizing agents, a more complex, dynamic and realistic environment generation is needed.

push failing; ".samples.toyctf" could not be resolved

I'm trying to push some changes to make a pull request but I'm getting many errors when running git push:

git push --set-upstream origin notebook-patch
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/jonabox/.cache/pre-commit/patch1623372105-4715.
pyright..................................................................Failed
- hook id: pyright
- exit code: 1

Loading configuration file at /home/jonabox/ms/CyberBattleSim/pyrightconfig.json
Assuming Python version 3.8
Assuming Python platform Linux
No include entries specified; assuming /home/jonabox/ms/CyberBattleSim
Searching for source files
Found 68 source files
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/__init__.py
  11:6 - error: Import ".samples.toyctf" could not be resolved (reportMissingImports)
  12:6 - error: Import ".samples.custom" could not be resolved (reportMissingImports)
  13:6 - error: Import ".samples.chainpattern" could not be resolved (reportMissingImports)
  14:6 - error: Import ".samples.toyctf" could not be resolved (reportMissingImports)
  29:10 - error: Cannot assign member "ports" for type "EnvSpec"
  Member "ports" is unknown (reportGeneralTypeIssues)
  31:10 - error: Cannot assign member "properties" for type "EnvSpec"
  Member "properties" is unknown (reportGeneralTypeIssues)
  33:10 - error: Cannot assign member "local_vulnerabilities" for type "EnvSpec"
  Member "local_vulnerabilities" is unknown (reportGeneralTypeIssues)
  35:10 - error: Cannot assign member "remote_vulnerabilities" for type "EnvSpec"
  Member "remote_vulnerabilities" is unknown (reportGeneralTypeIssues)
  74:33 - error: Argument of type "Identifiers" cannot be assigned to parameter "cyberbattle_env_identifiers" of type "Identifiers" in function "register"
  "Identifiers" is incompatible with "Identifiers" (reportGeneralTypeIssues)
  8:15 - warning: Import "simulation" is not accessed (reportUnusedImport)
  9:15 - warning: Import "agents" is not accessed (reportUnusedImport)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/cyberbattle_chain.py
  6:6 - error: Import "..samples.chainpattern" could not be resolved (reportMissingImports)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/cyberbattle_custom.py
  4:6 - error: Import "..samples.custom" could not be resolved (reportMissingImports)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/cyberbattle_env.py
  1049:44 - error: Argument of type "Environment" cannot be assigned to parameter "environment" of type "Environment" in function "step"
  "Environment" is incompatible with "Environment" (reportGeneralTypeIssues)
  1049:64 - error: Argument of type "DefenderAgentActions" cannot be assigned to parameter "actions" of type "DefenderAgentActions" in function "step"
  "DefenderAgentActions" is incompatible with "DefenderAgentActions" (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/cyberbattle_random.py
  14:46 - error: Argument of type "Environment" cannot be assigned to parameter "initial_environment" of type "Environment" in function "__init__"
  "Environment" is incompatible with "Environment" (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/cyberbattle_toyctf.py
  4:6 - error: Import "..samples.toyctf" could not be resolved (reportMissingImports)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/_env/defender.py
  149:56 - error: Argument of type "FirewallRule" cannot be assigned to parameter "__object" of type "FirewallRule" in function "append"
  "FirewallRule" is incompatible with "FirewallRule" (reportGeneralTypeIssues)
  151:56 - error: Argument of type "FirewallRule" cannot be assigned to parameter "__object" of type "FirewallRule" in function "append"
  "FirewallRule" is incompatible with "FirewallRule" (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/agents/__init__.py
  9:6 - error: Import ".baseline.learner" could not be resolved (reportMissingImports)
  9:31 - warning: Import "Learner" is not accessed (reportUnusedImport)
  9:40 - warning: Import "AgentWrapper" is not accessed (reportUnusedImport)
  9:54 - warning: Import "EnvironmentBounds" is not accessed (reportUnusedImport)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/simulation/actions.py
  81:9 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  81:34 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  82:9 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  82:35 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  111:58 - error: Argument of type "PrivilegeLevel" cannot be assigned to parameter "level" of type "PrivilegeLevel" in function "__init__"
  "PrivilegeLevel" is incompatible with "PrivilegeLevel" (reportGeneralTypeIssues)
  207:58 - error: Expression of type "Literal[PrivilegeLevel.LocalUser]" cannot be assigned to parameter of type "PrivilegeLevel"
  "Literal[PrivilegeLevel.LocalUser]" is incompatible with "PrivilegeLevel" (reportGeneralTypeIssues)
  134:31 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  134:73 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  136:92 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  212:79 - error: Argument of type "PrivilegeLevel" cannot be assigned to parameter "escalation_level" of type "PrivilegeLevel" in function "escalate"
  "PrivilegeLevel" is incompatible with "PrivilegeLevel" (reportGeneralTypeIssues)
  290:48 - error: Argument of type "PrivilegeLevel" cannot be assigned to parameter "privilege" of type "PrivilegeLevel" in function "__mark_node_as_owned"
  "PrivilegeLevel" is incompatible with "PrivilegeLevel" (reportGeneralTypeIssues)
  345:13 - error: Argument of type "Literal[VulnerabilityType.REMOTE]" cannot be assigned to parameter "expected_type" of type "VulnerabilityType" in function "__process_outcome"
  "Literal[VulnerabilityType.REMOTE]" is incompatible with "VulnerabilityType" (reportGeneralTypeIssues)
  379:13 - error: Argument of type "Literal[VulnerabilityType.LOCAL]" cannot be assigned to parameter "expected_type" of type "VulnerabilityType" in function "__process_outcome"
  "Literal[VulnerabilityType.LOCAL]" is incompatible with "VulnerabilityType" (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/simulation/commandcontrol_test.py
  11:6 - error: Import "..samples.toyctf" could not be resolved (reportMissingImports)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/simulation/model.py
  44:9 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  44:34 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  45:9 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  45:35 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/build/lib/cyberbattle/simulation/model_test.py
  53:41 - error: Argument of type "Identifiers" cannot be assigned to parameter "identifiers" of type "Identifiers" in function "__init__"
  "Identifiers" is incompatible with "Identifiers" (reportGeneralTypeIssues)
  67:21 - error: Argument of type "Identifiers" cannot be assigned to parameter "identifiers" of type "Identifiers" in function "__init__"
  "Identifiers" is incompatible with "Identifiers" (reportGeneralTypeIssues)
  85:21 - error: Argument of type "Identifiers" cannot be assigned to parameter "identifiers" of type "Identifiers" in function "__init__"
  "Identifiers" is incompatible with "Identifiers" (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/cyberbattle/simulation/actions.py
  81:9 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  81:34 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  82:9 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  82:35 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  134:31 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  134:73 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  136:92 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
/home/jonabox/ms/CyberBattleSim/cyberbattle/simulation/model.py
  44:9 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
  44:34 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  45:9 - error: Cannot access member "FALSE" for type "BooleanAlgebra"
  Member "FALSE" is unknown (reportGeneralTypeIssues)
  45:35 - error: Cannot access member "TRUE" for type "BooleanAlgebra"
  Member "TRUE" is unknown (reportGeneralTypeIssues)
50 errors, 5 warnings 
Completed in 4.359sec

flake8...................................................................Passed
autopep8.................................................................Passed
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...........................................(no files to check)Skipped
Check for added large files..............................................Passed

Wonder what's going on...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.