Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // mitmProxy project main.go
- package main
- import (
- "log"
- "net/http"
- "net/http/httputil"
- "net/url"
- "fmt"
- )
- func main() {
- target := &url.URL{Scheme: "http", Host: "localhost:8000"}
- np := httputil.NewSingleHostReverseProxy(target)
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- dReq, err := httputil.DumpRequest(r, true)
- if err != nil {
- log.Println(err)
- }
- fmt.Println(string(dReq))
- np.ServeHTTP(w, r)
- })
- log.Println("Listeninig on :8088")
- log.Fatal(http.ListenAndServe(":8088", nil))
- }
Advertisement
Add Comment
Please, Sign In to add comment