1
0
Fork 0

Refactor variable names

timestamps
dump_stack() 2018-12-10 02:35:43 +00:00
parent 051d080a67
commit 597de7f8c4
1 changed files with 16 additions and 16 deletions

32
pew.go
View File

@ -136,7 +136,7 @@ func genOkFail(name string, ok bool) aurora.Value {
} }
func dumpResult(q *qemu.QemuSystem, ka config.Artifact, ki config.KernelInfo, func dumpResult(q *qemu.QemuSystem, ka config.Artifact, ki config.KernelInfo,
build_ok, run_ok, test_ok *bool) { buildOk, runOk, testOk *bool) {
distroInfo := fmt.Sprintf("%s-%s {%s}", ki.DistroType, distroInfo := fmt.Sprintf("%s-%s {%s}", ki.DistroType,
ki.DistroRelease, ki.KernelRelease) ki.DistroRelease, ki.KernelRelease)
@ -144,13 +144,13 @@ func dumpResult(q *qemu.QemuSystem, ka config.Artifact, ki config.KernelInfo,
colored := "" colored := ""
if ka.Type == config.KernelExploit { if ka.Type == config.KernelExploit {
colored = aurora.Sprintf("[*] %40s: %s %s", distroInfo, colored = aurora.Sprintf("[*] %40s: %s %s", distroInfo,
genOkFail("BUILD", *build_ok), genOkFail("BUILD", *buildOk),
genOkFail("LPE", *test_ok)) genOkFail("LPE", *testOk))
} else { } else {
colored = aurora.Sprintf("[*] %40s: %s %s %s", distroInfo, colored = aurora.Sprintf("[*] %40s: %s %s %s", distroInfo,
genOkFail("BUILD", *build_ok), genOkFail("BUILD", *buildOk),
genOkFail("INSMOD", *run_ok), genOkFail("INSMOD", *runOk),
genOkFail("TEST", *test_ok)) genOkFail("TEST", *testOk))
} }
additional := "" additional := ""
@ -195,10 +195,10 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
} }
defer os.RemoveAll(tmp) defer os.RemoveAll(tmp)
build_ok := false buildOk := false
run_ok := false runOk := false
test_ok := false testOk := false
defer dumpResult(q, ka, ki, &build_ok, &run_ok, &test_ok) defer dumpResult(q, ka, ki, &buildOk, &runOk, &testOk)
var outFile, output string var outFile, output string
if binaryPath == "" { if binaryPath == "" {
@ -208,10 +208,10 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
log.Println(output) log.Println(output)
return return
} }
build_ok = true buildOk = true
} else { } else {
outFile = binaryPath outFile = binaryPath
build_ok = true buildOk = true
} }
err = cleanDmesg(q) err = cleanDmesg(q)
@ -252,7 +252,7 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
log.Println(output, err) log.Println(output, err)
return return
} }
run_ok = true runOk = true
// TODO Write test results to file or database // TODO Write test results to file or database
output, err = testKernelModule(q, ka, remoteTest) output, err = testKernelModule(q, ka, remoteTest)
@ -260,7 +260,7 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
log.Println(output, err) log.Println(output, err)
return return
} }
test_ok = true testOk = true
case 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)
@ -274,8 +274,8 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka config.Artifact,
log.Println(output) log.Println(output)
return return
} }
run_ok = true // does not really used runOk = true // does not really used
test_ok = true testOk = true
default: default:
err = errors.New("Unsupported artifact type") err = errors.New("Unsupported artifact type")
} }