def make_array(ea, size): if ea != idc.BADADDR and ea != 0: flags = idc.get_full_flags(ea) if not idc.isByte(flags) or idc.get_item_size(ea) != 1: idc.del_items(ea, idc.DOUNK_SIMPLE, 1) idc.MakeByte(ea) idc.MakeArray(ea, size)
def make_array(ea, size): if ea != idc.BADADDR and ea != 0: flags = idc.GetFlags(ea) if not idc.isByte(flags) or idc.ItemSize(ea) != 1: idc.MakeUnknown(ea, 1, idc.DOUNK_SIMPLE) idc.MakeByte(ea) idc.MakeArray(ea, size)
def datify(self): n = 0 ea = self.get_start_ea(self.DATA) print "\nLooking for possible strings starting at: %s:0x%X" % (idc.SegName(ea), ea) for s in idautils.Strings(): if s.ea > ea: if not idc.isASCII(idc.GetFlags(s.ea)) and idc.MakeStr(s.ea, idc.BADADDR): n += 1 print "Created %d new ASCII strings" % n print "Converting remaining data to DWORDs...", while ea != idc.BADADDR: flags = idc.GetFlags(ea) if idc.isUnknown(flags) or idc.isByte(flags): idc.MakeDword(ea) idc.OpOff(ea, 0, 0) ea = idc.NextAddr(ea) print "done.\n"
def make_array(ea, size): if ea != idc.BADADDR and ea != 0: flags = idc.get_full_flags(ea) if not idc.isByte(flags) or idc.get_item_size(ea) != 1: idc.del_items(ea, idc.DOUNK_SIMPLE, 1) ida_bytes.create_data(ea, ida_bytes.FF_BYTE, 1, ida_idaapi.BADADDR) idc.make_array(ea, size)
def datify(self): ea = self.get_start_ea(self.DATA) if ea == idc.BADADDR: ea = idc.FirstSeg() print "Converting remaining data to DWORDs...", while ea != idc.BADADDR: flags = idc.GetFlags(ea) if idc.isUnknown(flags) or idc.isByte(flags): idc.MakeDword(ea) idc.OpOff(ea, 0, 0) ea = idc.NextAddr(ea) print "done."
def datify(self): ea = self.get_start_ea(self.DATA) if ea == idc.BADADDR: ea = idc.FirstSeg() print "Converting remaining data to DWORDs...", while ea != idc.BADADDR: flags = idc.GetFlags(ea) if (idc.isUnknown(flags) or idc.isByte(flags)) and ((ea % 4) == 0): idc.MakeDword(ea) idc.OpOff(ea, 0, 0) ea = idc.NextAddr(ea) print "done."
def datify(self): ea = self.get_start_ea(self.DATA) if ea == idc.BADADDR: ea = idc.FirstSeg() self.say("Converting remaining data to DWORDs...", ) while ea != idc.BADADDR: flags = idc.GetFlags(ea) if (idc.isUnknown(flags) or idc.isByte(flags)) and ((ea % 4) == 0): idc.MakeDword(ea) idc.OpOff(ea, 0, 0) ea = idc.NextAddr(ea) self.say("done.") self._fix_data_offsets()
def _read_struct_member_once(ea, flags, size, member_sid, member_size, asobject): """Read part of a struct member for _read_struct_member.""" if idc.isByte(flags): return read_word(ea, 1), 1 elif idc.isWord(flags): return read_word(ea, 2), 2 elif idc.isDwrd(flags): return read_word(ea, 4), 4 elif idc.isQwrd(flags): return read_word(ea, 8), 8 elif idc.isOwrd(flags): return read_word(ea, 16), 16 elif idc.isASCII(flags): return idc.GetManyBytes(ea, size), size elif idc.isFloat(flags): return idc.Float(ea), 4 elif idc.isDouble(flags): return idc.Double(ea), 8 elif idc.isStruct(flags): value = read_struct(ea, sid=member_sid, asobject=asobject) return value, member_size return None, size
def is_byte(self): return idc.isByte(self.flags)