node/lib/metasm/samples/dbg-plugins/heapscan/heapscan.rb
# 4-byte xor key to decrypt the chunk headers
4-byte xor key to decrypt the chunk headers
4 - byte xor key to decrypt the chunk headers
def each_heap_segment(ar)
		if ar.encodeflagmask != 0
			@chunkkey_size = ar.encoding.size
			@chunkkey_flags = ar.encoding.flags
			@chunkkey_unusedbytes = ar.encoding.unusedbytes
		else
			@chunkkey_size = 0
			@chunkkey_flags = 0
			@chunkkey_unusedbytes = 0
		end
		each_listentry(ar.segmentlist, '_HEAP_SEGMENT', 0x10) { |sg|
			skiplist = []
			each_listentry(sg.ucrsegmentlist, '_HEAP_UCR_DESCRIPTOR', 8) { |ucr|
				skiplist << [ucr.address, ucr.size]
			}
			ptr = sg.firstentry
			ptrend = sg.lastvalidentry + @hsz
			skiplist.delete_if { |sa, sl| sa < ptr or sa + sl > ptrend }
			skiplist << [ptrend, 1]
			skiplist.sort.each { |sa, sl|
				yield(ptr, sa-ptr)
				ptr = sa + sl
			}
		}
	end
def each_heap_segment ( ar ) if ar . encodeflagmask != 0 @chunkkey_size = ar . encoding . size @chunkkey_flags = ar . encoding . flags @chunkkey_unusedbytes = ar . encoding . unusedbytes else @chunkkey_size = 0 @chunkkey_flags = 0 @chunkkey_unusedbytes = 0 end each_listentry ( ar . segmentlist , '_HEAP_SEGMENT' , 0x10 ) { | sg | skiplist = [ ] each_listentry ( sg . ucrsegmentlist , '_HEAP_UCR_DESCRIPTOR' , 8 ) { | ucr | skiplist << [ ucr . address , ucr . size ] } ptr = sg . firstentry ptrend = sg . lastvalidentry + @hsz skiplist . delete_if { | sa , sl | sa < ptr or sa + sl > ptrend } skiplist << [ ptrend , 1 ] skiplist . sort . each { | sa , sl | yield ( ptr , sa - ptr ) ptr = sa + sl } } end
4-byte xor key to decrypt the chunk headers
4 - byte xor key to decrypt the chunk headers
ar