1
0

if-else -> switch

This commit is contained in:
dump_stack() 2018-12-10 02:32:13 +00:00
parent db27959c8b
commit 1f35eb165d

7
pew.go
View File

@ -244,7 +244,8 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
} }
} }
if ka.Type == config.KernelModule { switch ka.Type {
case config.KernelModule:
// TODO Write insmod log to file or database // TODO Write insmod log to file or database
output, err := q.CopyAndInsmod(outFile) output, err := q.CopyAndInsmod(outFile)
if err != nil { if err != nil {
@ -260,7 +261,7 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
return return
} }
test_ok = true test_ok = true
} else if ka.Type == config.KernelExploit { case config.KernelExploit:
remoteExploit := fmt.Sprintf("/tmp/exploit_%d", rand.Int()) remoteExploit := fmt.Sprintf("/tmp/exploit_%d", rand.Int())
err = q.CopyFile("user", outFile, remoteExploit) err = q.CopyFile("user", outFile, remoteExploit)
if err != nil { if err != nil {
@ -275,7 +276,7 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
} }
run_ok = true // does not really used run_ok = true // does not really used
test_ok = true test_ok = true
} else { default:
err = errors.New("Unsupported artifact type") err = errors.New("Unsupported artifact type")
} }
return return