Skip to content

Instantly share code, notes, and snippets.

@yutannihilation
Created December 14, 2018 23:33
Show Gist options
  • Save yutannihilation/c11b130f6ecd8c6d5f488ede5c5507f9 to your computer and use it in GitHub Desktop.
Save yutannihilation/c11b130f6ecd8c6d5f488ede5c5507f9 to your computer and use it in GitHub Desktop.
Use mitmproxy with R (not working yet)
tmp <- file.path(normalizePath(tempdir()), "certs")
dir.create(tmp)
download.file("https://curl.haxx.se/ca/cacert.pem", file.path(tmp, "cacert-mozilla.pem"), mode = "wb")
library(httr)
proxy_conf <- use_proxy("http://127.0.0.1", port = 8080)
res <- GET("http://mitm.it/cert/pem", config = proxy_conf)
writeBin(content(res), file.path(tmp, "cacert-mitm.pem"))
conf <- c(proxy_conf, config(cainfo = tmp), verbose())
GET("https://example.com", config = conf)
list.files(tmp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment