Struct passivetotal::client::PTClient [] [src]

pub struct PTClient {
    pub client: Client,
    pub auth: Basic,
}

This is the client exposed to the user for abstracting the passivetotal API.

Fields

client

the hyper::Client

auth

stores the http basic auth credentials

Methods

impl PTClient

The PTClient is the main interface into making calls to the PassiveTotal API. You instanciate a PTClient with the new method which takes a config::Config as its argument.

All the GET functions are defined by the macro define_get_decoder!

Examples

use passivetotal::config::read_config;
use passivetotal::client::PTClient;

let conf = match read_config() {
    Ok(conf) => conf,
    _ => panic!("Please create your config at ~/.config/api_config.json"),
}
let client = PTClient::new(conf);
let response = match client.get_pdns("passivetotal.org") {
    Ok(response) => response,
    _ => panic!("Something bad happened in the JSON response"),
};

See main.rs for full usage examples. See the response module documentation for details on the sorts of responses returned. See the API documentation for more resources.

fn new(conf: Config) -> PTClient

Creates a PTClient from a JSON Config from ~/.config/passivetotal/api_config.json

fn get_pdns(&self, query: &str) -> Result<PDNSResponse, ResponseError>

fn get_pdns_unique(&self, query: &str) -> Result<PDNSUniqueResponse, ResponseError>

fn get_whois(&self, query: &str) -> Result<WhoisResponse, ResponseError>

fn get_sslcert(&self, query: &str) -> Result<SSLCertResponse, ResponseError>

fn get_sslcert_history(&self, query: &str) -> Result<SSLCertHistoryResponse, ResponseError>

fn get_osint(&self, query: &str) -> Result<OSINTResponse, ResponseError>

fn get_malware(&self, query: &str) -> Result<MalwareResponse, ResponseError>

fn get_subdomains(&self, query: &str) -> Result<SubdomainsResponse, ResponseError>

fn get_host_attribute_components(&self, query: &str) -> Result<HostAttributeComponentResponse, ResponseError>

fn get_host_attribute_trackers(&self, query: &str) -> Result<HostAttributeTrackerResponse, ResponseError>

fn get_classification(&self, query: &str) -> Result<ActionClassificationResponse, ResponseError>

fn get_ever_compromised(&self, query: &str) -> Result<ActionEverCompromisedResponse, ResponseError>

fn get_ddns(&self, query: &str) -> Result<ActionDDNSResponse, ResponseError>

fn get_monitor(&self, query: &str) -> Result<ActionMonitorResponse, ResponseError>

fn get_sinkhole(&self, query: &str) -> Result<ActionSinkholeResponse, ResponseError>

fn get_tags(&self, query: &str) -> Result<ActionTagResponse, ResponseError>

fn get_account(&self) -> Result<AccountResponse, ResponseError>