2025-10-11 17:22:44 -04:00
|
|
|
package eliminate
|
|
|
|
|
|
|
|
|
|
import (
|
2025-10-11 21:01:07 -04:00
|
|
|
"fmt"
|
|
|
|
|
|
2025-10-11 17:22:44 -04:00
|
|
|
. "rmm-hunter/internal/suspicious"
|
|
|
|
|
|
|
|
|
|
scurvy "github.com/Kraken-OffSec/Scurvy"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// EliminateProcess kills a process and removes its binary from the system
|
|
|
|
|
func EliminateProcess(p Process) error {
|
2025-10-11 21:01:07 -04:00
|
|
|
err, procs := scurvy.ListProcesses()
|
2025-10-11 17:22:44 -04:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
2025-10-11 21:01:07 -04:00
|
|
|
|
|
|
|
|
for _, proc := range procs {
|
|
|
|
|
if proc.Pid() == p.PID {
|
|
|
|
|
return proc.Kill()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fmt.Errorf("process %d not found", p.PID)
|
2025-10-11 17:22:44 -04:00
|
|
|
}
|