diff --git a/attack.go b/attack.go index 4988269..0236342 100644 --- a/attack.go +++ b/attack.go @@ -163,6 +163,8 @@ func validateStream(c Curler, stream Stream, timeout time.Duration, enableLogs b // Set custom timeout c.Setopt(curl.OPT_TIMEOUT_MS, int(timeout/time.Millisecond)) + c.Setopt(curl.OPT_RTSP_TRANSPORT, "RTP/AVP;unicast;client_port=33332-33333") + // Perform the request err := c.Perform() if err != nil { @@ -186,7 +188,7 @@ func validateStream(c Curler, stream Stream, timeout time.Duration, enableLogs b // ValidateStreams tries to setup the stream to validate whether or not it is available func ValidateStreams(c Curler, targets []Stream, timeout time.Duration, log bool) ([]Stream, error) { for idx, target := range targets { - targets[idx].StreamAvailable = validateStream(c, target, timeout, log) + targets[idx].Available = validateStream(c, target, timeout, log) } return targets, nil diff --git a/cameradar/cameradar.go b/cameradar/cameradar.go index ad78d3c..34ab9f8 100644 --- a/cameradar/cameradar.go +++ b/cameradar/cameradar.go @@ -151,6 +151,12 @@ func main() { } } + updateSpinner(w, "Found "+fmt.Sprint(len(streams))+" streams. Validating their availability...", options.EnableLogs) + streams, err = cmrdr.ValidateStreams(c, streams, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs) + if err != nil && len(streams) > 0 { + printErr(err) + } + clearOutput(w, options.EnableLogs) prettyPrint(streams) } @@ -166,7 +172,7 @@ func prettyPrint(streams []cmrdr.Stream) { if len(streams) > 0 { for _, stream := range streams { - if stream.CredentialsFound && stream.RouteFound { + if stream.CredentialsFound && stream.RouteFound && stream.Available { fmt.Printf("%s\tDevice RTSP URL:\t%s\n", green("\xE2\x96\xB6"), blue(cmrdr.GetCameraRTSPURL(stream))) success++ } else { @@ -174,6 +180,13 @@ func prettyPrint(streams []cmrdr.Stream) { } fmt.Printf("\tDevice model:\t\t%s\n\n", stream.Device) + + if stream.Available { + fmt.Printf("\tAvailable:\t\t%s\n", green("yes")) + } else { + fmt.Printf("\tAvailable:\t\t%s\n", red("no")) + } + fmt.Printf("\tIP address:\t\t%s\n", stream.Address) fmt.Printf("\tRTSP port:\t\t%d\n", stream.Port) if stream.CredentialsFound { diff --git a/models.go b/models.go index b667dbc..f2296c4 100644 --- a/models.go +++ b/models.go @@ -13,7 +13,7 @@ type Stream struct { CredentialsFound bool `json:"credentials_found"` RouteFound bool `json:"route_found"` - StreamAvailable bool `json:"stream_available"` + Available bool `json:"available"` } // Credentials is a map of credentials