forked from tenable/integrations-ibm-cloudpak-for-security
-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
64 lines (52 loc) · 2.17 KB
/
app.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import argparse, os
from typing import List
from car_framework.context import context
from car_framework.app import BaseApp
from car_framework.extension import SchemaExtension
from connector.server_access import AssetServer
from connector.full_import import FullImport
from connector.inc_import import IncrementalImport
version = '1.0.1'
class App(BaseApp):
def __init__(self):
super().__init__('This script is used for pushing asset data to CP4S CAR ingestion microservice')
# Add parameters need to connect data source
self.parser.add_argument('-tio-access-key', dest='tioAccessKey', default=os.getenv('CONFIGURATION_AUTH_TIO_ACCESS_KEY',None), type=str, required=False, help='Tenable.io access key')
self.parser.add_argument('-tio-secret-key', dest='tioSecretKey', default=os.getenv('CONFIGURATION_AUTH_TIO_SECRET_KEY',None), type=str, required=False, help='Tenable.io secret key')
def setup(self):
super().setup()
context().asset_server = AssetServer()
context().full_importer = FullImport()
context().inc_importer = IncrementalImport()
def get_schema_extension(self):
return SchemaExtension(
key = '1f6ab337-b1ac-4558-8dc5-e97b4c666415',
owner = 'Tenable IO Connector',
version = '1',
schema = '''
{
"vertices": [
{
"name": "vulnerability",
"properties": {
"links": {
"type": "jsonb"
},
"cpes": {
"type": "jsonb"
},
"solution": {
"type": "text"
},
"synopsis": {
"type": "text"
}
}
}
]
}
'''
)
app = App()
app.setup()
app.run()