Skip to content

Commit d4c3970

Browse files
authored
recovered editor changers
1 parent 4e07682 commit d4c3970

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

USING_NEO4J.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Neo4j graph database Python STIX DataStore is a proof-of-concept implementat
44

55
## Limitations:
66

7-
As a proof-of-concept it is mininal in its functionality.
7+
As a proof-of-concept it has minimal functionality.
88

99
## Installing Neo4j
1010

@@ -14,29 +14,64 @@ This will install the neo4j desktop application, which contains the neo4j browse
1414

1515
## Installing Neo4j python library
1616

17-
The python neo4j library used is py2neo, available in pypi at https://pypi.org/project/py2neo/. Note this library is no longer being supported and has reached the "end-of-life". A different implementation could be written using https://neo4j.com/docs/api/python-driver/current/.
17+
The python neo4j library used is py2neo, available in pypi at https://pypi.org/project/py2neo/. Note this library is no longer being supported and has reached the "end-of-life". A different implementation of the DataStore could be written using https://neo4j.com/docs/api/python-driver/current/.
1818

1919
## Implementation Details
2020

2121
We would like to that the folks at JHU/APL for their implementation of [STIX2NEO4J.py](https://github.com/opencybersecurityalliance/oca-iob/tree/main/STIX2NEO4J%20Converter), which this code is based on.
22+
2223
Only the DataSink (for storing STIX data) part of the DataStore object has been implemented. The DataSource part is implemented as a stub. However, the graph database can be queried using the neo4j cypher langauge within
2324
the neo4j browser
2425

25-
The main concept behind any graphs are nodes and edges. STIX data is similar as it contains relationship objects (SROs) and node objects (SDOs, SCOs and SMOs). The division of data in STIX was a natural fit
26+
The main concept behind any graphs are nodes and edges. STIX data is similar as it contains relationship objects (SROs) and node objects (SDOs, SCOs and SMOs). The division of data in STIX is a natural fit
2627
into the Neo4j model. Additional edges are provided by STIX embedded relationships, which are expressed as properties in node objects.
2728

28-
The order in which STIX objects are added to the graph database is arbitrary. Therefore, when an SRO or embedded relationship is added to the database, the nodes that it connects may not exist. Therefore, whenever a node is
29-
added to the database, the unconnected relationships must be reviewed to determine if both nodes of those relationships can now be represented using an edge in the graph database. Note that unless both the source and target nodes are added,
30-
the relationship will not added either. How to address this issue has not been determined.
29+
The order in which STIX objects are added to the graph database is arbitrary. Therefore, when an SRO or embedded relationship is added via the DataStore, the nodes that it connects may not be present in the database, so the relationship is not added to the database, but remembered by the DataStore code as an unconnected relationship. Whenever a new node is
30+
added to the database, the unconnected relationships must be reviewed to determine if both nodes of a relationship can now be represented using an edge in the graph database.
31+
32+
Note that unless both the source and target nodes are eventually added,
33+
the relationship will not be added either.
34+
How to address this issue in the implementation has not been determined.
3135

3236
## Demonstrating a neo4j database for STIX
3337

34-
Open the neo4j desktop app create a new project named STIX
38+
Open the neo4j desktop app create a new project named STIX.
39+
40+
Select local DBMS on your local machine.
41+
42+
<img src="docs/diagrams/select-dbms.png" width="500" height="250">
43+
44+
Create the database.
45+
46+
<img src="docs/diagrams/create-dbms.png" width="500" height="300">
47+
48+
Start the database.
49+
50+
<img src="docs/diagrams/start-dbms.png" width="500" height="120">
51+
52+
python demo.py \<STIX bundle file\> is used populate a local neo4j database which can be viewed using the neo4j browser.
53+
A sample bundle file bundle--21531315-283d-4604-8501-4b7166e58c84.json is provided in the docs directory.
54+
55+
Open the neo4j browser to view the database.
56+
57+
<img src="docs/diagrams/open-browser.png" width="500" height="250">
58+
59+
Query using the cypher language.
60+
61+
<img src="docs/diagrams/query-for-incident.png" width="750" height="450">
62+
63+
Clicking left on a node, gives you a choice of adding all related nodes and edges, removing the node and its edges from the display, or locking the node position.
64+
65+
<img src="docs/diagrams/node-actions.png" width="500" height="320">
66+
67+
Remove the report object node for a better view of the graph.
68+
69+
<img src="docs/diagrams/dont-show-node-and-edges.png" width="750" height="450">
3570

36-
python demo.py <STIX bundle file> will populate a local neo4j database which can be viewed using the neo4j browser.
71+
Explore the graph.
3772

38-
![](docs/diagrams/select-dbms.png "")
73+
<img src="docs/diagrams/exploring-the-graph.png" width="750" height="450">
3974

40-
![](docs/diagrams/create-dbms.png "")
75+
View the node properties, by mousing on any node.
4176

42-
![](docs/diagrams/start-dbms.png "")
77+
<img src="docs/diagrams/node-properties.png" width="750" height="450">

0 commit comments

Comments
 (0)