Class: Rex::Post::Meterpreter::Extensions::NetworkPug::NetworkPug

Inherits:
Rex::Post::Meterpreter::Extension show all
Defined in:
lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb

Overview

NetworkPug implements a remote packet recieve/send on a network interface on the remote machine

Instance Attribute Summary

Attributes inherited from Rex::Post::Meterpreter::Extension

#name

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ NetworkPug

Returns a new instance of NetworkPug


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb', line 16

def initialize(client)
  super(client, 'networkpug')

  client.register_extension_aliases(
    [
      {
        'name' => 'networkpug',
        'ext'  => self
      },
    ])
end

Instance Method Details

#networkpug_start(interface, filter) ⇒ Object


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb', line 28

def networkpug_start(interface, filter)
  request = Packet.create_request('networkpug_start')
  request.add_tlv(TLV_TYPE_NETWORKPUG_INTERFACE, interface)
  request.add_tlv(TLV_TYPE_NETWORKPUG_FILTER, filter) if(filter and filter != "")
  response = client.send_request(request)

  channel = nil
  channel_id = response.get_tlv_value(TLV_TYPE_CHANNEL_ID)

  if(channel_id)
    channel = Rex::Post::Meterpreter::Channels::Pools::StreamPool.new(
      client,
      channel_id,
      "networkpug_interface",
      CHANNEL_FLAG_SYNCHRONOUS
    )
  end

  return response, channel
end

#networkpug_stop(interface) ⇒ Object


49
50
51
52
53
# File 'lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb', line 49

def networkpug_stop(interface)
  request = Packet.create_request('networkpug_stop')
  request.add_tlv(TLV_TYPE_NETWORKPUG_INTERFACE, interface)
  response = client.send_request(request)
end