Monday, August 1, 2011

Converting IPv4 Addresses into Memory Addresses

This is helpful when you're writing your own Metasploit modules with custom shellcode:

#!/usr/bin/env ruby
# Enjoy ;)
ip = ARGV[0]
if ip.split(".").count == 4
  print "0x"
  ip.split(".").reverse.each do |octet|
    print "%02x" % octet.to_i
  end
  print "\n"
else
  puts "Invalid IPv4 Address"
end

No comments:

Post a Comment