node/lib/metasm/samples/dasm-plugins/scanxrefs.rb
def scanxrefs(target)
	ans = []
	sections.sort.each { |s_addr, edata|
		raw = edata.data.to_str
		(0..raw.length-4).each { |off|
			r = raw[off, 4].unpack('V').first
			ans << (s_addr + off) if (r + off+4 + s_addr)&0xffffffff == target or r == target
		}
	}
	ans
end
# metasm dasm plugin: scan for xrefs to the target address, incl. relative offsets (eg near call/jmp)
metasm dasm plugin: scan for xrefs to the target address, incl. relative offsets
metasm dasm plugin : scan for xrefs to the target address incl . relative offsets
def scanxrefs(target)
	ans = []
	sections.sort.each { |s_addr, edata|
		raw = edata.data.to_str
		(0..raw.length-4).each { |off|
			r = raw[off, 4].unpack('V').first
			ans << (s_addr + off) if (r + off+4 + s_addr)&0xffffffff == target or r == target
		}
	}
	ans
end
def scanxrefs ( target ) ans = [ ] sections . sort . each { | s_addr , edata | raw = edata . data . to_str ( 0 .. raw . length - 4 ) . each { | off | r = raw [ off , 4 ] . unpack ( 'V' ) . first ans << ( s_addr + off ) if ( r + off + 4 + s_addr ) & 0xffffffff == target or r == target } } ans end
metasm dasm plugin: scan for xrefs to the target address, incl.
metasm dasm plugin : scan for xrefs to the target address incl .
target