Simplify condition checks to improve code readability
This commit is contained in:
@@ -247,7 +247,7 @@ func AttackCredentials(c Curler, targets []Stream, credentials Credentials, time
|
||||
}
|
||||
|
||||
for _, result := range attackResults {
|
||||
if result.CredentialsFound == true {
|
||||
if result.CredentialsFound {
|
||||
targets = replace(targets, result)
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ func AttackRoute(c Curler, targets []Stream, routes Routes, timeout time.Duratio
|
||||
}
|
||||
|
||||
for _, result := range attackResults {
|
||||
if result.RouteFound == true {
|
||||
if result.RouteFound {
|
||||
targets = replace(targets, result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ func main() {
|
||||
// But some cameras run GST RTSP Server which prioritizes 401 over 404 contrary to most cameras.
|
||||
// For these cameras, running another route attack will solve the problem.
|
||||
for _, stream := range streams {
|
||||
if stream.RouteFound == false || stream.CredentialsFound == false {
|
||||
if !stream.RouteFound || !stream.CredentialsFound {
|
||||
|
||||
updateSpinner(w, "Found "+fmt.Sprint(len(streams))+" streams. Final attack...", options.EnableLogs)
|
||||
streams, err = cmrdr.AttackRoute(c, streams, routes, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs)
|
||||
|
||||
+1
-1
@@ -400,7 +400,7 @@ func TestNmapParseResults(t *testing.T) {
|
||||
}
|
||||
}
|
||||
assert.Equal(t, true, foundStream, "wrong streams parsed")
|
||||
if foundStream == false {
|
||||
if !foundStream {
|
||||
fmt.Printf("%+v\n", results)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user