Additional nil check on interactsh client (#3590)

dev
Mzack9999 2023-04-25 20:19:23 +02:00 committed by GitHub
parent 97e7081c69
commit ea5f8a0638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package interactsh package interactsh
import ( import (
"errors"
"regexp" "regexp"
"time" "time"
) )
@ -8,6 +9,8 @@ import (
var ( var (
defaultInteractionDuration = 60 * time.Second defaultInteractionDuration = 60 * time.Second
interactshURLMarkerRegex = regexp.MustCompile(`{{interactsh-url(?:_[0-9]+){0,3}}}`) interactshURLMarkerRegex = regexp.MustCompile(`{{interactsh-url(?:_[0-9]+){0,3}}}`)
ErrInteractshClientNotInitialized = errors.New("interactsh client not initialized")
) )
const ( const (

View File

@ -202,9 +202,14 @@ func (c *Client) URL() (string, error) {
err = c.poll() err = c.poll()
}) })
if err != nil { if err != nil {
return "", errorutil.NewWithErr(err).Msgf("interactsh client not initialized") return "", errorutil.NewWithErr(err).Wrap(ErrInteractshClientNotInitialized)
}
// ensures interactsh is not nil
if c.interactsh == nil {
return "", ErrInteractshClientNotInitialized
} }
} }
c.generated.Store(true) c.generated.Store(true)
return c.interactsh.URL(), nil return c.interactsh.URL(), nil
} }