node/lib/metasm/metasm/gui/dasm_hex.rb
def prompt_search_hex
		text = ''
		if current_address.kind_of?(::Integer)
			text = Expression.encode_imm(current_address, "u#{@dasm.cpu.size}".to_sym, @dasm.cpu).unpack('H*').first
		end
		inputbox('hex pattern to search (hex regexp, use .. for wildcard)', :text => text) { |pat|
			pat = pat.gsub(' ', '').gsub('..', '.').gsub(/[0-9a-f][0-9a-f]/i) { |o| "\\x#{o}" }
			pat = Regexp.new(pat, Regexp::MULTILINE, 'n')	# 'n' = force ascii-8bit
			list = [['addr']] + @dasm.pattern_scan(pat).map { |a| [Expression[a]] }
			listwindow("hex search #{pat}", list) { |i| @parent_widget.focus_addr i[0] }
		}
	end
# pop a dialog, scans the sections for a hex pattern
pop a dialog, scans the sections for a hex pattern
pop a dialog scans the sections for a hex pattern
def prompt_search_hex
		text = ''
		if current_address.kind_of?(::Integer)
			text = Expression.encode_imm(current_address, "u#{@dasm.cpu.size}".to_sym, @dasm.cpu).unpack('H*').first
		end
		inputbox('hex pattern to search (hex regexp, use .. for wildcard)', :text => text) { |pat|
			pat = pat.gsub(' ', '').gsub('..', '.').gsub(/[0-9a-f][0-9a-f]/i) { |o| "\\x#{o}" }
			pat = Regexp.new(pat, Regexp::MULTILINE, 'n')	
			list = [['addr']] + @dasm.pattern_scan(pat).map { |a| [Expression[a]] }
			listwindow("hex search #{pat}", list) { |i| @parent_widget.focus_addr i[0] }
		}
	end
def prompt_search_hex text = '' if current_address . kind_of? ( :: Integer ) text = Expression . encode_imm ( current_address , "u#{@dasm.cpu.size}" . to_sym , @dasm . cpu ) . unpack ( 'H*' ) . first end inputbox ( 'hex pattern to search (hex regexp, use .. for wildcard)' , :text => text ) { | pat | pat = pat . gsub ( ' ' , '' ) . gsub ( '..' , '.' ) . gsub ( / [0-9a-f][0-9a-f] /i ) { | o | "\\x#{o}" } pat = Regexp . new ( pat , Regexp :: MULTILINE , 'n' ) list = [ [ 'addr' ] ] + @dasm . pattern_scan ( pat ) . map { | a | [ Expression [ a ] ] } listwindow ( "hex search #{pat}" , list ) { | i | @parent_widget . focus_addr i [ 0 ] } } end
pop a dialog, scans the sections for a hex pattern
pop a dialog scans the sections for a hex pattern
# 'n' = force ascii-8bit