Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
5135fb6
Nice multiline f-string format in _create_relatie_by_dict
soved Nov 16, 2022
c950fa9
update
soved Nov 24, 2022
9edb37a
Revert "update"
soved Nov 24, 2022
1011831
Nice multiline f-string format in _create_relatie_by_dict
soved Nov 16, 2022
68dd320
update
soved Nov 24, 2022
705b9fc
Revert "update"
soved Nov 24, 2022
fd0c542
format error handling
soved Nov 28, 2022
94f9b70
Merge remote-tracking branch 'origin/master'
soved Dec 6, 2022
eb69014
Update
soved Dec 15, 2022
ef59103
Revert "update"
soved Nov 24, 2022
2821b97
Update
soved Dec 15, 2022
400cc4b
update
soved Dec 20, 2022
2eac80e
Merge remote-tracking branch 'origin/master'
soved Dec 20, 2022
0a8df5c
update
soved Nov 24, 2022
50f7920
Revert "update"
soved Nov 24, 2022
c5e03c0
update
soved Jan 13, 2023
f814f34
Merge remote-tracking branch 'origin/master'
soved Jan 13, 2023
21a619b
Nice multiline f-string format in _create_relatie_by_dict
soved Nov 16, 2022
55fa28d
update
soved Nov 24, 2022
297e1ff
Revert "update"
soved Nov 24, 2022
9b5d093
format error handling
soved Nov 28, 2022
cba1df5
Revert "update"
soved Nov 24, 2022
73ce772
Update
soved Dec 15, 2022
862584b
update
soved Dec 20, 2022
0bcc1f8
update
soved Nov 24, 2022
1564613
Revert "update"
soved Nov 24, 2022
03b8896
update
soved Jan 13, 2023
230d31c
update
soved Nov 24, 2022
361894f
Revert "update"
soved Nov 24, 2022
f8f5cf0
Update
soved Dec 15, 2022
d3f32ae
update
soved May 3, 2023
61d98ae
Merge remote-tracking branch 'origin/master'
soved May 3, 2023
fd0a3c0
Nice multiline f-string format in _create_relatie_by_dict
soved Nov 16, 2022
6e16bc4
update
soved Nov 24, 2022
daa01d4
Revert "update"
soved Nov 24, 2022
7639b1b
format error handling
soved Nov 28, 2022
0c32216
Revert "update"
soved Nov 24, 2022
6858bca
Update
soved Dec 15, 2022
08c7907
update
soved Dec 20, 2022
8998f0f
update
soved Nov 24, 2022
5559863
Revert "update"
soved Nov 24, 2022
a9f3ffb
update
soved Jan 13, 2023
ce16dae
update
soved Nov 24, 2022
d972852
Revert "update"
soved Nov 24, 2022
9ec70ce
Update
soved Dec 15, 2022
ed0b64c
update
soved May 3, 2023
2c933c5
update
soved Nov 24, 2022
c478a1e
Revert "update"
soved Nov 24, 2022
ab74acd
format error handling
soved Nov 28, 2022
8b7dc30
Revert "update"
soved Nov 24, 2022
c87b433
Update
soved Dec 15, 2022
a8a3d69
update
soved Nov 24, 2022
e19dd78
Revert "update"
soved Nov 24, 2022
af6f13e
update
soved Jan 13, 2023
b010bd4
update
soved Nov 24, 2022
153fb6b
Revert "update"
soved Nov 24, 2022
94f0c26
Update
soved Dec 15, 2022
fb41844
update
soved Mar 7, 2024
f70f0c2
Merge remote-tracking branch 'origin/master'
soved Mar 7, 2024
c492f59
SetUp-AIM idea
soved Sep 26, 2024
4d6715f
update
soved Sep 26, 2024
67fac54
update
soved Sep 26, 2024
cc7ed9e
update
soved Nov 24, 2022
dd9d118
Revert "update"
soved Nov 24, 2022
964454b
format error handling
soved Nov 28, 2022
598a0ae
Revert "update"
soved Nov 24, 2022
9760e18
update
soved Dec 20, 2022
af5d040
update
soved Nov 24, 2022
1c94d94
Revert "update"
soved Nov 24, 2022
a3617b5
update
soved Jan 13, 2023
7add6dc
update
soved Nov 24, 2022
254732c
Revert "update"
soved Nov 24, 2022
d02e1c1
Update
soved Dec 15, 2022
0437917
update
soved May 3, 2023
e0b7c98
update
soved Nov 24, 2022
e140307
Revert "update"
soved Nov 24, 2022
503d414
format error handling
soved Nov 28, 2022
b7732c0
Revert "update"
soved Nov 24, 2022
12fa94c
Update
soved Dec 15, 2022
4bd9727
update
soved Nov 24, 2022
04da690
Revert "update"
soved Nov 24, 2022
aaec7a5
update
soved Jan 13, 2023
b40c0f1
update
soved Nov 24, 2022
3296a87
Revert "update"
soved Nov 24, 2022
83ef174
Update
soved Dec 15, 2022
c35db9c
update
soved Mar 7, 2024
e5878d2
update
soved Nov 24, 2022
b18a3b0
Revert "update"
soved Nov 24, 2022
9ec9908
format error handling
soved Nov 28, 2022
323eb3f
Revert "update"
soved Nov 24, 2022
cdb2745
Update
soved Dec 15, 2022
a993d78
update
soved Nov 24, 2022
b8804f8
Revert "update"
soved Nov 24, 2022
16af81a
update
soved Jan 13, 2023
570b8d2
update
soved Nov 24, 2022
4639e88
Revert "update"
soved Nov 24, 2022
2c5a4d9
Update
soved Dec 15, 2022
6e736c6
update
soved May 3, 2023
f97f973
update
soved Nov 24, 2022
90b5fd5
Revert "update"
soved Nov 24, 2022
f05ed9c
format error handling
soved Nov 28, 2022
0586db8
Revert "update"
soved Nov 24, 2022
b5685fc
Update
soved Dec 15, 2022
a452f80
update
soved Nov 24, 2022
9d4de6c
Revert "update"
soved Nov 24, 2022
8dcc7c5
update
soved Jan 13, 2023
4d91dea
update
soved Nov 24, 2022
8b017aa
Revert "update"
soved Nov 24, 2022
e8940ee
Update
soved Dec 15, 2022
cdec3cf
update
soved Sep 26, 2024
0524027
Merge remote-tracking branch 'origin/master'
soved Nov 13, 2024
683759a
update
soved Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/venv/
/.idea/
./settings_neo4jmodelcreator.json
./settings_neo4jmodelcreator.json!/main.py
main.py
3 changes: 3 additions & 0 deletions Enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ class Environment(Enum):
DEV = 'dev',
TEI = 'tei',
AIM = 'aim'
edison_acc = 'edison-acc'
edison = 'edison'


class AuthType(Enum):
JWT = 'JWT',
CERT = 'cert',
COOKIE = 'cookie'
local = 'local'
11 changes: 6 additions & 5 deletions SetUp-AIM.cypher
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Set-up database
CREATE OR REPLACE USER neo4jPython SET PASSWORD "python" SET PASSWORD CHANGE NOT REQUIRED;
CREATE OR REPLACE USER neo4jPython SET PASSWORD "2AN3jjki!!ukEA#t" SET PASSWORD CHANGE NOT REQUIRED;
GRANT ROLE admin to neo4jPython;

CALL apoc.periodic.iterate('MATCH (n) RETURN n', 'DETACH DELETE n', {batchSize:1000})
CALL apoc.periodic.iterate('MATCH (n) RETURN n', 'DETACH DELETE n', {batchSize:1000});

MATCH (n)-[r]->(m)
RETURN n,r,m
RETURN n,r,m;

RETURN apoc.version() AS output;

// Create indexes
DROP constraint ON (n:Asset) ASSERT n.uuid is UNIQUE;
DROP constraint ON (n:Agent) ASSERT n.uuid is UNIQUE;
// DROP constraint ON (n:Asset) ASSERT n.uuid is UNIQUE;
// DROP constraint ON (n:Agent) ASSERT n.uuid is UNIQUE;
CALL apoc.schema.assert({}, {});
CREATE CONSTRAINT asset_uuid IF NOT EXISTS FOR (n:Asset) REQUIRE n.uuid IS UNIQUE;
CREATE CONSTRAINT agent_uuid IF NOT EXISTS FOR (n:Agent) REQUIRE n.uuid IS UNIQUE;
CREATE INDEX actief FOR (n:Asset) ON (n.isActief);
Expand Down
77 changes: 77 additions & 0 deletions environment-Neo4jOSLOFromAwvInfra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Neo4jOSLOFromAwvInfra
channels:
- conda-forge
- defaults
dependencies:
- bzip2=1.0.8=he774522_0
- ca-certificates=2022.12.7=h5b45459_0
- libffi=3.4.2=hd77b12b_4
- openssl=1.1.1s=h2bbff1b_0
- pip=22.1.2=py310haa95532_0
- python=3.10.4=hbb2ffb3_0
- python-decouple=3.6=pyhd8ed1ab_0
- setuptools=63.4.1=py310haa95532_0
- sqlite=3.39.2=h2bbff1b_0
- tk=8.6.12=h2bbff1b_0
- vc=14.2=h21ff451_1
- vs2015_runtime=14.27.29016=h5e58377_2
- wheel=0.37.1=pyhd3eb1b0_0
- wincertstore=0.2=py310haa95532_2
- xz=5.2.6=h8cc25b3_0
- zlib=1.2.12=h8cc25b3_3
- pip:
- asttokens==2.0.5
- backcall==0.2.0
- beautifulsoup4==4.10.0
- certifi==2021.10.8
- cffi==1.15.0
- charset-normalizer==2.0.11
- colorama==0.4.4
- contourpy==1.0.5
- cryptography==36.0.2
- cycler==0.11.0
- decorator==5.1.1
- docopt==0.6.2
- executing==0.8.3
- fonttools==4.37.4
- idna==3.3
- isodate==0.6.1
- jinja2==3.1.1
- js2py==0.71
- jsonpickle==2.1.0
- kiwisolver==1.4.4
- markupsafe==2.1.1
- matplotlib==3.6.1
- matplotlib-inline==0.1.3
- neo4j==4.4.1
- networkx==2.8
- numpy==1.23.3
- packaging==21.3
- parso==0.8.3
- pickleshare==0.7.5
- pillow==9.2.0
- pipwin==0.5.1
- prompt-toolkit==3.0.29
- pure-eval==0.2.2
- pycparser==2.21
- pygments==2.11.2
- pyjsparser==2.7.1
- pyjwt==2.3.0
- pyparsing==3.0.7
- pyprind==2.11.3
- pysmartdl==1.3.4
- python-dateutil==2.8.2
- pytz==2021.3
- pytz-deprecation-shim==0.1.0.post0
- rdflib==6.1.1
- requests==2.27.1
- six==1.16.0
- soupsieve==2.3.1
- stack-data==0.2.0
- timer==0.2.2
- traitlets==5.1.1
- tzdata==2021.5
- tzlocal==4.1
- urllib3==1.26.8
- wcwidth==0.2.5
prefix: C:\Users\devosar\Anaconda3\envs\Neo4jOSLOFromAwvInfra
35 changes: 17 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
import json
import logging
from pathlib import Path

from AbstractRequester import AbstractRequester
from EMInfraImporter import EMInfraImporter
from Enums import AuthType, Environment
from Neo4JConnector import Neo4JConnector
from RequestHandler import RequestHandler
from RequesterFactory import RequesterFactory
from SettingsManager import SettingsManager
from Enums import AuthType, Environment
from Syncer import Syncer

from decouple import Config, RepositoryEnv

if __name__ == '__main__':
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')

connector = Neo4JConnector(uri="bolt://localhost:7687", user="neo4j", password="neo4jadmin", database='neo4j')
settings_path = Path('/home/davidlinux/Documents/AWV/resources/settings_neo4jmodelcreator.json')
# settings_path = Path('C:\\resources\\settings_neo4jmodelcreator.json')

with open(settings_path) as settings_file:
settings = json.load(settings_file)
#Test
# Settings
logging.basicConfig(level=logging.INFO)
config = Config(RepositoryEnv(r"C:\Users\devosar\PycharmProjects\Intelligent Incident Detection (IID)\utils\.env"))

requester = RequesterFactory.create_requester(settings=settings, auth_type=AuthType.JWT, env=Environment.PRD)
# Set up connection to Neo4j instance (DBMS)
username = config('username_neo4j', default='') # not just username because this is predefined variable, see .env
password = config('password_neo4j', default='')
connector = Neo4JConnector(uri="bolt://localhost:7687", user=username, password=password)

# Syncing settings
settings_manager = SettingsManager(settings_path='.\\settings_neo4jmodelcreator.json')
requester = RequesterFactory.create_requester(settings=settings_manager.settings, auth_type=AuthType.JWT, env=Environment.PRD)
# request_handler = RequestHandler(requester)
#
# eminfra_importer = EMInfraImporter(request_handler)
eminfra_importer = EMInfraImporter(requester)
syncer = Syncer(connector=connector, requester=requester, eminfra_importer=eminfra_importer, settings=settings)
syncer = Syncer(connector=connector, requester=requester, eminfra_importer=eminfra_importer, settings=settings_manager.settings)
syncer.start_syncing()