https://github.com/shellrow/securitytrails-rs
Rust bindings for SecurityTrails API
https://github.com/shellrow/securitytrails-rs
Last synced: 11 months ago
JSON representation
Rust bindings for SecurityTrails API
- Host: GitHub
- URL: https://github.com/shellrow/securitytrails-rs
- Owner: shellrow
- License: mit
- Created: 2021-05-23T11:52:15.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T15:44:41.000Z (about 4 years ago)
- Last Synced: 2025-03-03T03:46:35.600Z (over 1 year ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[crates-badge]: https://img.shields.io/crates/v/securitytrails-rs.svg
[crates-url]: https://crates.io/crates/securitytrails-rs
[license-badge]: https://img.shields.io/crates/l/securitytrails-rs.svg
[examples-url]: https://github.com/shellrow/securitytrails-rs/tree/main/examples
# securitytrails-rs [![Crates.io][crates-badge]][crates-url] ![License][license-badge]
Rust bindings for SecurityTrails API
**Currently under development and only some features are supported**
## Features (Unchecked items are under development)
- [x] Ping
- [x] Usage
- [x] Details
- [x] Subdomains
- [x] Tags
- [x] WHOIS
- [ ] Search
- [ ] Statistics
- [ ] Associated domains
- [ ] DNS History
- [ ] WHOIS History
- [ ] IP Neighbors
- [ ] IP Statistics
## Example
Subdomains
```rust
use std::fs;
use securitytrails_rs::Client;
fn main() {
let api_key: &str = "your_api_key";
let domain = "google.com";
let client = Client::new(api_key).unwrap();
let ping = match client.ping() {
Ok(ping) => ping,
Err(e) => {
println!("{}", e);
return;
},
};
println!("ping: {}", ping.success);
let subdomains = match client.get_subdomains(domain) {
Ok(subdomains) => subdomains,
Err(e) => {
println!("{}", e);
return;
},
};
println!("endpoint: {}", subdomains.endpoint);
//println!("subdomains: {:?}", subdomains.subdomains);
let joined = subdomains.subdomains.join("\n");
let save_path = format!("{}_subdomains.txt", domain);
fs::write(save_path.clone(), joined).expect("Unable to write file");
println!("subdomains: Saved to {}", save_path);
let usage = match client.get_usage() {
Ok(usage) => usage,
Err(e) => {
println!("{}", e);
return;
},
};
println!("current: {}", usage.current_monthly_usage);
println!("allowed: {}", usage.allowed_monthly_usage);
}
```