mirror of
https://github.com/Harrison-Wells-Cyber/PS-Proxy
synced 2026-07-26 08:06:34 +00:00
Merge pull request #2 from Harrison-Wells-Cyber/codex/review-proxy-tool-for-internal-ad-environment
Add reconnect tokens, DNS relay, stream limits, local write queues, agent reconnect/backoff and status endpoint
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
@@ -23,6 +22,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/psproxy/psproxy/internal/protocol"
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"sync"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package staging
|
||||
|
||||
import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -47,3 +49,19 @@ func TestReconnectTokenSurvivesEnrollmentURLTTL(t *testing.T) {
|
||||
t.Fatalf("reconnect token should survive URL TTL after enrollment: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentHandlerDoesNotHTMLEscapeAssemblyBase64(t *testing.T) {
|
||||
store := NewStore(time.Minute)
|
||||
sess, err := store.Create("c2.example.com", 443, "pin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("create session: %v", err)
|
||||
}
|
||||
tmpl := template.Must(template.New("agent").Parse("{{.AssemblyB64}}"))
|
||||
r := httptest.NewRequest("GET", "/a/"+sess.ID, nil)
|
||||
r.SetPathValue("id", sess.ID)
|
||||
w := httptest.NewRecorder()
|
||||
AgentHandler(store, tmpl, "AA+/=").ServeHTTP(w, r)
|
||||
if got := w.Body.String(); got != "AA+/=" {
|
||||
t.Fatalf("assembly base64 was escaped or changed: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user