Simplify condition checks to improve code readability

This commit is contained in:
Ullaakut
2018-10-01 19:52:15 +02:00
parent 4109a4405d
commit cf3ca440b9
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -247,7 +247,7 @@ func AttackCredentials(c Curler, targets []Stream, credentials Credentials, time
} }
for _, result := range attackResults { for _, result := range attackResults {
if result.CredentialsFound == true { if result.CredentialsFound {
targets = replace(targets, result) targets = replace(targets, result)
} }
} }
@@ -277,7 +277,7 @@ func AttackRoute(c Curler, targets []Stream, routes Routes, timeout time.Duratio
} }
for _, result := range attackResults { for _, result := range attackResults {
if result.RouteFound == true { if result.RouteFound {
targets = replace(targets, result) targets = replace(targets, result)
} }
} }
+1 -1
View File
@@ -140,7 +140,7 @@ func main() {
// But some cameras run GST RTSP Server which prioritizes 401 over 404 contrary to most cameras. // 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 these cameras, running another route attack will solve the problem.
for _, stream := range streams { 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) 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) streams, err = cmrdr.AttackRoute(c, streams, routes, time.Duration(options.Timeout)*time.Millisecond, options.EnableLogs)
+1 -1
View File
@@ -400,7 +400,7 @@ func TestNmapParseResults(t *testing.T) {
} }
} }
assert.Equal(t, true, foundStream, "wrong streams parsed") assert.Equal(t, true, foundStream, "wrong streams parsed")
if foundStream == false { if !foundStream {
fmt.Printf("%+v\n", results) fmt.Printf("%+v\n", results)
} }
} }