Git Product home page Git Product logo

Comments (9)

jaromiru avatar jaromiru commented on May 18, 2024 1

I could repro but I had to first fix another bug in environment_generation.py where the agent was not installed on any node of the graph:

e287436#diff-d01efcd79fb6d8316931c9a4f8a9578bc9908c4c69f2c613e606db2ebff3944f

Ouch, my bad. Forgot to mention that :-D

I'll get to test it on Monday.

from cyberbattlesim.

jaromiru avatar jaromiru commented on May 18, 2024

Temporarily fixed by replacing

precondition=model.Precondition(f"Linux&(~{ADMINTAG})"),

with

        precondition=model.Precondition(f"Linux&(~({ADMINTAG}&{ADMINTAG}))"),

from cyberbattlesim.

blumu avatar blumu commented on May 18, 2024

@jaromiru I cannot repro. Could you confirm which version of boolean.py you have installed?
Here is what I have:

~/CyberBattleSim_public$ pip freeze | grep bool
boolean.py==3.8

Repro:

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()

Output:

Empty DataFrame
Columns: []
Index: []

from cyberbattlesim.

jaromiru avatar jaromiru commented on May 18, 2024

That's weird. I have boolean.py==3.8. The error is present. When I fix it with the fix above, the output looks like:

  id status                                         properties                                  local_attacks  remote_attacks
0  5  owned  [Win7, PortSMBOpen, PortRDPOpen, DomainJoined,...  [UACME55, UACME52, UACME43, UACME61, UACME45]  [RDPBF, SMBBF]

Not an empty DataFrame.

Are you sure the import from cyberbattle.simulation.environment_generation import create_random_environment is importing from your ~/CyberBattleSim_public and not from somewhere else, maybe previously installed with pip install .?

from cyberbattlesim.

blumu avatar blumu commented on May 18, 2024

Yes the import is loading from my source directory:

> print(commandcontrol.__file__)
/home/azureuser/CyberBattleSim_public/cyberbattle/simulation/commandcontrol.py

I am also using Python version 3.8.9, not sure if this matters. I'll keep trying to get a repro.

from cyberbattlesim.

jaromiru avatar jaromiru commented on May 18, 2024

The problem is definitely within the boolean library.

import boolean

ALGEBRA = boolean.BooleanAlgebra()
ALGEBRA.parse('1&~1').simplify() # OK

ALGEBRA.TRUE.dual = type(ALGEBRA.FALSE)
ALGEBRA.FALSE.dual = type(ALGEBRA.TRUE)
ALGEBRA.parse('1&~1').simplify() # Exception
$ pip freeze | grep boolean
boolean.py==3.8

$ python -V
Python 3.8.10

from cyberbattlesim.

blumu avatar blumu commented on May 18, 2024

I could repro but I had to first fix another bug in environment_generation.py where the agent was not installed on any node of the graph:

e287436#diff-d01efcd79fb6d8316931c9a4f8a9578bc9908c4c69f2c613e606db2ebff3944f

from cyberbattlesim.

blumu avatar blumu commented on May 18, 2024

@jaromiru The main branch of the boolean.py package has an alternative fix for this bug. It's not yet released on PyPI though:
https://github.com/bastikr/boolean.py/pull/100/files

from cyberbattlesim.

blumu avatar blumu commented on May 18, 2024

@jaromiru I have just verified that the fix in branch master of boolean.py resolves the issue. You do need to remove the other workaround from actions.py and model.py otherwise you'll still get the exception. Since the fix is not release yet on PyPi it needs to be installed from github with:

pip install boolean.py@git+https://github.com/bastikr/boolean.py/@master#egg=numpy_stubs

I'll send a PR with a fix soon.

from cyberbattlesim.

Related Issues (20)

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.