@@ -65,21 +65,40 @@ def is_up(self) -> bool:
65
65
return False
66
66
return r .status_code == 200
67
67
68
- def redis_up (self ) -> bool :
69
- '''Check if redis is up and running'''
70
- r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'redis_up' ))))
68
+ # #### DB & system status ####
69
+
70
+ def check_process (self ) -> dict [str , Any ]:
71
+ '''[Authentication Required] Checks the hearbeats of the various processes.'''
72
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('system' , 'checkProcess' ))))
73
+ return r .json ()
74
+
75
+ def check_smtp (self ) -> dict [str , Any ]:
76
+ '''[Authentication Required] Checks the SMTP connection.'''
77
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('system' , 'checkSMTP' ))))
71
78
return r .json ()
72
79
73
- # #### DB status ####
80
+ def get_config_info (self ) -> dict [str , Any ]:
81
+ '''Returns non-sensitive information about the configuration of the system.'''
82
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'configInfo' ))))
83
+ return r .json ()
74
84
75
85
def get_info (self ) -> dict [str , Any ]:
76
- '''Get more information about the current databases in use and when it was updated'''
86
+ '''Returns information about the current sources in the Kvrocks database in use and when it was updated. '''
77
87
r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'dbInfo' ))))
78
88
return r .json ()
79
89
80
- def get_config_info (self ) -> dict [str , Any ]:
81
- '''Get more information about the current databases in use and when it was updated'''
82
- r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'configInfo' ))))
90
+ def get_pg_info (self ) -> dict [str , Any ]:
91
+ '''[Authentication Required] Returns information about the PostgreSQL database.'''
92
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'pgInfo' ))))
93
+ return r .json ()
94
+
95
+ def redis_up (self ) -> bool :
96
+ '''[Deprecated] Check if redis/valkey is up and running'''
97
+ return self .valkey_up ()
98
+
99
+ def valkey_up (self ) -> bool :
100
+ '''Check if valkey is up and running'''
101
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'system' , 'redis_up' ))))
83
102
return r .json ()
84
103
85
104
# #### Vulnerabilities ####
@@ -432,3 +451,33 @@ def get_epss(self, vulnerability: str) -> dict[str, Any]:
432
451
'''
433
452
r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'epss' , vulnerability ))))
434
453
return r .json ()
454
+
455
+ # #### CWE ####
456
+
457
+ def get_cwes (self ) -> dict [str , Any ]:
458
+ '''Get the list of CWEs'''
459
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'cwe' ))))
460
+ return r .json ()
461
+
462
+ def get_cwe (self , cwe_id : str ) -> dict [str , Any ]:
463
+ '''Get a CWE
464
+
465
+ :param cwe_id: The CWE ID
466
+ '''
467
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'cwe' , cwe_id ))))
468
+ return r .json ()
469
+
470
+ # #### CAPEC ####
471
+
472
+ def get_capecs (self ) -> dict [str , Any ]:
473
+ '''Get the list of CAPECs'''
474
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'capec' ))))
475
+ return r .json ()
476
+
477
+ def get_capec (self , capec_id : str ) -> dict [str , Any ]:
478
+ '''Get a CAPEC
479
+
480
+ :param capec_id: The CAPEC ID
481
+ '''
482
+ r = self .session .get (urljoin (self .root_url , str (PurePosixPath ('api' , 'capec' , capec_id ))))
483
+ return r .json ()
0 commit comments