| Crates.io | ghastoolkit |
| lib.rs | ghastoolkit |
| version | 0.12.0 |
| created_at | 2024-02-27 17:52:10.141964+00 |
| updated_at | 2025-09-16 17:04:01.634187+00 |
| description | GitHub Advanced Security Toolkit in Rust |
| homepage | |
| repository | https://github.com/GeekMasher/ghastoolkit-rs |
| max_upload_size | |
| id | 1155307 |
| size | 269,471 |
This is the GitHub Advanced Security (GHAS) Toolkit in Rust. This toolkit is designed to help developers and security researchers to interact with the GitHub Advanced Security API.
You can use the GitHub and Repository structs to interact with the GitHub API.
use ghastoolkit::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let github = GitHub::default();
println!("GitHub :: {}", github);
let repository = Repository::parse("geekmasher/ghastoolkit-rs@main")
.expect("Failed to parse repository");
println!("Repository :: {}", repository);
Ok(())
}
You can use the CodeQL struct to interact with the CodeQL CLI.
use ghastoolkit::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let codeql = CodeQL::new().await;
println!("CodeQL :: {}", codeql);
let languages = codeql.get_languages().await?;
println!("Languages :: {:#?}", languages);
// Get all CodeQL databases from the default path
let databases = CodeQLDatabases::default();
for database in databases {
println!("Database :: {}", database);
}
// Create a new CodeQL database
let database = CodeQLDatabase::init()
.name("my-project")
.language("javascript")
.path("/path/to/code".to_string())
.build()
.expect("Failed to create CodeQL database");
// Create the database using the CodeQL CLI
codeql.database(&database)
.create()
.await?;
// Run a CodeQL query
codeql.database(&database)
.analyze()
.await?;
// You can also download a CodeQL Database from GitHub
let github = GitHub::default();
let repo = Repository::parse("geekmasher/ghastoolkit-rs@main")
.expect("Failed to parse repository");
let databases = CodeQLDatabase::download("./".into(), &repo, &github).await?;
println!("Databases :: {:#?}", databases);
Ok(())
}