mirror of
https://github.com/Adaptix-Framework/AdaptixC2
synced 2026-06-08 10:20:39 +00:00
Merge pull request #100 from Xre0uS/xff-detection
Use X-Forwarded-For only if enabled and present
This commit is contained in:
@@ -205,9 +205,10 @@ func (handler *HTTP) processRequest(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ExternalIP = strings.Split(ctx.Request.RemoteAddr, ":")[0]
|
||||
if handler.Config.TrustXForwardedFor {
|
||||
if handler.Config.TrustXForwardedFor && ctx.Request.Header.Get("X-Forwarded-For") != "" {
|
||||
ExternalIP = ctx.Request.Header.Get("X-Forwarded-For")
|
||||
} else {
|
||||
ExternalIP = strings.Split(ctx.Request.RemoteAddr, ":")[0]
|
||||
}
|
||||
|
||||
agentType, agentId, beat, bodyData, err = handler.parseBeatAndData(ctx)
|
||||
|
||||
Reference in New Issue
Block a user