|
@@ -4,6 +4,8 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"net/http"
|
|
"net/http"
|
|
"strings"
|
|
"strings"
|
|
|
|
+
|
|
|
|
+ "imuslab.com/zoraxy/mod/sshprox"
|
|
)
|
|
)
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -32,8 +34,16 @@ func AuthFsHandler(handler http.Handler) http.Handler {
|
|
if strings.HasPrefix(r.URL.Path, "/web.ssh/") {
|
|
if strings.HasPrefix(r.URL.Path, "/web.ssh/") {
|
|
parts := strings.Split(r.URL.Path, "/")
|
|
parts := strings.Split(r.URL.Path, "/")
|
|
if len(parts) > 2 {
|
|
if len(parts) > 2 {
|
|
|
|
+ //Extract the instance ID from the request path
|
|
instanceUUID := parts[2]
|
|
instanceUUID := parts[2]
|
|
fmt.Println(instanceUUID)
|
|
fmt.Println(instanceUUID)
|
|
|
|
+
|
|
|
|
+ //Rewrite the url so the proxy knows how to serve stuffs
|
|
|
|
+ r.URL, _ = sshprox.RewriteURL("/web.ssh/"+instanceUUID, r.RequestURI)
|
|
|
|
+ webSshManager.HandleHttpByInstanceId(instanceUUID, w, r)
|
|
|
|
+ } else {
|
|
|
|
+ http.Error(w, "Invalid Usage", http.StatusInternalServerError)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|