envoy/examples/basic.rs
2024-05-30 03:41:53 +01:00

30 lines
634 B
Rust

use std::env;
use envoy::Shodan;
#[tokio::main]
async fn main() {
// CLI arguments
let args: Vec<_> = env::args().collect();
// Missing arguments
if args.len() < 2 {
panic!("Missing arguments");
}
// Create client
let shodan = Shodan::new(&args[1]);
// Fetch profile
let profile = shodan.fetch_profile().await.unwrap();
println!("{:#?}", profile);
// Fetch information
let info = shodan.fetch_info().await.unwrap();
println!("{:#?}", info);
// Fetch tokens
let tokens = shodan.fetch_tokens("Raspbian port:22").await.unwrap();
println!("{:#?}", tokens);
}