Skip to content

Commit

Permalink
patch: update ip endpoint + fallback to output on public ip fail (#599)
Browse files Browse the repository at this point in the history
* removed unused server

* patch: update ip check endpoint + fallback to output on public ip failure

---------

Co-authored-by: Sandeep Singh <[email protected]>
Co-authored-by: sandeep <[email protected]>
  • Loading branch information
3 people authored Jun 30, 2023
1 parent 1314312 commit aa84bc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/interactsh-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,15 @@ func main() {

if cliOptions.IPAddress == "" && cliOptions.ListenIP == "0.0.0.0" {
publicIP, _ := getPublicIP()
gologger.Info().Msgf("Public IP: %s\n", publicIP)
outboundIP, _ := iputil.GetSourceIP("scanme.sh")

if publicIP == "" && outboundIP == nil {
gologger.Fatal().Msgf("Could not determine public IP address\n")
}
if publicIP == "" && outboundIP != nil {
publicIP = outboundIP.String()
}
gologger.Info().Msgf("Public IP: %s\n", publicIP)
gologger.Info().Msgf("Outbound IP: %s\n", outboundIP)
// it's essential to be able to bind to cliOptions.DnsPort on any of the two ips
bindableIP, err := iputil.GetBindableAddress(cliOptions.DnsPort, publicIP, outboundIP.String())
Expand Down

0 comments on commit aa84bc5

Please sign in to comment.