Skip to content

Commit

Permalink
fix: check target OS compatibility before running modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jm33-m0 committed Jan 6, 2025
1 parent 656a652 commit aac0b85
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/lib/cc/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,20 @@ func UpdateOptions(modName string) (exist bool) {

// ModuleRun run current module
func ModuleRun() {
modObj := emp3r0r_data.Modules[CurrentMod]
if modObj == nil {
CliPrintError("ModuleRun: module %s not found", strconv.Quote(CurrentMod))
return
}
if CurrentTarget != nil {
target_os := CurrentTarget.GOOS
mod_os := strings.ToLower(modObj.Platform)
if mod_os != "generic" && target_os != mod_os {
CliPrintError("ModuleRun: module %s does not support %s", strconv.Quote(CurrentMod), target_os)
return
}
}

if CurrentMod == emp3r0r_data.ModCMD_EXEC {
if !CliYesNo("Run on all targets") {
CliPrintError("Target not specified")
Expand Down

0 comments on commit aac0b85

Please sign in to comment.