Ejemplo n.º 1
0
func run() error {
	code, err := hex.DecodeString(asm)
	if err != nil {
		return err
	}

	config := blanket_emulator.Config{
		MaxTraceInstructionCount: 1000,
		MaxTraceTime:             0,
		MaxTracePages:            100,
		Arch:                     uc.ARCH_X86,
		Mode:                     uc.MODE_64,
		Disassembler:             &fakeDisassembler{},
	}

	mem := make(map[uint64]([]byte))
	mem[0x1000] = code
	em, err := blanket_emulator.NewEmulator(mem, config)

	if err != nil {
		return err
	}

	err = em.Run(0x1000)

	if err != nil {
		return err
	}

	fmt.Println("%v", em.GetHash(80))

	return nil
}
Ejemplo n.º 2
0
Archivo: hasher.go Proyecto: eqv/indika
func MakeBlanketEmulator(mem map[ds.Range]*ds.MappedRegion) *be.Emulator {
	config := be.Config{
		MaxTraceInstructionCount: 100,
		MaxTraceTime:             0,
		MaxTracePages:            50,
		Arch:                     &arch.ArchX86_64{},
	}
	env := be.NewRandEnv(0)
	em := be.NewEmulator(mem, config, env)
	return em
}
Ejemplo n.º 3
0
func MakeBlanketEmulator(mem map[ds.Range]*ds.MappedRegion) *be.Emulator {
	ev := be.NewEventsToMinHash()
	config := be.Config{
		MaxTraceInstructionCount: 100,
		MaxTraceTime:             0,
		MaxTracePages:            100,
		Arch:                     uc.ARCH_X86,
		Mode:                     uc.MODE_64,
		EventHandler:             ev,
	}
	mem_starts := mapKeysRangeToStarts(mem)
	em, err := be.NewEmulator(mem_starts, config)
	if err != nil {
		log.WithFields(log.Fields{"error": err}).Fatal("Error creating Emulator")
	}
	return em
}