Module: Msf::EvasiveTCP

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_send_delayObject

Returns the value of attribute _send_delay


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

def _send_delay
  @_send_delay
end

#_send_sizeObject

Returns the value of attribute _send_size


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

def _send_size
  @_send_size
end

#evasiveObject

Returns the value of attribute evasive


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

def evasive
  @evasive
end

Instance Method Details

#denagleObject


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

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

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


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

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