mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
b6a5f53233
git-svn-id: file:///home/svn/framework3/trunk@7465 4d416f70-5f16-0410-b530-b9f4589650da
38 lines
855 B
Ruby
Executable File
38 lines
855 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
#
|
|
# This tool provides an easy way to see what opcodes are associated with
|
|
# certain x86 instructions by making use of nasm if it is installed and
|
|
# reachable through the PATH environment variable.
|
|
#
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
require 'rex'
|
|
require 'rex/ui'
|
|
|
|
# Check to make sure nasm is installed and reachable through the user's PATH.
|
|
begin
|
|
Rex::Assembly::Nasm.check
|
|
rescue RuntimeError
|
|
puts "#{$!}"
|
|
exit
|
|
end
|
|
|
|
# Start a pseudo shell and dispatch lines to be assembled and then
|
|
# disassembled.
|
|
shell = Rex::Ui::Text::PseudoShell.new("%bldnasm%clr")
|
|
|
|
shell.run { |line|
|
|
line.gsub!(/(\r|\n)/, '')
|
|
line.gsub!(/\\n/, "\n")
|
|
|
|
break if (line =~ /^(exit|quit)/i)
|
|
|
|
begin
|
|
puts(Rex::Assembly::Nasm.disassemble(
|
|
Rex::Assembly::Nasm.assemble(line)))
|
|
rescue RuntimeError
|
|
puts "Error: #{$!}"
|
|
end
|
|
}
|