|
|
|
@@ -191,17 +191,18 @@ func (s *Scanner) detectAuthMethod(stream Stream) int {
|
|
|
|
|
|
|
|
|
|
s.setCurlOptions(c)
|
|
|
|
|
|
|
|
|
|
_ = c.Setopt(curl.OPT_VERBOSE, 1)
|
|
|
|
|
|
|
|
|
|
// Send a request to the URL of the stream we want to attack.
|
|
|
|
|
_ = c.Setopt(curl.OPT_URL, attackURL)
|
|
|
|
|
// Set the RTSP STREAM URI as the stream URL.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_STREAM_URI, attackURL)
|
|
|
|
|
// 2 is CURL_RTSPREQ_DESCRIBE.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, 2)
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, rtspDescribe)
|
|
|
|
|
|
|
|
|
|
// Perform the request.
|
|
|
|
|
err := c.Perform()
|
|
|
|
|
if err != nil {
|
|
|
|
|
s.term.Errorf("Perform failed: %v", err)
|
|
|
|
|
s.term.Errorf("Perform failed for %q (auth %d): %v", attackURL, stream.AuthenticationType, err)
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -232,6 +233,8 @@ func (s *Scanner) routeAttack(stream Stream, route string) bool {
|
|
|
|
|
|
|
|
|
|
s.setCurlOptions(c)
|
|
|
|
|
|
|
|
|
|
_ = c.Setopt(curl.OPT_VERBOSE, 1)
|
|
|
|
|
|
|
|
|
|
// Set proper authentication type.
|
|
|
|
|
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
|
|
|
|
|
_ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(stream.Username, ":", stream.Password))
|
|
|
|
@@ -240,13 +243,12 @@ func (s *Scanner) routeAttack(stream Stream, route string) bool {
|
|
|
|
|
_ = c.Setopt(curl.OPT_URL, attackURL)
|
|
|
|
|
// Set the RTSP STREAM URI as the stream URL.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_STREAM_URI, attackURL)
|
|
|
|
|
// 2 is CURL_RTSPREQ_DESCRIBE.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, rtspDescribe)
|
|
|
|
|
|
|
|
|
|
// Perform the request.
|
|
|
|
|
err := c.Perform()
|
|
|
|
|
if err != nil {
|
|
|
|
|
s.term.Errorf("Perform failed: %v", err)
|
|
|
|
|
s.term.Errorf("Perform failed for %q (auth %d): %v", attackURL, stream.AuthenticationType, err)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -269,6 +271,10 @@ func (s *Scanner) routeAttack(stream Stream, route string) bool {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Scanner) credAttack(stream Stream, username string, password string) bool {
|
|
|
|
|
fmt.Println()
|
|
|
|
|
fmt.Println()
|
|
|
|
|
fmt.Println()
|
|
|
|
|
|
|
|
|
|
c := s.curl.Duphandle()
|
|
|
|
|
|
|
|
|
|
attackURL := fmt.Sprintf(
|
|
|
|
@@ -282,6 +288,8 @@ func (s *Scanner) credAttack(stream Stream, username string, password string) bo
|
|
|
|
|
|
|
|
|
|
s.setCurlOptions(c)
|
|
|
|
|
|
|
|
|
|
_ = c.Setopt(curl.OPT_VERBOSE, 1)
|
|
|
|
|
|
|
|
|
|
// Set proper authentication type.
|
|
|
|
|
_ = c.Setopt(curl.OPT_HTTPAUTH, stream.AuthenticationType)
|
|
|
|
|
_ = c.Setopt(curl.OPT_USERPWD, fmt.Sprint(username, ":", password))
|
|
|
|
@@ -290,13 +298,12 @@ func (s *Scanner) credAttack(stream Stream, username string, password string) bo
|
|
|
|
|
_ = c.Setopt(curl.OPT_URL, attackURL)
|
|
|
|
|
// Set the RTSP STREAM URI as the stream URL.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_STREAM_URI, attackURL)
|
|
|
|
|
// 2 is CURL_RTSPREQ_DESCRIBE.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, 2)
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, rtspDescribe)
|
|
|
|
|
|
|
|
|
|
// Perform the request.
|
|
|
|
|
err := c.Perform()
|
|
|
|
|
if err != nil {
|
|
|
|
|
s.term.Errorf("Perform failed: %v", err)
|
|
|
|
|
s.term.Errorf("Perform failed for %q (auth %d): %v", attackURL, stream.AuthenticationType, err)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -341,7 +348,6 @@ func (s *Scanner) validateStream(stream Stream) bool {
|
|
|
|
|
_ = c.Setopt(curl.OPT_URL, attackURL)
|
|
|
|
|
// Set the RTSP STREAM URI as the stream URL.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_STREAM_URI, attackURL)
|
|
|
|
|
// 2 is CURL_RTSPREQ_SETUP.
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_REQUEST, rtspSetup)
|
|
|
|
|
|
|
|
|
|
_ = c.Setopt(curl.OPT_RTSP_TRANSPORT, "RTP/AVP;unicast;client_port=33332-33333")
|
|
|
|
@@ -349,7 +355,7 @@ func (s *Scanner) validateStream(stream Stream) bool {
|
|
|
|
|
// Perform the request.
|
|
|
|
|
err := c.Perform()
|
|
|
|
|
if err != nil {
|
|
|
|
|
s.term.Errorf("Perform failed: %v", err)
|
|
|
|
|
s.term.Errorf("Perform failed for %q (auth %d): %v", attackURL, stream.AuthenticationType, err)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|