1use crate::{error::Error as E,client::Client};
2#[path="../blocking/db.rs"] mod db;
3use serde::de::DeserializeOwned as DOwned;
4use std::fs::File;
5use std::collections::HashMap;
6
7pub async fn hosts<T:DOwned>(client:Client) -> Result<T,E> {
8 db::hosts(client)
9}
10pub async fn get_host<T:DOwned>(client:Client,workspace:Option<String>,host:&str) -> Result<T,E> {
11 db::get_host(client,workspace,host)
12}
13pub async fn report_host<T:DOwned>(client:Client,workspace:Option<String>,host:&str) -> Result<T,E> {
14 db::report_host(client,workspace,host)
15}
16pub async fn del_host<T:DOwned>(client:Client,workspace:Option<String>,host:&str) -> Result<T,E> {
17 db::del_host(client,workspace,host)
18}
19
20pub async fn services<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
21 db::services(client,hash)
22}
23pub async fn report_service<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
24 db::report_service(client,hash)
25}
26pub async fn get_service<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
27 db::get_service(client,hash)
28}
29pub async fn del_service<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
30 db::del_service(client,hash)
31}
32
33pub async fn vulns<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
34 db::vulns(client,hash)
35}
36pub async fn del_vuln<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
37 db::del_vuln(client,hash)
38}
39pub async fn report_vuln<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
40 db::report_vuln(client,hash)
41}
42pub async fn get_vuln<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
43 db::get_vuln(client,hash)
44}
45
46pub async fn workspaces<T:DOwned>(client:Client) -> Result<T,E> {
47 db::workspaces(client)
48}
49pub async fn current_workspace<T:DOwned>(client:Client) -> Result<T,E> {
50 db::current_workspace(client)
51}
52pub async fn get_workspace<T:DOwned>(client:Client,workspace:&str) -> Result<T,E> {
53 db::get_workspace(client,workspace)
54}
55pub async fn set_workspace<T:DOwned>(client:Client,workspace:&str) -> Result<T,E> {
56 db::set_workspace(client,workspace)
57}
58pub async fn del_workspace<T:DOwned>(client:Client,workspace:&str) -> Result<T,E> {
59 db::del_workspace(client,workspace)
60}
61pub async fn add_workspace<T:DOwned>(client:Client,workspace:&str) -> Result<T,E> {
62 db::add_workspace(client,workspace)
63}
64
65pub async fn get_note<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
66 db::get_note(client,hash)
67}
68pub async fn report_note<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
69 db::report_note(client,hash)
70}
71pub async fn notes<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
72 db::notes(client,hash)
73}
74pub async fn del_note<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
75 db::del_note(client,hash)
76}
77
78pub async fn get_client<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
79 db::get_client(client,hash)
80}
81pub async fn clients<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
82 db::clients(client,hash)
83}
84pub async fn del_client<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
85 db::del_client(client,hash)
86}
87pub async fn report_client<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
88 db::report_client(client,hash)
89}
90
91pub async fn get_ref<T:DOwned>(client:Client,ref_name:&str) -> Result<T,E> {
92 db::get_ref(client,ref_name)
93}
94
95pub async fn events<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
96 db::events(client,hash)
97}
98pub async fn report_event<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
99 db::report_event(client,hash)
100}
101
102pub async fn report_loot<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
103 db::report_loot(client,hash)
104}
105pub async fn loots<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
106 db::loots(client,hash)
107}
108
109pub async fn creds<T:DOwned>(client:Client,hash:HashMap<String,String>) -> Result<T,E> {
110 db::creds(client,hash)
111}
112
113pub async fn import_data<T:DOwned>(client:Client,data:&str) -> Result<T,E> {
114 db::import_data(client,data)
115}
116pub async fn import_file<T:DOwned>(client:Client,file:File) -> Result<T,E> {
117 db::import_file(client,file)
118}
119
120pub async fn set_driver<T:DOwned>(client:Client,driver:&str) -> Result<T,E> {
121 db::set_driver(client,driver)
122}
123pub async fn get_driver<T:DOwned>(client:Client) -> Result<T,E> {
124 db::get_driver(client)
125}
126
127pub async fn dbconnect<T:DOwned>(client:Client,driver:&str,hash:HashMap<String,String>) -> Result<T,E> {
128 db::dbconnect(client,driver,hash)
129}
130
131pub async fn status<T:DOwned>(client:Client) -> Result<T,E> {
132 db::status(client)
133}
134
135pub async fn disconnect<T:DOwned>(client:Client) -> Result<T,E> {
136 db::disconnect(client)
137}