1
0

Use smep/smap settings from artifact config as default value

This commit is contained in:
dump_stack() 2019-08-19 22:37:27 +00:00
parent d425f455bb
commit 08ed3461ad
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 31 additions and 4 deletions

View File

@ -106,8 +106,18 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
} }
q.SetKASLR(kaslr) q.SetKASLR(kaslr)
q.SetSMEP(smep)
q.SetSMAP(smap) if !smep {
q.SetSMEP(false)
} else {
q.SetSMEP(!ka.Mitigations.DisableSmep)
}
if !smap {
q.SetSMAP(false)
} else {
q.SetSMAP(!ka.Mitigations.DisableSmap)
}
redgreen := func(name string, enabled bool) aurora.Value { redgreen := func(name string, enabled bool) aurora.Value {
if enabled { if enabled {
@ -117,8 +127,10 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
return aurora.BgRed(aurora.Gray(name)) return aurora.BgRed(aurora.Gray(name))
} }
fmt.Printf("[*] %s %s %s\n", redgreen("KASLR", kaslr), fmt.Printf("[*] %s %s %s\n",
redgreen("SMEP", smep), redgreen("SMAP", smap)) redgreen("KASLR", q.GetKASLR()),
redgreen("SMEP", q.GetSMEP()),
redgreen("SMAP", q.GetSMAP()))
q.Debug(gdb) q.Debug(gdb)
coloredGdbAddress := aurora.BgGreen(aurora.Black(gdb)) coloredGdbAddress := aurora.BgGreen(aurora.Black(gdb))

View File

@ -402,6 +402,21 @@ func (q *System) SetSMAP(state bool) {
q.noSMAP = !state q.noSMAP = !state
} }
// GetKASLR is retrieve KASLR settings
func (q *System) GetKASLR() bool {
return !q.noKASLR
}
// GetSMEP is retrieve SMEP settings
func (q *System) GetSMEP() bool {
return !q.noSMEP
}
// GetSMAP is retrieve SMAP settings
func (q *System) GetSMAP() bool {
return !q.noSMAP
}
// GetSSHCommand returns command for connect to qemu machine over ssh // GetSSHCommand returns command for connect to qemu machine over ssh
func (q System) GetSSHCommand() (cmd string) { func (q System) GetSSHCommand() (cmd string) {
addrPort := strings.Split(q.sshAddrPort, ":") addrPort := strings.Split(q.sshAddrPort, ":")