Module: Msf::EvasiveTCP

Defined in:
lib/msf/core/exploit/remote/tcp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_send_delayObject

Returns the value of attribute _send_delay.



6
7
8
# File 'lib/msf/core/exploit/remote/tcp.rb', line 6

def _send_delay
  @_send_delay
end

#_send_sizeObject

Returns the value of attribute _send_size.



6
7
8
# File 'lib/msf/core/exploit/remote/tcp.rb', line 6

def _send_size
  @_send_size
end

#evasiveObject

Returns the value of attribute evasive.



6
7
8
# File 'lib/msf/core/exploit/remote/tcp.rb', line 6

def evasive
  @evasive
end

Instance Method Details

#denagleObject



8
9
10
11
12
13
# File 'lib/msf/core/exploit/remote/tcp.rb', line 8

def denagle
  begin
    setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
  rescue ::Exception
  end
end

#write(buf, opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/msf/core/exploit/remote/tcp.rb', line 15

def write(buf, opts={})

  return super(buf, opts) if not @evasive

  ret = 0
  idx = 0
  len = @_send_size || buf.length

  while(idx < buf.length)

    if(@_send_delay and idx > 0)
      ::IO.select(nil, nil, nil, @_send_delay)
    end

    pkt = buf[idx, len]

    res = super(pkt, opts)
    flush()

    idx += len
    ret += res if res
  end
  ret
end