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 }
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 }
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 }