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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! # CodeQL
//!
//! This module contains a simple interface to work with CodeQL CLI and databases in Rust.
//!
//! ## Usage
//!
//! ```no_run
//! use ghastoolkit::codeql::{CodeQL, CodeQLDatabase, CodeQLDatabases};
//!
//! # #[tokio::main]
//! # async fn main() {
//! // Setup a default CodeQL CLI
//! let codeql = CodeQL::new().await;
//! println!("CodeQL :: {}", codeql);
//!
//! // Get all CodeQL databases from the default path
//! let databases = CodeQLDatabases::default();
//!
//! for database in databases {
//! println!("Database :: {}", database);
//! }
//! # }
//! ```
//!
//! You can also use the builder pattern to create a new CodeQL CLI instance:
//!
//! ```rust
//! use ghastoolkit::codeql::CodeQL;
//!
//! # #[tokio::main]
//! # async fn main() {
//! let codeql = CodeQL::init()
//! .path(String::from("/path/to/codeql"))
//! .threads(4)
//! .ram(8000)
//! .build()
//! .await
//! .expect("Failed to create CodeQL instance");
//! # }
//! ```
//!
//! ## CodeQL Database
//!
//! If you want to create and analyze a CodeQL database, you can use the `CodeQLDatabase` struct:
//!
//! ```no_run
//! use ghastoolkit::codeql::{CodeQL, CodeQLDatabase};
//!
//! # #[tokio::main]
//! # async fn main() {
//! let codeql = CodeQL::default();
//!
//! // Create a new CodeQL database
//! let database = CodeQLDatabase::init()
//! .name("ghastoolkit")
//! .language("python")
//! .source(String::from("/path/to/source"))
//! .build()
//! .expect("Failed to create CodeQL database");
//!
//! println!("Database :: {}", database);
//!
//! // Create a new CodeQL database
//! codeql.database(&database)
//! .overwrite()
//! .create()
//! .await
//! .expect("Failed to create CodeQL database");
//!
//! let results = codeql.database(&database)
//! .analyze()
//! .await
//! .expect("Failed to analyze CodeQL database");
//! # }
//!```
pub use CodeQL;
pub use CodeQLDatabase;
pub use CodeQLDatabases;
pub use CodeQLExtractor;
pub use CodeQLLanguage;
pub use CodeQLVersion;