[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"tool-microsoft--CyberBattleSim":3,"similar-microsoft--CyberBattleSim":104},{"id":4,"github_repo":5,"name":6,"description_en":7,"description_zh":8,"ai_summary_zh":9,"readme_en":10,"readme_zh":11,"quickstart_zh":12,"use_case_zh":13,"hero_image_url":14,"owner_login":15,"owner_name":16,"owner_avatar_url":17,"owner_bio":18,"owner_company":19,"owner_location":19,"owner_email":20,"owner_twitter":21,"owner_website":22,"owner_url":23,"languages":24,"stars":44,"forks":45,"last_commit_at":46,"license":47,"difficulty_score":48,"env_os":49,"env_gpu":50,"env_ram":51,"env_deps":52,"category_tags":66,"github_topics":19,"view_count":69,"oss_zip_url":19,"oss_zip_packed_at":19,"status":70,"created_at":71,"updated_at":72,"faqs":73,"releases":103},6216,"microsoft\u002FCyberBattleSim","CyberBattleSim","An experimentation and research platform to investigate the interaction of automated agents in an abstract simulated network environments.","CyberBattleSim 是一个由微软开源的实验与研究平台，旨在模拟抽象的企业网络环境，用于探究自动化智能体之间的交互机制。它通过高度抽象的方式呈现计算机网络与网络安全概念，让研究人员能够在一个安全、简化的沙箱中，观察攻击者与防御者智能体的博弈过程。\n\n该平台主要解决了在真实网络中进行自主攻防算法研究的高风险与高成本难题。由于仿真环境经过抽象处理，无法直接应用于现实系统，从而有效防止了训练出的恶意技术被滥用，为探索自动化网络攻击与防御提供了安全的试验田。用户可以在其中研究横向移动攻击技术、网络拓扑对安全的影响，以及测试最新的强化学习算法在巨大动作空间下的表现。\n\nCyberBattleSim 特别适合网络安全研究人员、AI 算法开发者以及高校学者使用。其核心亮点在于基于 Python 构建了标准的 Open AI Gym 接口，方便用户直接利用现有的强化学习框架训练智能体。平台内置了基础的随机防御者和攻击场景，支持通过重映像节点等抽象操作来模拟威胁缓解过程，并提供了步数效率与累积奖励等指标来评估模型性能。如果你希望在不危及真实系统的前提下，深入探索自主网络安全系统的伦理设计与算法演","CyberBattleSim 是一个由微软开源的实验与研究平台，旨在模拟抽象的企业网络环境，用于探究自动化智能体之间的交互机制。它通过高度抽象的方式呈现计算机网络与网络安全概念，让研究人员能够在一个安全、简化的沙箱中，观察攻击者与防御者智能体的博弈过程。\n\n该平台主要解决了在真实网络中进行自主攻防算法研究的高风险与高成本难题。由于仿真环境经过抽象处理，无法直接应用于现实系统，从而有效防止了训练出的恶意技术被滥用，为探索自动化网络攻击与防御提供了安全的试验田。用户可以在其中研究横向移动攻击技术、网络拓扑对安全的影响，以及测试最新的强化学习算法在巨大动作空间下的表现。\n\nCyberBattleSim 特别适合网络安全研究人员、AI 算法开发者以及高校学者使用。其核心亮点在于基于 Python 构建了标准的 Open AI Gym 接口，方便用户直接利用现有的强化学习框架训练智能体。平台内置了基础的随机防御者和攻击场景，支持通过重映像节点等抽象操作来模拟威胁缓解过程，并提供了步数效率与累积奖励等指标来评估模型性能。如果你希望在不危及真实系统的前提下，深入探索自主网络安全系统的伦理设计与算法演进，这是一个理想的起步工具。","﻿# CyberBattleSim\n\n> April 8th, 2021: See the [announcement](https:\u002F\u002Fwww.microsoft.com\u002Fsecurity\u002Fblog\u002F2021\u002F04\u002F08\u002Fgamifying-machine-learning-for-stronger-security-and-ai-models\u002F) on the Microsoft Security Blog.\n\nCyberBattleSim is an experimentation research platform to investigate the interaction\nof automated agents operating in a simulated abstract enterprise network environment.\nThe simulation provides a high-level abstraction of computer networks\nand cyber security concepts.\nIts Python-based Open AI Gym interface allows for the training of\nautomated agents using reinforcement learning algorithms.\n\nThe simulation environment is parameterized by a fixed network topology\nand a set of vulnerabilities that agents can utilize\nto move laterally in the network.\nThe goal of the attacker is to take ownership of a portion of the network by exploiting\nvulnerabilities that are planted in the computer nodes.\nWhile the attacker attempts to spread throughout the network,\na defender agent watches the network activity and tries to detect\nany attack taking place and mitigate the impact on the system\nby evicting the attacker. We provide a basic stochastic defender that detects\nand mitigates ongoing attacks based on pre-defined probabilities of success.\nWe implement mitigation by re-imaging the infected nodes, a process\nabstractly modeled as an operation spanning over multiple simulation steps.\n\nTo compare the performance of the agents we look at two metrics: the number of simulation steps taken to\nattain their goal and the cumulative rewards over simulation steps across training epochs.\n\n## Project goals\n\nWe 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.\n\nThe 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.\nAt 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.\n\nFor instance, the current implementation focuses on\nthe 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.\n\nOn the algorithmic side, we provide some basic agents as starting points, but we\nwould be curious to find out how state-of-the-art reinforcement learning algorithms compare to them. We found that the large action space\nintrinsic to any computer system is a particular challenge for\nReinforcement 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\nwhere agents typically do not feature internal memory.\nThese are other areas of research where the simulation could be used for benchmarking purposes.\n\nOther areas of interest include the responsible and ethical use of autonomous\ncyber-security systems: How to design an enterprise network that gives an intrinsic\nadvantage to defender agents? How to conduct safe research aimed at defending enterprises against autonomous cyber-attacks while preventing nefarious use of such technology?\n\n## Documentation\n\nRead the [Quick introduction](\u002Fdocs\u002Fquickintro.md) to the project.\n\n## Build status\n\n| Type | Branch | Status |\n| ---  | ------ | ------ |\n| CI   | master | ![.github\u002Fworkflows\u002Fci.yml](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fworkflows\u002F.github\u002Fworkflows\u002Fci.yml\u002Fbadge.svg) |\n| Docker image | master | ![.github\u002Fworkflows\u002Fbuild-container.yml](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fworkflows\u002F.github\u002Fworkflows\u002Fbuild-container.yml\u002Fbadge.svg) |\n\n## Benchmark\n\nSee [Benchmark documentation](\u002Fdocs\u002Fbenchmark.md).\nJupyter notebooks with the latest runs are checked-in under a dedicated tag at [\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks).\n\n## Setting up a dev environment\n\nIt is strongly recommended to work under a Linux environment, either directly or via WSL on Windows.\nRunning Python on Windows directly should work but is not supported anymore.\n\nStart by checking out the repository:\n\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim.git\n   ```\n\n### OS components\n\nIf you get the following error when running the papermill on the notebooks\n(or alternatively when running `orca --help`)\n```\n\u002Fhome\u002Fwiblum\u002Fminiconda3\u002Fenvs\u002Fcybersim\u002Flib\u002Forca_app\u002Forca: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory\n```\nor other share libraries like `libgdk_pixbuf-2.0.so.0`,\nThen run the following command:\n```\nsudo apt install libnss3-dev libgtk-3-0 libxss1 libasound2-dev libgtk2.0-0 libgconf-2-4\n```\n\n### On Linux or WSL\n\nThe instructions were tested on a Linux Ubuntu distribution (both native and via WSL).\n\nIf conda is not installed already, you need to install it by running the `install_conda.sh` script.\n\n```bash\nbash install-conda.sh\n```\n\nOnce this is done, open a new terminal and run the initialization script:\n```bash\nbash init.sh\n```\nThis will create a conda environmen named `cybersim` with all the required OS and python dependencies.\n\nTo activate the environment run:\n\n```bash\nconda activate cybersim\n```\n\n#### Windows Subsystem for Linux\n\nThe supported dev environment on Windows is via WSL.\nYou first need to install an Ubuntu WSL distribution on your Windows machine,\nand then proceed with the Linux instructions (next section).\n\n#### Git authentication from WSL\n\nTo authenticate with Git, you can either use SSH-based authentication or\nalternatively use the credential-helper trick to automatically generate a\nPAT token. The latter can be done by running the following command under WSL\n([more info here](https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fwindows\u002Fwsl\u002Ftutorials\u002Fwsl-git)):\n\n```ps\ngit config --global credential.helper \"\u002Fmnt\u002Fc\u002FProgram\\ Files\u002FGit\u002Fmingw64\u002Flibexec\u002Fgit-core\u002Fgit-credential-manager.exe\"\n```\n\n#### Docker on WSL\n\nTo run your environment within a docker container, we recommend running `docker` via Windows Subsystem on Linux (WSL) using the following instructions:\n[Installing Docker on Windows under WSL](https:\u002F\u002Fdocs.docker.com\u002Fdocker-for-windows\u002Fwsl-tech-preview\u002F)).\n\n### Windows (unsupported)\n\nThis method is not maintained anymore, please prefer instead running under\na WSL subsystem Linux environment.\nBut if you insist you want to start by installing [Python 3.10](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Fwindows\u002F) then in a Powershell prompt run the `.\u002Finit.ps1` script.\n\n## Getting started quickly using Docker\n\nThe quickest method to get up and running is via the Docker container.\n\n> NOTE: For licensing reasons, we do not publicly redistribute any\n> build artifact. In particular, the docker registry `spinshot.azurecr.io` referred to\n> in the commands below is kept private to the\n> project maintainers only.\n>\n> 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.\n\n### Running from Docker registry\n\n```bash\ncommit=7c1f8c80bc53353937e3c69b0f5f799ebb2b03ee\ndocker login spinshot.azurecr.io\ndocker pull spinshot.azurecr.io\u002Fcyberbattle:$commit\ndocker run -it spinshot.azurecr.io\u002Fcyberbattle:$commit python -m cyberbattle.agents.baseline.run\n```\n\n### Recreating the Docker image\n\n```bash\ndocker build -t cyberbattle:1.1 .\ndocker run -it -v \"$(pwd)\":\u002Fsource --rm cyberbattle:1.1 python -m cyberbattle.agents.baseline.run\n```\n\n## Check your environment\n\nRun the following commands to run a simulation with a baseline RL agent:\n\n```bash\npython -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\n\npython -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\n```\n\nIf everything is setup correctly you should get an output that looks like this:\n\n```bash\ntorch cuda available=True\n###### DQL\nLearning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\n  ## Episode: 1\u002F1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\nEpisode 1|Iteration 10|reward:  139.0|Elapsed Time: 0:00:00|###################################################################|\n###### Random search\nLearning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0,\n  ## Episode: 1\u002F1 'Random search' ϵ=1.0000,\nEpisode 1|Iteration 10|reward:  194.0|Elapsed Time: 0:00:00|###################################################################|\nsimulation ended\nEpisode duration -- DQN=Red, Random=Green\n   10.00  ┼\nCumulative rewards -- DQN=Red, Random=Green\n  194.00  ┼      ╭──╴\n  174.60  ┤      │\n  155.20  ┤╭─────╯\n  135.80  ┤│     ╭──╴\n  116.40  ┤│     │\n   97.00  ┤│    ╭╯\n   77.60  ┤│    │\n   58.20  ┤╯ ╭──╯\n   38.80  ┤  │\n   19.40  ┤  │\n    0.00  ┼──╯\n```\n\n## Jupyter notebooks\n\nTo quickly get familiar with the project, you can open one of the provided Jupyter notebooks to play interactively with the gymnasium environments.\n\n> Notes on the `.py` notebooks:\n> - Our notebooks are checked-in in Git as `.py` files. Those can be opened and run directly  in VSCode or in Jupyter using the [Jupytext extension](https:\u002F\u002Fjupytext.readthedocs.io\u002Fen\u002Flatest\u002Finstall.html).\n> - The output `.ipynb` files can also be automatically regenerated using [papermill](https:\u002F\u002Fpypi.org\u002Fproject\u002Fpapermill\u002F) by running the bash script [run_benchmark.sh](\u002Fnotebooks\u002Frun_benchmark.sh).\n> - We also publish a snapshot of the corresponding `.ipynb`-notebooks with the entire output and plots in a separate git tag.\nThe latest snapshot of the Jupyter notebooks output, including the benchmarks, are\naccessible from the following git tag: [\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks).\n\n\nSome notebooks to get started:\n\n- 'Capture The Flag' toy environment notebooks:\n  - [Random agent](notebooks\u002Ftoyctf-random.py)\n  - [Interactive session for a human player](notebooks\u002Ftoyctf-blank.py)\n  - [Interactive session - fully solved](notebooks\u002Ftoyctf-solved.py)\n\n- Chain environment notebooks:\n  - [Random agent](notebooks\u002Fchainnetwork-random.py)\n\n- Other environments:\n  - [Interactive session with a randomly generated environment](notebooks\u002Frandomnetwork.py)\n  - [Random agent playing on randomly generated networks](notebooks\u002Fc2_interactive_interface.py)\n\n- Benchmarks:   The following notebooks show benchmark evaluation of the baseline agents on various environments.\n\n    - [Benchmarking on a given environment](notebooks\u002Fnotebook_benchmark.py)\n    - [Benchmark on chain environments with a basic defender](notebooks\u002Fnotebook_withdefender.py)\n    - [DQL transfer learning evaluation](notebooks\u002Fnotebook_dql_transfer.py)\n    - [Epsilon greedy with credential lookups](notebooks\u002Fnotebook_randlookups.py)\n    - [Tabular Q Learning](notebooks\u002Fnotebook_tabularq.py)\n\nThe latest snapshot of the Jupyter notebooks output, including the benchmarks, are\naccessible from the following git tag: [\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks).\n\n\n## How to instantiate the Gym environments?\n\nThe following code shows how to create an instance of the OpenAI Gym environment `CyberBattleChain-v0`, an environment based on a [chain-like network structure](cyberbattle\u002Fsamples\u002Fchainpattern\u002Fchainpattern.py), 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\nbreak 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`):\n\n```python\nimport cyberbattle._env.cyberbattle_env\n\ncyberbattlechain_defender =\n  gym.make('CyberBattleChain-v0',\n      size=10,\n      attacker_goal=AttackerGoal(\n          own_atleast=0,\n          own_atleast_percent=1.0\n      ),\n      defender_constraint=DefenderConstraint(\n          maintain_sla=0.80\n      ),\n      defender_agent=ScanAndReimageCompromisedMachines(\n          probability=0.6,\n          scan_capacity=2,\n          scan_frequency=5))\n```\n\nTo try other network topologies, take example on [chainpattern.py](cyberbattle\u002Fsamples\u002Fchainpattern\u002Fchainpattern.py) to define your own set of machines and vulnerabilities, then add an entry in [the module initializer](cyberbattle\u002F__init__.py) to declare and register the Gym environment.\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https:\u002F\u002Fcla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002F).\nFor more information see the [Code of Conduct FAQ](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002Ffaq\u002F) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n### Ideas for contributions\n\nHere are some ideas on how to contribute: enhance the simulation (event-based, refined the simulation, …), train an RL algorithm on the existing simulation,\nimplement benchmark to evaluate and compare novelty of agents, add more network generative modes to train RL-agent on, contribute to the doc, fix bugs.\n\nSee also the [wiki for more ideas](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleGym\u002Fwiki\u002FPossible-contributions).\n\n## Citing this project\n\n```bibtex\n@misc{msft:cyberbattlesim,\n  Author = {Microsoft Defender Research Team.}\n  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.},\n  Publisher = {GitHub},\n  Howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fcyberbattlesim}},\n  Title = {CyberBattleSim},\n  Year = {2021}\n}\n```\n\n## Note on privacy\n\nThis project does not include any customer data.\nThe provided models and network topologies are purely fictitious.\nUsers of the provided code provide all the input to the simulation\nand must have the necessary permissions to use any provided data.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark & Brand Guidelines](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Flegal\u002Fintellectualproperty\u002Ftrademarks\u002Fusage\u002Fgeneral).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n","﻿# CyberBattleSim\n\n> 2021年4月8日：请参阅微软安全博客上的[公告](https:\u002F\u002Fwww.microsoft.com\u002Fsecurity\u002Fblog\u002F2021\u002F04\u002F08\u002Fgamifying-machine-learning-for-stronger-security-and-ai-models\u002F)。\n\nCyberBattleSim是一个实验性研究平台，用于研究在模拟的抽象企业网络环境中运行的自动化智能体之间的交互。该仿真提供了一个关于计算机网络和网络安全概念的高度抽象框架。其基于Python的Open AI Gym接口允许使用强化学习算法来训练自动化智能体。\n\n仿真环境由固定的网络拓扑结构以及智能体可以利用以在网络中横向移动的一组漏洞参数化。攻击者的目的是通过利用部署在计算机节点中的漏洞来控制网络的一部分。当攻击者试图在网络中扩散时，防御者智能体会监控网络活动，尝试检测正在进行的任何攻击，并通过驱逐攻击者来减轻对系统的威胁。我们提供了一个基本的随机防御者，它根据预定义的成功概率来检测并缓解正在进行的攻击。我们通过重新映像受感染的节点来实现缓解，这一过程被抽象地建模为跨越多个仿真步骤的操作。\n\n为了比较智能体的性能，我们关注两个指标：达到目标所花费的仿真步数，以及在整个训练周期内各仿真步骤的累积奖励。\n\n## 项目目标\n\n我们认为该项目是一个实验平台，用于研究自动化智能体在抽象仿真网络环境中的交互。通过将其开源，我们希望鼓励研究社区探索网络智能体在这些环境中如何交互与演化。\n\n我们提供的仿真无疑较为简单，但这也有其优势。其高度抽象的特性使其无法直接应用于现实世界系统，从而为防止使用由此训练出的自动化智能体进行恶意行为提供了一种保障。同时，它的简单性使我们能够专注于想要研究的具体安全方面，并快速试验最新的机器学习和人工智能算法。\n\n例如，当前的实现主要关注横向移动的网络攻击技术，旨在理解网络拓扑和配置如何影响这些技术。基于这一目标，我们认为没有必要对实际网络流量进行建模。这只是我们系统中一个显著的局限性示例，未来的研究贡献或许可以加以改进。\n\n在算法方面，我们提供了一些基础智能体作为起点，但我们很想知道最先进的强化学习算法与它们相比会如何。我们发现，任何计算机系统固有的庞大动作空间对于强化学习来说都是一个特别的挑战，这与其他应用（如视频游戏或机器人控制）形成了鲜明对比。训练能够存储和检索凭据的智能体也是应用强化学习技术时面临的另一个挑战，因为通常智能体并不具备内部记忆功能。这些都是可以利用该仿真进行基准测试的研究领域。\n\n其他感兴趣的方向还包括自主网络安全系统的负责任和伦理使用：如何设计一种能赋予防御者智能体内在优势的企业网络？如何开展旨在保护企业免受自主网络攻击的安全研究，同时防止此类技术被滥用？\n\n## 文档\n\n阅读项目的[快速入门](\u002Fdocs\u002Fquickintro.md)。\n\n## 构建状态\n\n| 类型 | 分支 | 状态 |\n| ---  | ------ | ------ |\n| CI   | master | ![.github\u002Fworkflows\u002Fci.yml](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fworkflows\u002F.github\u002Fworkflows\u002Fci.yml\u002Fbadge.svg) |\n| Docker镜像 | master | ![.github\u002Fworkflows\u002Fbuild-container.yml](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fworkflows\u002F.github\u002Fworkflows\u002Fbuild-container.yml\u002Fbadge.svg) |\n\n## 基准测试\n\n请参阅[基准测试文档](\u002Fdocs\u002Fbenchmark.md)。包含最新运行结果的Jupyter笔记本已通过专用标签提交至[\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks)。\n\n## 搭建开发环境\n\n强烈建议在Linux环境下工作，可以直接在Linux上操作，也可以通过Windows上的WSL进行。虽然直接在Windows上运行Python仍然可行，但已不再被官方支持。\n\n首先克隆仓库：\n\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim.git\n   ```\n\n### 操作系统组件\n\n如果在运行notebook中的papermill工具时遇到以下错误（或者在运行`orca --help`时出现类似问题）：\n```\n\u002Fhome\u002Fwiblum\u002Fminiconda3\u002Fenvs\u002Fcybersim\u002Flib\u002Forca_app\u002Forca: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory\n```\n或其他共享库如`libgdk_pixbuf-2.0.so.0`，\n则需要运行以下命令：\n```\nsudo apt install libnss3-dev libgtk-3-0 libxss1 libasound2-dev libgtk2.0-0 libgconf-2-4\n```\n\n### 在Linux或WSL上\n\n这些说明已在Linux Ubuntu发行版上进行了测试（包括原生Ubuntu和WSL版本）。\n\n如果尚未安装conda，需运行`install_conda.sh`脚本来安装。\n\n```bash\nbash install-conda.sh\n```\n\n安装完成后，打开一个新的终端并运行初始化脚本：\n```bash\nbash init.sh\n```\n这将创建一个名为`cybersim`的conda环境，其中包含所有必要的操作系统和Python依赖项。\n\n要激活该环境，请运行：\n\n```bash\nconda activate cybersim\n```\n\n#### Windows子系统Linux\n\n在Windows上推荐的开发环境是通过WSL。您需要先在Windows机器上安装Ubuntu WSL发行版，然后按照Linux部分的说明继续操作。\n\n#### WSL中的Git认证\n\n要进行Git认证，您可以选择使用SSH认证，或者使用credential-helper技巧自动生成PAT令牌。后者可以通过在WSL下运行以下命令来实现（[更多信息请点击这里](https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fwindows\u002Fwsl\u002Ftutorials\u002Fwsl-git))：\n\n```ps\ngit config --global credential.helper \"\u002Fmnt\u002Fc\u002FProgram\\ Files\u002FGit\u002Fmingw64\u002Flibexec\u002Fgit-core\u002Fgit-credential-manager.exe\"\n```\n\n#### WSL上的Docker\n\n若想在Docker容器中运行您的环境，我们建议通过Windows Subsystem for Linux (WSL)来运行docker，具体方法请参考：[在WSL下的Windows上安装Docker](https:\u002F\u002Fdocs.docker.com\u002Fdocker-for-windows\u002Fwsl-tech-preview\u002F)。\n\n### Windows（不支持）\n\n此方法已不再维护，请改用 WSL 子系统中的 Linux 环境运行。\n\n不过，如果您坚持要在 Windows 上安装 [Python 3.10](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Fwindows\u002F)，则可以在 PowerShell 提示符下运行 `.\u002Finit.ps1` 脚本。\n\n## 使用 Docker 快速入门\n\n最快捷的启动方式是通过 Docker 容器。\n\n> 注意：出于许可原因，我们不会公开分发任何构建产物。特别是，以下命令中提到的 Docker 注册表 `spinshot.azurecr.io` 仅对项目维护者开放。\n>\n> 作为替代方案，您可以使用提供的 `Dockerfile` 自行重建 Docker 镜像，将生成的镜像发布到您自己的 Docker 注册表，并替换下方命令中的注册表名称。\n\n### 从 Docker 注册表运行\n\n```bash\ncommit=7c1f8c80bc53353937e3c69b0f5f799ebb2b03ee\ndocker login spinshot.azurecr.io\ndocker pull spinshot.azurecr.io\u002Fcyberbattle:$commit\ndocker run -it spinshot.azurecr.io\u002Fcyberbattle:$commit python -m cyberbattle.agents.baseline.run\n```\n\n### 重新构建 Docker 镜像\n\n```bash\ndocker build -t cyberbattle:1.1 .\ndocker run -it -v \"$(pwd)\":\u002Fsource --rm cyberbattle:1.1 python -m cyberbattle.agents.baseline.run\n```\n\n## 检查您的环境\n\n运行以下命令以使用基线强化学习智能体进行模拟：\n\n```bash\npython -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\n\npython -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\n```\n\n如果一切设置正确，您应该会看到如下输出：\n\n```bash\ntorch cuda available=True\n###### DQL\nLearning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\n  ## Episode: 1\u002F1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\nEpisode 1|Iteration 10|reward:  139.0|Elapsed Time: 0:00:00|###################################################################|\n###### Random search\nLearning with: episode_count=1,iteration_count=10,ϵ=1.0,ϵ_min=0.0,\n  ## Episode: 1\u002F1 'Random search' ϵ=1.0000,\nEpisode 1|Iteration 10|reward:  194.0|Elapsed Time: 0:00:00|###################################################################|\nsimulation ended\nEpisode duration -- DQN=Red, Random=Green\n   10.00  ┼\nCumulative rewards -- DQN=Red, Random=Green\n  194.00  ┼      ╭──╴\n  174.60  ┤      │\n  155.20  ┤╭─────╯\n  135.80  ┤│     ╭──╴\n  116.40  ┤│     │\n   97.00  ┤│    ╭╯\n   77.60  ┤│    │\n   58.20  ┤╯ ╭──╯\n   38.80  ┤  │\n   19.40  ┤  │\n    0.00  ┼──╯\n```\n\n## Jupyter 笔记本\n\n为了快速熟悉该项目，您可以打开其中一个提供的 Jupyter 笔记本，与 Gymnasium 环境进行交互式体验。\n\n> 关于 `.py` 笔记本的说明：\n> - 我们的笔记本以 `.py` 文件形式提交到 Git 中。这些文件可以直接在 VSCode 或 Jupyter 中使用 [Jupytext 扩展](https:\u002F\u002Fjupytext.readthedocs.io\u002Fen\u002Flatest\u002Finstall.html) 打开并运行。\n> - 输出的 `.ipynb` 文件也可以使用 [papermill](https:\u002F\u002Fpypi.org\u002Fproject\u002Fpapermill\u002F) 通过运行 bash 脚本 [run_benchmark.sh](\u002Fnotebooks\u002Frun_benchmark.sh) 自动重新生成。\n> - 我们还会在单独的 Git 标签中发布包含完整输出和图表的相应 `.ipynb` 笔记本快照。\n最新的 Jupyter 笔记本输出快照，包括基准测试结果，可通过以下 Git 标签访问：[\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks)。\n\n一些入门笔记本：\n\n- “夺旗”玩具环境笔记本：\n  - [随机智能体](notebooks\u002Ftoyctf-random.py)\n  - [人类玩家交互式会话](notebooks\u002Ftoyctf-blank.py)\n  - [交互式会话——完全解题](notebooks\u002Ftoyctf-solved.py)\n\n- 链式环境笔记本：\n  - [随机智能体](notebooks\u002Fchainnetwork-random.py)\n\n- 其他环境：\n  - [与随机生成环境的交互式会话](notebooks\u002Frandomnetwork.py)\n  - [随机智能体在随机网络上玩耍](notebooks\u002Fc2_interactive_interface.py)\n\n- 基准测试：以下笔记本展示了基线智能体在各种环境上的基准评估。\n\n    - [在给定环境中进行基准测试](notebooks\u002Fnotebook_benchmark.py)\n    - [在链式环境中与基础防御者一起进行基准测试](notebooks\u002Fnotebook_withdefender.py)\n    - [DQL 迁移学习评估](notebooks\u002Fnotebook_dql_transfer.py)\n    - [带有凭据查找的 epsilon 贪婪策略](notebooks\u002Fnotebook_randlookups.py)\n    - [表格 Q 学习](notebooks\u002Fnotebook_tabularq.py)\n\n最新的 Jupyter 笔记本输出快照，包括基准测试结果，可通过以下 Git 标签访问：[\u002Fnotebooks\u002Fbenchmarks (latest_benchmark)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Ftree\u002Flatest_benchmark\u002Fnotebooks\u002Fbenchmarks)。\n\n## 如何实例化 Gym 环境？\n\n以下代码展示了如何创建 OpenAI Gym 环境 `CyberBattleChain-v0` 的实例，该环境基于 [链式网络结构](cyberbattle\u002Fsamples\u002Fchainpattern\u002Fchainpattern.py)，包含 10 个节点（`size=10`），其中智能体的目标是获得网络的完全控制权（`own_atleast_percent=1.0`）或破坏 80% 的网络可用性 SLA（`maintain_sla=0.80`），同时网络由基于概率模型的基础防御者监控和保护（`defender_agent=ScanAndReimageCompromisedMachines`）：\n\n```python\nimport cyberbattle._env.cyberbattle_env\n\ncyberbattlechain_defender =\n  gym.make('CyberBattleChain-v0',\n      size=10,\n      attacker_goal=AttackerGoal(\n          own_atleast=0,\n          own_atleast_percent=1.0\n      ),\n      defender_constraint=DefenderConstraint(\n          maintain_sla=0.80\n      ),\n      defender_agent=ScanAndReimageCompromisedMachines(\n          probability=0.6,\n          scan_capacity=2,\n          scan_frequency=5))\n```\n\n要尝试其他网络拓扑结构，可以参考 [chainpattern.py](cyberbattle\u002Fsamples\u002Fchainpattern\u002Fchainpattern.py) 定义您自己的机器和漏洞集合，然后在 [模块初始化器](cyberbattle\u002F__init__.py) 中添加条目，以声明并注册 Gym 环境。\n\n## 贡献\n\n本项目欢迎贡献和建议。大多数贡献都需要您签署贡献者许可协议（CLA），声明您有权且确实将您的贡献使用权授予我们。有关详细信息，请访问 https:\u002F\u002Fcla.opensource.microsoft.com。\n\n当您提交拉取请求时，CLA 机器人会自动判断您是否需要提供 CLA，并相应地标记 PR（例如状态检查、评论）。请按照机器人提供的指示操作。对于使用我们 CLA 的所有仓库，您只需执行此操作一次。\n\n本项目已采用 [微软开源行为准则](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002F)。更多信息请参阅 [行为准则常见问题解答](https:\u002F\u002Fopensource.microsoft.com\u002Fcodeofconduct\u002Ffaq\u002F) 或通过电子邮件 [opencode@microsoft.com](mailto:opencode@microsoft.com) 联系我们，以获取更多问题或意见。\n\n### 贡献思路\n\n以下是一些可能的贡献方向：增强仿真功能（基于事件的仿真、细化仿真等）、在现有仿真上训练强化学习算法、实现基准测试以评估和比较智能体的新颖性、添加更多网络生成模式以用于训练强化学习智能体、参与文档编写、修复 bug 等。\n\n更多创意请参阅 [维基页面](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleGym\u002Fwiki\u002FPossible-contributions)。\n\n## 引用本项目\n\n```bibtex\n@misc{msft:cyberbattlesim,\n  Author = {Microsoft Defender 研究团队},\n  Note = {由 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 创建},\n  Publisher = {GitHub},\n  Howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fcyberbattlesim}},\n  Title = {CyberBattleSim},\n  Year = {2021}\n}\n```\n\n## 隐私说明\n\n本项目不包含任何客户数据。所提供的模型和网络拓扑纯属虚构。使用本项目代码的用户需自行提供仿真所需的所有输入，并应确保拥有使用相关数据的必要权限。\n\n## 商标\n\n本项目可能包含与项目、产品或服务相关的商标或标识。未经授权使用微软商标或标识须遵守并遵循 [微软商标与品牌指南](https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Flegal\u002Fintellectualproperty\u002Ftrademarks\u002Fusage\u002Fgeneral)。在本项目的修改版本中使用微软商标或标识时，不得造成混淆或暗示微软的赞助关系。任何第三方商标或标识的使用均应遵守该第三方的相关政策。","# CyberBattleSim 快速上手指南\n\nCyberBattleSim 是一个基于 Python 和 Open AI Gym 的研究平台，用于在模拟的企业网络环境中训练自动化智能体（攻击者与防御者），探索强化学习在网络安全领域的应用。\n\n## 1. 环境准备\n\n### 系统要求\n- **推荐系统**：Linux (如 Ubuntu) 或 Windows 下的 WSL (Windows Subsystem for Linux)。\n- **不支持**：直接在 Windows PowerShell 中运行（已不再维护）。\n- **硬件**：支持 CUDA 的 GPU 可加速训练（可选）。\n\n### 前置依赖\n确保系统已安装以下基础库（针对 Ubuntu\u002FWSL）：\n```bash\nsudo apt install libnss3-dev libgtk-3-0 libxss1 libasound2-dev libgtk2.0-0 libgconf-2-4\n```\n\n## 2. 安装步骤\n\n### 方法一：使用 Conda 环境（推荐）\n\n1. **克隆仓库**\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim.git\n   cd CyberBattleSim\n   ```\n\n2. **安装 Conda（如未安装）**\n   ```bash\n   bash install-conda.sh\n   ```\n\n3. **初始化环境**\n   运行初始化脚本，它将创建名为 `cybersim` 的 Conda 环境并安装所有依赖：\n   ```bash\n   bash init.sh\n   ```\n\n4. **激活环境**\n   ```bash\n   conda activate cybersim\n   ```\n\n### 方法二：使用 Docker（最快捷）\n\n如果你希望跳过本地环境配置，可以直接使用 Docker 容器。\n\n**注意**：由于许可原因，官方镜像仓库 (`spinshot.azurecr.io`) 不公开。你需要使用项目提供的 `Dockerfile` 自行构建镜像。\n\n1. **构建镜像**\n   ```bash\n   docker build -t cyberbattle:1.1 .\n   ```\n\n2. **运行容器**\n   ```bash\n   docker run -it -v \"$(pwd)\":\u002Fsource --rm cyberbattle:1.1 python -m cyberbattle.agents.baseline.run\n   ```\n\n## 3. 基本使用\n\n环境配置完成后，可以通过运行基准测试脚本来验证安装并启动简单的强化学习训练。\n\n### 运行基准示例\n\n以下命令将启动一个包含基线 RL 智能体（DQL）和随机搜索智能体的模拟过程：\n\n```bash\npython -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\n```\n\n**预期输出：**\n如果配置正确，你将看到类似以下的训练日志和奖励图表：\n```text\ntorch cuda available=True\n###### DQL\nLearning with: episode_count=1,iteration_count=10,ϵ=0.9,ϵ_min=0.1, ϵ_expdecay=5000,γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\n  ## Episode: 1\u002F1 'DQL' ϵ=0.9000, γ=0.015, lr=0.01, replaymemory=10000,\nbatch=512, target_update=10\nEpisode 1|Iteration 10|reward:  139.0|Elapsed Time: 0:00:00|###################################################################|\n...\nsimulation ended\nCumulative rewards -- DQN=Red, Random=Green\n  194.00  ┼      ╭──╴\n  ...\n    0.00  ┼──╯\n```\n\n### 交互式探索 (Jupyter Notebooks)\n\n项目提供了多个 Jupyter Notebook 用于交互式实验。源代码以 `.py` 格式存储，可使用 VS Code 直接打开，或通过 `jupytext` 转换为 `.ipynb`。\n\n推荐入门笔记：\n- **随机智能体演示**: `notebooks\u002Ftoyctf-random.py`\n- **人类玩家交互会话**: `notebooks\u002Ftoyctf-blank.py`\n- **链式网络环境**: `notebooks\u002Fchainnetwork-random.py`\n\n如需查看带有完整运行结果和图表的最新笔记，请查阅仓库中的 `latest_benchmark` 标签页。","某网络安全研究团队正在开发基于强化学习的自主防御系统，旨在提升企业网络对自动化横向移动攻击的抵御能力。\n\n### 没有 CyberBattleSim 时\n- 研究人员必须在真实或高保真仿真环境中测试攻击代理，不仅成本高昂，还存在恶意代码意外泄露或破坏生产系统的风险。\n- 缺乏标准化的抽象网络环境，导致不同团队开发的防御算法难以在统一拓扑和漏洞设定下进行公平的性能基准对比。\n- 训练智能体需要处理海量的底层网络流量数据，使得模型难以聚焦于“凭证窃取”和“节点渗透”等核心策略的学习，收敛速度极慢。\n- 无法快速调整网络拓扑结构或漏洞分布参数，每次实验变更都需要重新搭建复杂的环境，严重拖慢了迭代效率。\n\n### 使用 CyberBattleSim 后\n- 团队利用其高度抽象的模拟环境安全地训练攻击与防御代理，既完全隔离了真实系统风险，又保留了博弈的核心逻辑。\n- 借助内置的 Open AI Gym 接口，研究人员能够直接在同一套参数化拓扑中对比不同强化学习算法的累积奖励和步数效率，确立了清晰的评估标准。\n- 通过忽略无关的网络流量细节，智能体得以专注于侧向移动策略的优化，显著缩短了从凭证存储到节点攻占的训练周期。\n- 仅需修改配置文件即可瞬间生成具有不同漏洞分布和网络结构的新场景，支持大规模并行实验以验证防御架构的鲁棒性。\n\nCyberBattleSim 通过提供一个安全、标准化且可高度定制的博弈沙盒，让研究人员能够低成本地加速自主网络安全智能体的进化与验证。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_CyberBattleSim_e9ba4cc8.png","microsoft","Microsoft","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmicrosoft_4900709c.png","Open source projects and samples from Microsoft",null,"opensource@microsoft.com","OpenAtMicrosoft","https:\u002F\u002Fopensource.microsoft.com","https:\u002F\u002Fgithub.com\u002Fmicrosoft",[25,29,33,37,41],{"name":26,"color":27,"percentage":28},"Jupyter Notebook","#DA5B0B",66.2,{"name":30,"color":31,"percentage":32},"Python","#3572A5",33.1,{"name":34,"color":35,"percentage":36},"Shell","#89e051",0.5,{"name":38,"color":39,"percentage":40},"PowerShell","#012456",0.1,{"name":42,"color":43,"percentage":40},"Dockerfile","#384d54",1762,278,"2026-04-08T23:59:00","MIT",3,"Linux, Windows (仅支持通过 WSL)","未说明 (输出日志显示支持 CUDA，但未明确指定显卡型号或显存需求)","未说明",{"notes":53,"python":54,"dependencies":55},"强烈建议在 Linux 环境或通过 Windows 的 WSL (Ubuntu 发行版) 运行，直接在 Windows 上运行 Python 已不再受支持。项目提供 install_conda.sh 和 init.sh 脚本来自动创建名为 'cybersim' 的 conda 环境并安装所有依赖。若在笔记本中遇到共享库缺失错误 (如 libXss.so.1)，需手动安装指定的 Linux 系统包。Docker 镜像需用户自行根据 Dockerfile 构建，官方不提供公共镜像拉取。","3.10 (Windows 部分明确提及)，Linux\u002FWSL 环境由 conda 脚本自动配置",[56,57,58,59,60,61,62,63,64,65],"conda","torch","gymnasium (Open AI Gym interface)","jupyter","papermill","libnss3-dev","libgtk-3-0","libxss1","libasound2-dev","docker (可选)",[67,68],"Agent","其他",2,"ready","2026-03-27T02:49:30.150509","2026-04-10T20:32:26.747436",[74,79,84,89,94,99],{"id":75,"question_zh":76,"answer_zh":77,"source_url":78},28134,"如何在 CyberBattleSim 环境中使用 Stable-Baselines3 等外部强化学习库？","可以使用 Stable-Baselines3 (SB3) 等库，但需注意关键区别：项目内置的算法包含动作有效性检查，而 SB3 默认没有。这意味着在使用 SB3 时，智能体经常会执行当前环境状态下不可能的动作。因此，在集成外部库时，可能需要自行添加动作验证逻辑或处理无效动作的情况。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fissues\u002F91",{"id":80,"question_zh":81,"answer_zh":82,"source_url":83},28135,"安装依赖项时 pip 解析时间过长或失败怎么办？","如果遇到 pip 安装依赖项耗时极长（如数小时）并最终失败，通常是因为依赖解析器在尝试多个版本。解决方案包括：1. 使用项目提供的 Docker 容器（通过 Dockerfile 构建并运行），这通常能避免环境冲突；2. 手动创建 conda 环境并使用项目包含的 requirements 文件安装。如果必须使用 pip，可能需要提供更严格的版本约束以减少解析时间。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fissues\u002F118",{"id":85,"question_zh":86,"answer_zh":87,"source_url":88},28136,"为什么在 Python 3.11 上运行会报错 'ValueError: mutable default'？","CyberBattleSim 目前不支持 Python 3.11，会导致可变默认参数错误。解决方法是修改 `env.yml` 文件，将 Python 版本限制为 3.9。具体操作是将 `python>=3.9` 改为 `python=3.9`，然后重新创建环境。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fissues\u002F111",{"id":90,"question_zh":91,"answer_zh":92,"source_url":93},28137,"使用 create_random_environment() 生成环境时报错或无法正常工作如何解决？","该问题通常由底层依赖包 `boolean.py` 的 bug 引起。解决方法是直接从 GitHub 安装 `boolean.py` 的主分支版本，而不是使用 PyPI 上的发布版。执行命令：`pip install boolean.py@git+https:\u002F\u002Fgithub.com\u002Fbastikr\u002Fboolean.py\u002F@master#egg=numpy_stubs`。安装后，请确保移除之前在 `actions.py` 和 `model.py` 中可能添加的任何临时变通代码。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fissues\u002F23",{"id":95,"question_zh":96,"answer_zh":97,"source_url":98},28138,"智能体通过不同方法重复发现同一节点时为何会重复获得奖励？","这是一个已知行为，旨在激励探索。目前的实现逻辑是对新发现的节点内在价值求和并乘以系数 c（当前 c=1），此外对新发现的凭证和节点属性也会给予固定奖励。虽然这可能导致同一节点通过不同路径被发现时产生多次奖励，但这被视为鼓励智能体尝试多种探测手段的设计。如果需要调整，可修改奖励计算逻辑中的系数 c 使其小于 1。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FCyberBattleSim\u002Fissues\u002F18",{"id":100,"question_zh":101,"answer_zh":102,"source_url":78},28139,"A2C\u002FPPO 与 DQN 算法在该环境中的表现有何差异？","根据用户测试，在相同的迭代次数（1500）和回合数（20）设置下，Stable-Baselines3 实现的 A2C 算法在 toy-ctf 环境中的平均回报（约 40）显著低于内置的 DQN 算法（约 450）。这可能是因为环境动作空间较大且复杂，而 SB3 代理缺乏针对该环境特定的动作有效性检查，导致大量无效尝试，从而影响了学习效率和最终性能。",[],[105,116,124,133,141,150],{"id":106,"name":107,"github_repo":108,"description_zh":109,"stars":110,"difficulty_score":48,"last_commit_at":111,"category_tags":112,"status":70},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,"2026-04-06T06:32:30",[67,113,114,115],"开发框架","图像","数据工具",{"id":117,"name":118,"github_repo":119,"description_zh":120,"stars":121,"difficulty_score":48,"last_commit_at":122,"category_tags":123,"status":70},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[113,114,67],{"id":125,"name":126,"github_repo":127,"description_zh":128,"stars":129,"difficulty_score":69,"last_commit_at":130,"category_tags":131,"status":70},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",149489,"2026-04-10T11:32:46",[113,67,132],"语言模型",{"id":134,"name":135,"github_repo":136,"description_zh":137,"stars":138,"difficulty_score":69,"last_commit_at":139,"category_tags":140,"status":70},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[113,114,67],{"id":142,"name":143,"github_repo":144,"description_zh":145,"stars":146,"difficulty_score":69,"last_commit_at":147,"category_tags":148,"status":70},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[149,67,114,113],"插件",{"id":151,"name":152,"github_repo":153,"description_zh":154,"stars":155,"difficulty_score":48,"last_commit_at":156,"category_tags":157,"status":70},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[132,114,67,113]]