-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (26 loc) · 1014 Bytes
/
Copy pathmain.py
File metadata and controls
39 lines (26 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import argparse
from analyzer.source.aws.config import collect as collect_aws
import yaml
import boto3
from neomodel import config as neo_config
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(current_dir)
def load_config(file_path):
with open(file_path, 'r') as file:
config = yaml.safe_load(file)
return config
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Network Analyzer')
parser.add_argument('--config', type=str, help='Path to the configuration file',
default="config.yml", required=False)
args = parser.parse_args()
config = load_config(args.config)
db = config.get('neo4j', "")
if db == "":
db = f'bolt://{os.environ.get("NEO4J_USER","neo4j")}:{os.environ.get("NEO4J_PASSWORD","neo4j")}@neo4j:7687'
neo_config.DATABASE_URL = db
debug = config.get('debug', False)
if config.get('aws'):
collect_aws(config.get('aws'), debug)