fix: update probeDescribeHeaders to support tls dialer & continue if bad credentials in attack

This commit is contained in:
Jake Daynes
2026-03-13 03:58:00 -07:00
parent 75e9b8dc50
commit f3eb09812b
2 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -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)
a.reporter.Debug(cameradar.StepAttackCredentials, msg)
return target, nil
continue
}
if ok {
@@ -328,6 +328,7 @@ func (a Attacker) credAttack(ctx context.Context, stream cameradar.Stream, usern
code, err := a.describeStatus(u)
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)
}
+10 -1
View File
@@ -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.
func (a Attacker) probeDescribeHeaders(ctx context.Context, u *base.URL, urlStr string) (base.StatusCode, base.Header, error) {
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 {
return 0, nil, err
}