interactsh_rs/lib.rs
1//! # Interactsh-rs
2//! A Rust client library for getting interaction logs from
3//! [Interactsh](https://github.com/projectdiscovery/interactsh) servers. See
4//! a basic example below; check out the [examples](https://github.com/pyroraptor07/interactsh-rs/tree/main/examples)
5//! or the [client] module docs for more detailed use.
6//!
7//! ## Basic Use
8//! ```
9//! use std::time::Duration;
10//! use std::thread;
11//! use interactsh_rs::prelude::*;
12//!
13//! async fn run_client() {
14//! // Builds an unregistered client
15//! let client = ClientBuilder::default()
16//! .with_server("oast.pro".into())
17//! .parse_logs(true)
18//! .build()
19//! .unwrap();
20//!
21//! // Registers the client with the server and
22//! // returns a registered client
23//! let client = client.register().await.unwrap();
24//! let interaction_fqdn = client.get_interaction_fqdn();
25//! println!("INTERACTION URL: https://{}", interaction_fqdn);
26//!
27//! // Start a poll loop
28//! loop {
29//! thread::sleep(Duration::from_secs(5));
30//!
31//! let logs = match client.poll().await.unwrap() {
32//! Some(logs) => logs,
33//! None => continue,
34//! };
35//!
36//! // ...Do something with the returned logs...
37//! }
38//!
39//! // Once done, deregister the client
40//! client.deregister().await.unwrap();
41//! }
42//! ```
43//!
44//! ## Feature Flags - Cryptography
45//! This crate supports using either the [RustCrypto](https://github.com/RustCrypto) libraries
46//! or OpenSSL for decrypting server logs:
47//! - `rustcrypto`
48//! - `openssl`
49//! - `openssl-vendored`
50//!
51//! One of these must be enabled in order to use the crate
52//! (unless you just need the [interaction_log] module). `rustcrypto` is enabled
53//! by default.
54//!
55//! ## Feature Flags - TLS
56//! To enable either [Rustls](https://github.com/rustls/rustls) or OS native
57//! TLS, use one of the following feature flags:
58//! - `rustls-tls`
59//! - `native-tls`
60//! - `native-tls-vendored`
61//!
62//! One of these must be enabled as well to use the crate as a client.
63//! `rustls-tls` is enabled by default.
64//!
65//! Note: All 3 TLS feature flags can also be used currently with the "reqwest-"
66//! prefix. These were the original TLS feature flag names used in initial
67//! development, but will be removed in a future release in favor of the shorter
68//! feature names omitting the "reqwest-" prefix.
69//!
70//! ## Feature Flags - Async runtime compatibility
71//! This crate supports the [tokio](https://github.com/tokio-rs/tokio),
72//! [async-std](https://github.com/async-rs/async-std), and
73//! [smol](https://github.com/smol-rs/smol) async runtimes. In order to use
74//! non-tokio runtimes with this crate, use the `async-compat` feature flag
75//! (enabled by default).
76
77#![cfg_attr(feature = "nightly", feature(doc_auto_cfg))]
78
79#[cfg(any(feature = "rustcrypto", feature = "openssl"))]
80pub(crate) mod crypto;
81
82#[cfg(all(
83 any(feature = "rustls-tls", feature = "native-tls"),
84 any(feature = "rustcrypto", feature = "openssl")
85))]
86pub mod client;
87#[cfg(all(
88 any(feature = "rustls-tls", feature = "native-tls"),
89 any(feature = "rustcrypto", feature = "openssl")
90))]
91pub mod errors;
92pub mod interaction_log;
93
94pub mod prelude {
95 #[cfg(all(
96 any(feature = "rustls-tls", feature = "native-tls"),
97 any(feature = "rustcrypto", feature = "openssl")
98 ))]
99 pub use crate::client::*;
100 #[cfg(all(
101 any(feature = "rustls-tls", feature = "native-tls"),
102 any(feature = "rustcrypto", feature = "openssl")
103 ))]
104 pub use crate::errors::*;
105 pub use crate::interaction_log::*;
106}
107
108
109
110// .--.__
111// .~ (@) ~~~---_
112// { `-_~,,,,,,)
113// { (_ ',
114// ~ . = _',
115// ~- '. =-'
116// ~ :
117// . _,.-~ ('');
118// '. .-~ \ \ ;
119// ':-_ _.--~ \ \; _-=,.
120// ~-:-.__ _.-~ { '---- _'-=,.
121// ~-._~--._ __.-~ ~---------=,.`
122// ~~-._~~-----~~~~~~ .+++~~~~~~~~-__ /
123// ~-.,____ { - + } _/
124// ~~-.______{_ _ -=\ / /_.~
125// : ~--~ // / ..-
126// : / / // / ((
127// : / / { `-------,. ))
128// : / ''=--------. }o
129// .=._________,' ) ))
130// ) _________ -'' ~~
131// / / _ _
132// (_.-.'O'-'.
133//
134// source: https://ascii.co.uk/art/dinosaur