diff --git a/lib/rex/logging/log_dispatcher.rb b/lib/rex/logging/log_dispatcher.rb index 01c6b7e479..2d811f0e92 100644 --- a/lib/rex/logging/log_dispatcher.rb +++ b/lib/rex/logging/log_dispatcher.rb @@ -1,4 +1,5 @@ require 'Rex' +require 'Rex/Logging/LogSink' module Rex module Logging diff --git a/lib/rex/socket.rb b/lib/rex/socket.rb index 722ba7de4c..5f00273dcc 100644 --- a/lib/rex/socket.rb +++ b/lib/rex/socket.rb @@ -75,6 +75,13 @@ class Socket return [ af, up.join('.'), port ] end + # + # Resolves a host to raw network-byte order + # + def self.resolv_nbo(host) + return to_sockaddr(host, 0)[4,4] + end + ## # # Class initialization diff --git a/lib/rex/socket.rb.ut.rb b/lib/rex/socket.rb.ut.rb index cc5f89c554..6336d6993a 100644 --- a/lib/rex/socket.rb.ut.rb +++ b/lib/rex/socket.rb.ut.rb @@ -54,4 +54,8 @@ class Rex::Socket::UnitTest < Test::Unit::TestCase assert_equal(22, port, "port = 22") end + def test_resolv_nbo + assert_equal("\x04\x03\x02\x01", Rex::Socket.resolv_nbo("4.3.2.1")) + end + end