fixed unit tests in core
git-svn-id: file:///home/svn/framework3/trunk@4464 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
7186ee7263
commit
117d004e01
|
@ -92,10 +92,10 @@ module BindTcp
|
|||
return if not lport
|
||||
|
||||
# Only try the same host/port combination once
|
||||
phash = rhost + ':' + lport
|
||||
phash = rhost + ':' + lport.to_s
|
||||
return if self.listener_pairs[phash]
|
||||
self.listener_pairs[phash] = true
|
||||
|
||||
|
||||
# Start a new handling thread
|
||||
self.listener_threads << Thread.new {
|
||||
client = nil
|
||||
|
@ -133,7 +133,7 @@ module BindTcp
|
|||
# Wait a second before trying again
|
||||
Rex::ThreadSafe.sleep(0.5)
|
||||
end
|
||||
|
||||
|
||||
# Valid client connection?
|
||||
if (client)
|
||||
|
||||
|
@ -161,11 +161,11 @@ module BindTcp
|
|||
#
|
||||
def stop_handler
|
||||
# Stop the listener threads
|
||||
listener_threads.each do |t|
|
||||
self.listener_threads.each do |t|
|
||||
t.kill
|
||||
end
|
||||
listener_threads = []
|
||||
listener_pairs = {}
|
||||
self.listener_threads = []
|
||||
self.listener_pairs = {}
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -10,7 +10,7 @@ module Msf
|
|||
|
||||
class Handler::BindTcp::UnitTest < Test::Unit::TestCase
|
||||
|
||||
class Stub < Msf::Module
|
||||
class Stub < Msf::Payload
|
||||
end
|
||||
|
||||
module Foo
|
||||
|
@ -22,10 +22,11 @@ class Handler::BindTcp::UnitTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_handler
|
||||
h = Stub.new({})
|
||||
c = Class.new(Stub)
|
||||
|
||||
h.extend(Msf::Handler::BindTcp)
|
||||
h.extend(Foo)
|
||||
c.include(Foo, Msf::Handler::BindTcp)
|
||||
|
||||
h = c.new({})
|
||||
|
||||
begin
|
||||
t = Rex::Socket::TcpServer.create(
|
||||
|
|
|
@ -10,7 +10,7 @@ module Msf
|
|||
|
||||
class Handler::ReverseTcp::UnitTest < Test::Unit::TestCase
|
||||
|
||||
class Stub < Msf::Module
|
||||
class Stub < Msf::Payload
|
||||
include Msf::Handler::ReverseTcp
|
||||
end
|
||||
|
||||
|
@ -23,9 +23,10 @@ class Handler::ReverseTcp::UnitTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_handler
|
||||
h = Stub.new({})
|
||||
c = Class.new(Stub)
|
||||
c.include(Foo)
|
||||
|
||||
h.extend(Foo)
|
||||
h = c.new({})
|
||||
|
||||
begin
|
||||
h.datastore['LPORT'] = 4444
|
||||
|
|
Loading…
Reference in New Issue