@@ -315,6 +315,19 @@ func (request *Request) ExecuteWithResults(target *contextargs.Context, dynamicV
315315 values := generators .MergeMaps (payloadValues , hostnameVariables , request .options .Constants , templateCtx .GetAll ())
316316 variablesMap := request .options .Variables .Evaluate (values )
317317 payloadValues = generators .MergeMaps (variablesMap , payloadValues , request .options .Constants , hostnameVariables )
318+
319+ var interactshURLs []string
320+ if request .options .Interactsh != nil {
321+ for payloadName , payloadValue := range payloadValues {
322+ var urls []string
323+ payloadValue , urls = request .options .Interactsh .Replace (types .ToString (payloadValue ), interactshURLs )
324+ if len (urls ) > 0 {
325+ interactshURLs = append (interactshURLs , urls ... )
326+ payloadValues [payloadName ] = payloadValue
327+ }
328+ }
329+ }
330+
318331 // export all variables to template context
319332 templateCtx .Merge (payloadValues )
320333
@@ -404,7 +417,7 @@ func (request *Request) ExecuteWithResults(target *contextargs.Context, dynamicV
404417 request .options .Progress .IncrementMatched ()
405418 }
406419 callback (result )
407- }, requestOptions ); err != nil {
420+ }, requestOptions , interactshURLs ); err != nil {
408421 if errkit .IsNetworkPermanentErr (err ) {
409422 // gologger.Verbose().Msgf("Could not execute request: %s\n", err)
410423 return err
@@ -417,7 +430,7 @@ func (request *Request) ExecuteWithResults(target *contextargs.Context, dynamicV
417430 }
418431 }
419432 }
420- return request .executeRequestWithPayloads (hostPort , input , hostname , nil , payloadValues , callback , requestOptions )
433+ return request .executeRequestWithPayloads (hostPort , input , hostname , nil , payloadValues , callback , requestOptions , interactshURLs )
421434}
422435
423436func (request * Request ) executeRequestParallel (ctxParent context.Context , hostPort , hostname string , input * contextargs.Context , payloadValues map [string ]interface {}, callback protocols.OutputEventCallback ) {
@@ -469,7 +482,7 @@ func (request *Request) executeRequestParallel(ctxParent context.Context, hostPo
469482 gotmatches .Store (true )
470483 }
471484 callback (result )
472- }, requestOptions ); err != nil {
485+ }, requestOptions , [] string {} ); err != nil {
473486 if errkit .IsNetworkPermanentErr (err ) {
474487 cancel (err )
475488 return
@@ -490,7 +503,7 @@ func (request *Request) executeRequestParallel(ctxParent context.Context, hostPo
490503 }
491504}
492505
493- func (request * Request ) executeRequestWithPayloads (hostPort string , input * contextargs.Context , _ string , payload map [string ]interface {}, previous output.InternalEvent , callback protocols.OutputEventCallback , requestOptions * protocols.ExecutorOptions ) error {
506+ func (request * Request ) executeRequestWithPayloads (hostPort string , input * contextargs.Context , _ string , payload map [string ]interface {}, previous output.InternalEvent , callback protocols.OutputEventCallback , requestOptions * protocols.ExecutorOptions , interactshURLs [] string ) error {
494507 payloadValues := generators .MergeMaps (payload , previous )
495508 argsCopy , err := request .getArgsCopy (input , payloadValues , requestOptions , false )
496509 if err != nil {
@@ -502,7 +515,6 @@ func (request *Request) executeRequestWithPayloads(hostPort string, input *conte
502515 argsCopy .TemplateCtx = map [string ]interface {}{}
503516 }
504517
505- var interactshURLs []string
506518 if request .options .Interactsh != nil {
507519 if argsCopy .Args != nil {
508520 for k , v := range argsCopy .Args {
0 commit comments