mal-lang / mal-traverser

Graph algorithms for MAL attack graphs generated by mal-toolbox.
0 stars 1 forks source link

Attribute Error and unable to generate the Attack tree #5

Closed Chinmaykhuspare closed 1 month ago

Chinmaykhuspare commented 2 months ago

Screenshot 2024-08-28 at 9 51 45 PM

I have runned the Mal traverser on my machine Installed it Connected to the same neo4j software in such a way that It directly generates the attack tree from the python scripts

I am successful in connecting to the neo4j server

But at the last stage before generating the attack tree I am getting one attribute error Which i don't know what is it about

mrkickling commented 2 months ago

Hi @Chinmaykhuspare! The MAL Traverser does not currently work with MAL Toolbox version > 0.0.28.

Option 1: Use the branch in this PR which contains updated MAL Traverser that works with current MAL Toolbox version: #3 . It is still work in progress but could work for your needs.

Option 2: Downgrade MAL Toolbox to 0.0.28 (pip install mal-toolbox==0.0.28 and run the MAL traverser again.

Option 3: Wait for the PR I linked (#3) to be merged.

Hope this solves your problem, otherwise let us know!

Chinmaykhuspare commented 2 months ago

Thanks @mrkickling i will try that once and get back to you!

Chinmaykhuspare commented 2 months ago

hello. @mrkickling i am attaching the screenshot of the error which i am getteing in my terminal can you please explain what i could do to run my code and generate the attack graph? i am also attaching the screenshot of my code please help if possible? Screenshot 2024-08-29 at 11 49 34 AM Screenshot 2024-08-29 at 11 45 20 AM Screenshot 2024-08-29 at 11 24 04 AM

Chinmaykhuspare commented 2 months ago

also, it does not contain the Model class in the maltoolbox.model, that why i am getting the error. what do you think? how can i resolve it?

Chinmaykhuspare commented 2 months ago

also, do i need to edit the python script or is it okay?

mrkickling commented 2 months ago

Hi again @Chinmaykhuspare !

It looks to me like you are using the branch in PR #3 and also downgraded MAL-toolbox to 0.0.28, I meant to pick only one of the options in my previous reply.

Since you now seem to be running the updated branch of mal-traverser, I suggest that you install the newest version of mal-toolbox (0.1.8, pip install mal-toolbox==0.1.8) again and try to run main.py. Let me know if that works.

If it does not work, go back to branch master in this repository and use MAL-toolbox 0.0.28 to run main.py and see if that works.

mrkickling commented 2 months ago

You don't need to edit the python script, just add your neo4j user details in constants.py.

Chinmaykhuspare commented 2 months ago

Screenshot 2024-08-29 at 12 22 10 PM

i am using the master branch and my maltoolbox version is 0.0.28 still i am getting the errors, should i change the versions?

Chinmaykhuspare commented 2 months ago

and could you also send me a sample attack graph that is generated by the neo4j after running the main.py in the neo4j?

mrkickling commented 2 months ago

I can not reproduce the issue:

(venv) mrkickling@pop-os:/tmp/mal-traverser$ git branch
* master
(venv) mrkickling@pop-os:/tmp/mal-traverser$ pip show mal-toolbox
Name: mal-toolbox
Version: 0.0.28
Summary: A collection of tools used to create MAL models and attack graphs.
Home-page: https://github.com/mal-lang/mal-toolbox
Author: 
Author-email: Andrei Buhaiu <buhaiu@kth.se>, Giuseppe Nebbione <nebbione@kth.se>, Nikolaos Kakouros <nkak@kth.se>, Jakob Nyberg <jaknyb@kth.se>
License: Apache Software License
Location: /tmp/mal-traverser/venv/lib/python3.10/site-packages
Requires: py2neo, python-jsonschema-objects
Required-by: 

With this setup I can run main.py without any issue. Are you sure the python that you are using is the one in your env? Sorry, not sure if I can help any further here since I can not reproduce..

Chinmaykhuspare commented 2 months ago

hi @mrkickling i am able to run the MAL traverser now i forgot to make the changes of local host in constants.py thanks

mrkickling commented 2 months ago

Good to hear! I am will soon in #3 which will support newest MAL-toolbox.