Categories
Rust

Rust Reqwest via Proxy and SSL Certificate captured by Burp

Make browser or API call requests via Rust script can be done with Reqwest module. It’s easier than using Hyper, which recently has a lot of changes. There nothing many articles, guidelines or working examples with the latest version of Hyper and Reqwest for advanced usage.

Several things that I want to achieve here where there lack of coverage on:

  1. How to enable reqwest working with proxy
  2. How to use Authorization Beaver in reqwest 
  3. How to applied self signed certificate 
  4. How to capture the traffic via Burp for monitoring

I tried with Hyper and Hyper Proxy, but it seems it’s more complicated and harder to do than Reqwest.

Here is an step by step to enable proxy, certification and captured by Burp.

cargo.toml

[dependencies]
hyper = "0.13.5"
hyper-native-tls = "0.3.0"
reqwest = { version = "0.10.4", features = ["blocking", "json", "gzip"] }
tokio = { version = "0.2", features = ["full"] }
diesel = { version = "1.4.4", features = ["postgres", "chrono"] }
dotenv = "0.15.0"
chrono = { version = "0.4.11", features = ["serde"] }
serde = { version = "1.0.110", features = ["derive"] }
Categories
Rust

Convert slices into String in Rust

I found it hard to find a single article to explain how to convert or merge slices to string in Rust. Here is an example of how to do it:

let row_content = &row.iter().map(|highscore| highscore.to_string()).collect::>().join(",");

I hope this helps someone who wants to concatenate slices/list in Rust into delimiter comma-separated string or only space.

Categories
Rust

Install Rust Diesel in Windows 10 and Fix Issue

Installing Diesel CLI in Windows 10 can be troublesome sometimes. When I did execute this command “cargo install diesel_cli –no-default-features –features postgres” and receive error message:

note: Non-UTF-8 output: LINK : fatal error LNK1181:error: linking with `link.exe` failed: exit code: 1181

I have tried to debug it with the various approach by:

So, I did reset my Windows 10 language and downloaded the gigantic Microsoft Visual Studio 2019 with “VC++ 2015.3 v14.00 (v140) toolset for desktop”. I did re-install rust with the hope it will solve the issue.

None of the above is works until I found someone wrote an article on how to install Diesel in Windows 10 and enable it’s CLI with the help of setup the local variable PATH.