Crate interactsh_rs

source ·
Expand description

Interactsh-rs

A Rust client library for getting interaction logs from Interactsh servers. See a basic example below; check out the examples or the client module docs for more detailed use.

Basic Use

use std::time::Duration;
use std::thread;
use interactsh_rs::prelude::*;

async fn run_client() {
    // Builds an unregistered client
    let client = ClientBuilder::default()
        .with_server("oast.pro".into())
        .parse_logs(true)
        .build()
        .unwrap();

    // Registers the client with the server and
    // returns a registered client
    let client = client.register().await.unwrap();
    let interaction_fqdn = client.get_interaction_fqdn();
    println!("INTERACTION URL: https://{}", interaction_fqdn);

    // Start a poll loop
    loop {
        thread::sleep(Duration::from_secs(5));

        let logs = match client.poll().await.unwrap() {
            Some(logs) => logs,
            None => continue,
        };

        // ...Do something with the returned logs...
    }

    // Once done, deregister the client
    client.deregister().await.unwrap();
}

Feature Flags - Cryptography

This crate supports using either the RustCrypto libraries or OpenSSL for decrypting server logs:

  • rustcrypto
  • openssl
  • openssl-vendored

One of these must be enabled in order to use the crate (unless you just need the interaction_log module). rustcrypto is enabled by default.

Feature Flags - TLS

To enable either Rustls or OS native TLS, use one of the following feature flags:

  • rustls-tls
  • native-tls
  • native-tls-vendored

One of these must be enabled as well to use the crate as a client. rustls-tls is enabled by default.

Note: All 3 TLS feature flags can also be used currently with the “reqwest-” prefix. These were the original TLS feature flag names used in initial development, but will be removed in a future release in favor of the shorter feature names omitting the “reqwest-” prefix.

Feature Flags - Async runtime compatibility

This crate supports the tokio, async-std, and smol async runtimes. In order to use non-tokio runtimes with this crate, use the async-compat feature flag (enabled by default).

Modules

client(rustls-tls or native-tls) and (rustcrypto or openssl)
Contains the primary structures necessary for registering and polling an Interactsh server.
errors(rustls-tls or native-tls) and (rustcrypto or openssl)