fix: update probeDescribeHeaders to support tls dialer & continue if bad credentials in attack
This commit is contained in:
@@ -224,7 +224,7 @@ func (a Attacker) attackCredentialsForStream(ctx context.Context, target camerad
|
|||||||
msg := fmt.Sprintf("credential attempt failed for %s:%d (%s:%s): %v", target.Address.String(), target.Port, username, password, err)
|
msg := fmt.Sprintf("credential attempt failed for %s:%d (%s:%s): %v", target.Address.String(), target.Port, username, password, err)
|
||||||
a.reporter.Debug(cameradar.StepAttackCredentials, msg)
|
a.reporter.Debug(cameradar.StepAttackCredentials, msg)
|
||||||
|
|
||||||
return target, nil
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
@@ -328,6 +328,7 @@ func (a Attacker) credAttack(ctx context.Context, stream cameradar.Stream, usern
|
|||||||
|
|
||||||
code, err := a.describeStatus(u)
|
code, err := a.describeStatus(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
a.reporter.Debug(cameradar.StepAttackCredentials, fmt.Sprintf("Error testing %s:%s -> %v", username, password, err))
|
||||||
return false, fmt.Errorf("performing describe request at %q: %w", urlStr, err)
|
return false, fmt.Errorf("performing describe request at %q: %w", urlStr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -66,7 +66,16 @@ func (a Attacker) describeStatus(u *base.URL) (base.StatusCode, error) {
|
|||||||
// which is exactly what we need in order to detect authentication methods.
|
// which is exactly what we need in order to detect authentication methods.
|
||||||
func (a Attacker) probeDescribeHeaders(ctx context.Context, u *base.URL, urlStr string) (base.StatusCode, base.Header, error) {
|
func (a Attacker) probeDescribeHeaders(ctx context.Context, u *base.URL, urlStr string) (base.StatusCode, base.Header, error) {
|
||||||
dialer := &net.Dialer{Timeout: a.timeout}
|
dialer := &net.Dialer{Timeout: a.timeout}
|
||||||
conn, err := dialer.DialContext(ctx, "tcp", u.Host)
|
var conn net.Conn
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if u.Scheme == "rtsps" {
|
||||||
|
tlsDialer := &tls.Dialer{NetDialer: dialer, Config: &tls.Config{InsecureSkipVerify: true}}
|
||||||
|
conn, err = tlsDialer.DialContext(ctx, "tcp", u.Host)
|
||||||
|
} else {
|
||||||
|
conn, err = dialer.DialContext(ctx, "tcp", u.Host)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, nil, err
|
return 0, nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user