Http Injector | Remote Proxy For

// Connect to destination dialer := net.Dialer{Timeout: 10 * time.Second} destConn, err := dialer.Dial("tcp", dest) if err != nil { http.Error(w, err.Error(), 502) return } defer destConn.Close()

func main() { server := &http.Server{ Addr: ":8080", Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodConnect { handleTunnel(w, r) return } http.Error(w, "Only CONNECT method allowed", http.StatusMethodNotAllowed) }), } log.Fatal(server.ListenAndServe()) }

clientConn.Write([]byte("HTTP/1.1 200 OK\r\n\r\n")) remote proxy for http injector

Configure HTTP Injector with proxy type HTTP → Host your-server-ip → Port 8080 . It will work as a standard tunnel. 4. Adding Injector-Specific Payload Support HTTP Injector often sends custom payloads – not just CONNECT. For example, it might send a crafted HTTP request with a Host header that contains the real destination inside a query parameter or a custom header like X-Forward-Host .

func handle(w http.ResponseWriter, r *http.Request) { dest := r.Header.Get("X-Real-Host") if dest == "" { dest = r.Host } if dest == "" { http.Error(w, "Missing destination", 400) return } // Connect to destination dialer := net

// Ensure port is present if !strings.Contains(dest, ":") { dest = dest + ":80" // default to HTTP }

h, ok := w.(http.Hijacker) if !ok { http.Error(w, "No hijack", 500) return } clientConn, _, err := h.Hijack() if err != nil { return } defer clientConn.Close() 500) return } clientConn

go build -o remote-proxy proxy.go