Skip to content

load with multiple args failed #7

Description

@timwhitez

i want to load https://github.com/trustedsec/ELFLoader this program

package main

import (
	"github.com/Binject/universal"
	"io/ioutil"
	"log"
	"syscall"
	"unsafe"
)

func main() {
	image, err := ioutil.ReadFile("libELFLoader.so")

	loader, err := universal.NewLoader()
	if err != nil {
		log.Fatal(err)
	}

	library, err := loader.LoadLibrary("main", &image)
	if err != nil {
		log.Fatal(err)
	}

	g, _ := syscall.BytePtrFromString("go")

	f, _ := ioutil.ReadFile("whoami.o")

	inDataBuff := uintptr(unsafe.Pointer(&f[0]))
	inDataSize := uintptr(uint64(len(f)))

	val, err := library.Call("ELFRunner", uintptr(unsafe.Pointer(g)), inDataBuff, inDataSize, 0, 0)
	if err != nil {
		//log.Fatal(err)
	}
	log.Printf("%+v\n", val)
}

but didn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions