Class: Rex::Proto::LDAP::Server::MockLdapClient

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/ldap/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, sock) ⇒ MockLdapClient

Create mock LDAP client

Parameters:

  • host (String)

    PeerHost IP address

  • port (Fixnum)

    PeerPort integer

  • sock (Socket)

    Connection socket



32
33
34
35
36
# File 'lib/rex/proto/ldap/server.rb', line 32

def initialize(host, port, sock)
  @peerhost = host
  @peerport = port
  @srvsock = sock
end

Instance Attribute Details

#peerhostObject (readonly)

Returns the value of attribute peerhost.



24
25
26
# File 'lib/rex/proto/ldap/server.rb', line 24

def peerhost
  @peerhost
end

#peerportObject (readonly)

Returns the value of attribute peerport.



24
25
26
# File 'lib/rex/proto/ldap/server.rb', line 24

def peerport
  @peerport
end

#srvsockObject (readonly)

Returns the value of attribute srvsock.



24
25
26
# File 'lib/rex/proto/ldap/server.rb', line 24

def srvsock
  @srvsock
end

Instance Method Details

#mock_ldap_client?Boolean

Test method to prevent GC/ObjectSpace abuse via class lookups

Returns:

  • (Boolean)


41
42
43
# File 'lib/rex/proto/ldap/server.rb', line 41

def mock_ldap_client?
  true
end

#write(data) ⇒ Object



45
46
47
# File 'lib/rex/proto/ldap/server.rb', line 45

def write(data)
  srvsock.sendto(data, peerhost, peerport)
end