Class: Rex::Post::Meterpreter::Ui::Console::CommandDispatcher::Stdapi::Net

Inherits:
Object
  • Object
show all
Includes:
Extensions::Stdapi, Rex::Post::Meterpreter::Ui::Console::CommandDispatcher
Defined in:
lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb

Overview

The networking portion of the standard API extension.

Defined Under Namespace

Modules: PortForwardTracker

Constant Summary collapse

Klass =
Console::CommandDispatcher::Stdapi::Net
@@resolve_opts =

Options for the resolve command

Rex::Parser::Arguments.new(
'-h' => [false, 'Help banner.' ],
'-f' => [true,  'Address family - IPv4 or IPv6 (default IPv4)'])
@@route_opts =

Options for the route command.

Rex::Parser::Arguments.new(
'-h' => [false, 'Help banner.'])
@@portfwd_opts =

Options for the portfwd command.

Rex::Parser::Arguments.new(
'-h' => [false, 'Help banner.'],
'-i' => [true,  'Index of the port forward entry to interact with (see the "list" command).'],
'-l' => [true,  'Forward: local port to listen on. Reverse: local port to connect to.'],
'-r' => [true,  'Forward: remote host to connect to.'],
'-p' => [true,  'Forward: remote port to connect to. Reverse: remote port to listen on.'],
'-R' => [false, 'Indicates a reverse port forward.'],
'-L' => [true,  'Forward: local host to listen on (optional). Reverse: local host to connect to.'])
@@netstat_opts =

Options for the netstat command.

Rex::Parser::Arguments.new(
'-h' => [false, 'Help banner.'],
'-S' => [true, 'Search string.'])
@@arp_opts =

Options for ARP command.

Rex::Parser::Arguments.new(
'-h' => [false, 'Help banner.'],
'-S' => [true, 'Search string.'])

Constants included from Extensions::Stdapi

Extensions::Stdapi::COMMAND_ID_STDAPI_AUDIO_MIC_LIST, Extensions::Stdapi::COMMAND_ID_STDAPI_AUDIO_MIC_START, Extensions::Stdapi::COMMAND_ID_STDAPI_AUDIO_MIC_STOP, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHDIR, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHMOD, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_DELETE_DIR, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_DELETE_FILE, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_FILE_COPY, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_FILE_EXPAND_PATH, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_FILE_MOVE, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_GETWD, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_LS, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_MD5, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_MKDIR, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_MOUNT_SHOW, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_SEARCH, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_SEPARATOR, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_SHA1, Extensions::Stdapi::COMMAND_ID_STDAPI_FS_STAT, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_ADD_ROUTE, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_GET_ARP_TABLE, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_GET_NETSTAT, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_GET_PROXY, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_GET_ROUTES, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_CONFIG_REMOVE_ROUTE, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_RESOLVE_HOST, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_RESOLVE_HOSTS, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_SOCKET_TCP_SHUTDOWN, Extensions::Stdapi::COMMAND_ID_STDAPI_NET_TCP_CHANNEL_OPEN, Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API, Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_API_MULTI, Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_MEMREAD, Extensions::Stdapi::COMMAND_ID_STDAPI_RAILGUN_MEMWRITE, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_CHECK_KEY_EXISTS, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_CLOSE_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_CREATE_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_DELETE_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_DELETE_VALUE, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_ENUM_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_ENUM_KEY_DIRECT, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_ENUM_VALUE, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_ENUM_VALUE_DIRECT, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_LOAD_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_OPEN_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_OPEN_REMOTE_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_QUERY_CLASS, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_QUERY_VALUE_DIRECT, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_SET_VALUE, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_SET_VALUE_DIRECT, Extensions::Stdapi::COMMAND_ID_STDAPI_REGISTRY_UNLOAD_KEY, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_DRIVER_LIST, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_DROP_TOKEN, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_GETENV, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_GETPRIVS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_GETSID, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_GETUID, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_LOCALTIME, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_REV2SELF, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_STEAL_TOKEN, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_CONFIG_SYSINFO, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_CLEAR, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_CLOSE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_NUMRECORDS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_OLDEST, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_OPEN, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_EVENTLOG_READ, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_POWER_EXITWINDOWS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_ATTACH, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_CLOSE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_EXECUTE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_GETPID, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_GET_INFO, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_GET_PROCESSES, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_IMAGE_GET_IMAGES, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_IMAGE_GET_PROC_ADDRESS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_IMAGE_LOAD, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_IMAGE_UNLOAD, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_KILL, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_ALLOCATE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_FREE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_LOCK, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_PROTECT, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_QUERY, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_READ, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_UNLOCK, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_WRITE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_CLOSE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_CREATE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_GET_THREADS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_OPEN, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_QUERY_REGS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_RESUME, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_SET_REGS, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_SUSPEND, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_THREAD_TERMINATE, Extensions::Stdapi::COMMAND_ID_STDAPI_SYS_PROCESS_WAIT, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_DESKTOP_ENUM, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_DESKTOP_GET, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_DESKTOP_SCREENSHOT, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_DESKTOP_SET, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_ENABLE_KEYBOARD, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_ENABLE_MOUSE, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_GET_IDLE_TIME, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_GET_KEYS_UTF8, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_SEND_KEYEVENT, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_SEND_KEYS, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_SEND_MOUSE, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_START_KEYSCAN, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_STOP_KEYSCAN, Extensions::Stdapi::COMMAND_ID_STDAPI_UI_UNLOCK_DESKTOP, Extensions::Stdapi::COMMAND_ID_STDAPI_WEBCAM_AUDIO_RECORD, Extensions::Stdapi::COMMAND_ID_STDAPI_WEBCAM_GET_FRAME, Extensions::Stdapi::COMMAND_ID_STDAPI_WEBCAM_LIST, Extensions::Stdapi::COMMAND_ID_STDAPI_WEBCAM_START, Extensions::Stdapi::COMMAND_ID_STDAPI_WEBCAM_STOP, Extensions::Stdapi::DELETE_KEY_FLAG_RECURSIVE, Extensions::Stdapi::EXTENSION_ID_STDAPI, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_CHANNELIZED, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_DESKTOP, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_HIDDEN, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_SESSION, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_SUBSHELL, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_SUSPENDED, Extensions::Stdapi::PROCESS_EXECUTE_FLAG_USE_THREAD_TOKEN, Extensions::Stdapi::TLV_TYPE_ADDR_TYPE, Extensions::Stdapi::TLV_TYPE_ALLOCATION_TYPE, Extensions::Stdapi::TLV_TYPE_ALLOC_BASE_ADDRESS, Extensions::Stdapi::TLV_TYPE_ALLOC_PROTECTION, Extensions::Stdapi::TLV_TYPE_ARCHITECTURE, Extensions::Stdapi::TLV_TYPE_ARP_ENTRY, Extensions::Stdapi::TLV_TYPE_AUDIO_DATA, Extensions::Stdapi::TLV_TYPE_AUDIO_DURATION, Extensions::Stdapi::TLV_TYPE_AUDIO_INTERFACE_ID, Extensions::Stdapi::TLV_TYPE_AUDIO_INTERFACE_NAME, Extensions::Stdapi::TLV_TYPE_BASE_ADDRESS, Extensions::Stdapi::TLV_TYPE_BASE_KEY, Extensions::Stdapi::TLV_TYPE_BUILD_TUPLE, Extensions::Stdapi::TLV_TYPE_COMPUTER_NAME, Extensions::Stdapi::TLV_TYPE_CONNECT_RETRIES, Extensions::Stdapi::TLV_TYPE_CREATION_FLAGS, Extensions::Stdapi::TLV_TYPE_DESKTOP, Extensions::Stdapi::TLV_TYPE_DESKTOP_NAME, Extensions::Stdapi::TLV_TYPE_DESKTOP_SCREENSHOT, Extensions::Stdapi::TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_BUFFER, Extensions::Stdapi::TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_BUFFER, Extensions::Stdapi::TLV_TYPE_DESKTOP_SCREENSHOT_QUALITY, Extensions::Stdapi::TLV_TYPE_DESKTOP_SESSION, Extensions::Stdapi::TLV_TYPE_DESKTOP_STATION, Extensions::Stdapi::TLV_TYPE_DESKTOP_SWITCH, Extensions::Stdapi::TLV_TYPE_DIRECTORY_PATH, Extensions::Stdapi::TLV_TYPE_DOMAIN, Extensions::Stdapi::TLV_TYPE_DRIVER_BASENAME, Extensions::Stdapi::TLV_TYPE_DRIVER_ENTRY, Extensions::Stdapi::TLV_TYPE_DRIVER_FILENAME, Extensions::Stdapi::TLV_TYPE_ENTRY_PARAMETER, Extensions::Stdapi::TLV_TYPE_ENTRY_POINT, Extensions::Stdapi::TLV_TYPE_ENV_GROUP, Extensions::Stdapi::TLV_TYPE_ENV_VALUE, Extensions::Stdapi::TLV_TYPE_ENV_VARIABLE, Extensions::Stdapi::TLV_TYPE_EVENT_CATEGORY, Extensions::Stdapi::TLV_TYPE_EVENT_DATA, Extensions::Stdapi::TLV_TYPE_EVENT_HANDLE, Extensions::Stdapi::TLV_TYPE_EVENT_ID, Extensions::Stdapi::TLV_TYPE_EVENT_NUMRECORDS, Extensions::Stdapi::TLV_TYPE_EVENT_READFLAGS, Extensions::Stdapi::TLV_TYPE_EVENT_RECORDNUMBER, Extensions::Stdapi::TLV_TYPE_EVENT_RECORDOFFSET, Extensions::Stdapi::TLV_TYPE_EVENT_SOURCENAME, Extensions::Stdapi::TLV_TYPE_EVENT_STRING, Extensions::Stdapi::TLV_TYPE_EVENT_TIMEGENERATED, Extensions::Stdapi::TLV_TYPE_EVENT_TIMEWRITTEN, Extensions::Stdapi::TLV_TYPE_EVENT_TYPE, Extensions::Stdapi::TLV_TYPE_EXIT_CODE, Extensions::Stdapi::TLV_TYPE_FILE_HASH, Extensions::Stdapi::TLV_TYPE_FILE_MODE, Extensions::Stdapi::TLV_TYPE_FILE_MODE_T, Extensions::Stdapi::TLV_TYPE_FILE_NAME, Extensions::Stdapi::TLV_TYPE_FILE_PATH, Extensions::Stdapi::TLV_TYPE_FILE_SHORT_NAME, Extensions::Stdapi::TLV_TYPE_FILE_SIZE, Extensions::Stdapi::TLV_TYPE_GATEWAY, Extensions::Stdapi::TLV_TYPE_GATEWAY_STRING, Extensions::Stdapi::TLV_TYPE_HANDLE, Extensions::Stdapi::TLV_TYPE_HKEY, Extensions::Stdapi::TLV_TYPE_HOST_NAME, Extensions::Stdapi::TLV_TYPE_IDLE_TIME, Extensions::Stdapi::TLV_TYPE_IMAGE_BASE, Extensions::Stdapi::TLV_TYPE_IMAGE_FILE, Extensions::Stdapi::TLV_TYPE_IMAGE_FILE_PATH, Extensions::Stdapi::TLV_TYPE_IMAGE_GROUP, Extensions::Stdapi::TLV_TYPE_IMAGE_NAME, Extensions::Stdapi::TLV_TYPE_INHERIT, Extensions::Stdapi::TLV_TYPE_INTERFACE_FLAGS, Extensions::Stdapi::TLV_TYPE_INTERFACE_INDEX, Extensions::Stdapi::TLV_TYPE_INTERFACE_MTU, Extensions::Stdapi::TLV_TYPE_IP, Extensions::Stdapi::TLV_TYPE_IP6_SCOPE, Extensions::Stdapi::TLV_TYPE_IP_PREFIX, Extensions::Stdapi::TLV_TYPE_KEYEVENT_SEND, Extensions::Stdapi::TLV_TYPE_KEYSCAN_TRACK_ACTIVE_WINDOW, Extensions::Stdapi::TLV_TYPE_KEYS_DUMP, Extensions::Stdapi::TLV_TYPE_KEYS_SEND, Extensions::Stdapi::TLV_TYPE_KEY_NAME, Extensions::Stdapi::TLV_TYPE_LANG_SYSTEM, Extensions::Stdapi::TLV_TYPE_LOCAL_DATETIME, Extensions::Stdapi::TLV_TYPE_LOCAL_HOST, Extensions::Stdapi::TLV_TYPE_LOCAL_HOST_RAW, Extensions::Stdapi::TLV_TYPE_LOCAL_PORT, Extensions::Stdapi::TLV_TYPE_LOGGED_ON_USER_COUNT, Extensions::Stdapi::TLV_TYPE_MAC_ADDRESS, Extensions::Stdapi::TLV_TYPE_MAC_NAME, Extensions::Stdapi::TLV_TYPE_MEMORY_STATE, Extensions::Stdapi::TLV_TYPE_MEMORY_TYPE, Extensions::Stdapi::TLV_TYPE_MOUNT, Extensions::Stdapi::TLV_TYPE_MOUNT_NAME, Extensions::Stdapi::TLV_TYPE_MOUNT_SPACE_FREE, Extensions::Stdapi::TLV_TYPE_MOUNT_SPACE_TOTAL, Extensions::Stdapi::TLV_TYPE_MOUNT_SPACE_USER, Extensions::Stdapi::TLV_TYPE_MOUNT_TYPE, Extensions::Stdapi::TLV_TYPE_MOUNT_UNCPATH, Extensions::Stdapi::TLV_TYPE_MOUSE_ACTION, Extensions::Stdapi::TLV_TYPE_MOUSE_X, Extensions::Stdapi::TLV_TYPE_MOUSE_Y, Extensions::Stdapi::TLV_TYPE_NETMASK, Extensions::Stdapi::TLV_TYPE_NETMASK_STRING, Extensions::Stdapi::TLV_TYPE_NETSTAT_ENTRY, Extensions::Stdapi::TLV_TYPE_NETWORK_INTERFACE, Extensions::Stdapi::TLV_TYPE_NETWORK_ROUTE, Extensions::Stdapi::TLV_TYPE_OS_NAME, Extensions::Stdapi::TLV_TYPE_PARENT_PID, Extensions::Stdapi::TLV_TYPE_PEER_HOST, Extensions::Stdapi::TLV_TYPE_PEER_HOST_RAW, Extensions::Stdapi::TLV_TYPE_PEER_PORT, Extensions::Stdapi::TLV_TYPE_PERMISSION, Extensions::Stdapi::TLV_TYPE_PID, Extensions::Stdapi::TLV_TYPE_PORT, Extensions::Stdapi::TLV_TYPE_POWER_FLAGS, Extensions::Stdapi::TLV_TYPE_POWER_REASON, Extensions::Stdapi::TLV_TYPE_PRIVILEGE, Extensions::Stdapi::TLV_TYPE_PROCEDURE_ADDRESS, Extensions::Stdapi::TLV_TYPE_PROCEDURE_NAME, Extensions::Stdapi::TLV_TYPE_PROCESS_ARCH, Extensions::Stdapi::TLV_TYPE_PROCESS_ARCH_NAME, Extensions::Stdapi::TLV_TYPE_PROCESS_ARGUMENTS, Extensions::Stdapi::TLV_TYPE_PROCESS_FLAGS, Extensions::Stdapi::TLV_TYPE_PROCESS_GROUP, Extensions::Stdapi::TLV_TYPE_PROCESS_HANDLE, Extensions::Stdapi::TLV_TYPE_PROCESS_MEMORY, Extensions::Stdapi::TLV_TYPE_PROCESS_NAME, Extensions::Stdapi::TLV_TYPE_PROCESS_PATH, Extensions::Stdapi::TLV_TYPE_PROCESS_PERMS, Extensions::Stdapi::TLV_TYPE_PROCESS_SESSION, Extensions::Stdapi::TLV_TYPE_PROTECTION, Extensions::Stdapi::TLV_TYPE_PROXY_CFG_AUTOCONFIGURL, Extensions::Stdapi::TLV_TYPE_PROXY_CFG_AUTODETECT, Extensions::Stdapi::TLV_TYPE_PROXY_CFG_PROXY, Extensions::Stdapi::TLV_TYPE_PROXY_CFG_PROXYBYPASS, Extensions::Stdapi::TLV_TYPE_REGISTER, Extensions::Stdapi::TLV_TYPE_REGISTER_NAME, Extensions::Stdapi::TLV_TYPE_REGISTER_SIZE, Extensions::Stdapi::TLV_TYPE_REGISTER_VALUE_32, Extensions::Stdapi::TLV_TYPE_ROOT_KEY, Extensions::Stdapi::TLV_TYPE_ROUTE_METRIC, Extensions::Stdapi::TLV_TYPE_SEARCH_GLOB, Extensions::Stdapi::TLV_TYPE_SEARCH_RECURSE, Extensions::Stdapi::TLV_TYPE_SEARCH_RESULTS, Extensions::Stdapi::TLV_TYPE_SEARCH_ROOT, Extensions::Stdapi::TLV_TYPE_SHUTDOWN_HOW, Extensions::Stdapi::TLV_TYPE_SID, Extensions::Stdapi::TLV_TYPE_STAT_BUF, Extensions::Stdapi::TLV_TYPE_STAT_BUF32, Extensions::Stdapi::TLV_TYPE_SUBNET, Extensions::Stdapi::TLV_TYPE_SUBNET_STRING, Extensions::Stdapi::TLV_TYPE_TARGET_HOST, Extensions::Stdapi::TLV_TYPE_THREAD_HANDLE, Extensions::Stdapi::TLV_TYPE_THREAD_ID, Extensions::Stdapi::TLV_TYPE_THREAD_PERMS, Extensions::Stdapi::TLV_TYPE_USER_NAME, Extensions::Stdapi::TLV_TYPE_VALUE_DATA, Extensions::Stdapi::TLV_TYPE_VALUE_NAME, Extensions::Stdapi::TLV_TYPE_VALUE_TYPE, Extensions::Stdapi::TLV_TYPE_WEBCAM_IMAGE, Extensions::Stdapi::TLV_TYPE_WEBCAM_INTERFACE_ID, Extensions::Stdapi::TLV_TYPE_WEBCAM_NAME, Extensions::Stdapi::TLV_TYPE_WEBCAM_QUALITY

Instance Attribute Summary

Attributes included from Ui::Text::DispatcherShell::CommandDispatcher

#shell, #tab_complete_items

Instance Method Summary collapse

Methods included from Rex::Post::Meterpreter::Ui::Console::CommandDispatcher

check_hash, #client, #docs_dir, #filter_commands, #initialize, #log_error, #msf_loaded?, set_hash

Methods included from Ui::Text::DispatcherShell::CommandDispatcher

#cmd_help, #cmd_help_help, #cmd_help_tabs, #deprecated_cmd, #deprecated_commands, #deprecated_help, #docs_dir, #help_to_s, #initialize, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #tab_complete_directory, #tab_complete_filenames, #tab_complete_generic, #tab_complete_source_address, #update_prompt

Instance Method Details

#cmd_arp(*args) ⇒ Object

Displays ARP cache of the remote machine.


178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 178

def cmd_arp(*args)
  if args.include?('-h')
    @@arp_opts.usage
    return 0
  end

  arp_table = client.net.config.arp_table
  search_term = nil

  @@arp_opts.parse(args) { |opt, idx, val|
    case opt
    when '-S'
      search_term = val
      if search_term.nil?
        print_error("Enter a search term")
        return true
      else
        search_term = /#{search_term}/nmi
      end
    end
  }

  tbl = Rex::Text::Table.new(
  'Header'  => 'ARP cache',
  'Indent'  => 4,
  'Columns' => [
    'IP address',
    'MAC address',
    'Interface'
  ],
  'SearchTerm' => search_term)

  arp_table.each { |arp|
    tbl << [ arp.ip_addr, arp.mac_addr, arp.interface ]
  }

  if tbl.rows.length > 0
    print_line("\n#{tbl.to_s}")
  else
    print_line('ARP cache is empty.')
  end
end

#cmd_getproxyObject


597
598
599
600
601
602
603
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 597

def cmd_getproxy
  p = client.net.config.get_proxy_config
  print_line( "Auto-detect     : #{p[:autodetect] ? "Yes" : "No"}" )
  print_line( "Auto config URL : #{p[:autoconfigurl]}" )
  print_line( "Proxy URL       : #{p[:proxy]}" )
  print_line( "Proxy Bypass    : #{p[:proxybypass]}" )
end

#cmd_ipconfig(*args) ⇒ Object Also known as: cmd_ifconfig

Displays interfaces on the remote machine.


225
226
227
228
229
230
231
232
233
234
235
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 225

def cmd_ipconfig(*args)
  ifaces = client.net.config.interfaces

  if (ifaces.length == 0)
    print_line('No interfaces were found.')
  else
    ifaces.sort{|a,b| a.index <=> b.index}.each do |iface|
      print("\n" + iface.pretty + "\n")
    end
  end
end

#cmd_netstat(*args) ⇒ Object

Displays network connections of the remote machine.


126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 126

def cmd_netstat(*args)
  if args.include?('-h')
    @@netstat_opts.usage
    return 0
  end

  connection_table = client.net.config.netstat
  search_term = nil

  @@netstat_opts.parse(args) { |opt, idx, val|
    case opt
    when '-S'
      search_term = val
      if search_term.nil?
        print_error("Enter a search term")
        return true
      else
        search_term = /#{search_term}/nmi
      end

    end
  }

  tbl = Rex::Text::Table.new(
  'Header'  => 'Connection list',
  'Indent'  => 4,
  'Columns' => [
    'Proto',
    'Local address',
    'Remote address',
    'State',
    'User',
    'Inode',
    'PID/Program name'
  ],
 'SearchTerm' => search_term)

  connection_table.each { |connection|
    tbl << [ connection.protocol, connection.local_addr_str, connection.remote_addr_str,
      connection.state, connection.uid, connection.inode, connection.pid_name]
  }

  if tbl.rows.length > 0
    print_line("\n#{tbl.to_s}")
  else
    print_line('Connection list is empty.')
  end
end

#cmd_portfwd(*args) ⇒ Object

Starts and stops local port forwards to remote hosts on the target network. This provides an elementary pivoting interface.


370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 370

def cmd_portfwd(*args)
  args.unshift('list') if args.empty?

  # For clarity's sake.
  lport = nil
  lhost = nil
  rport = nil
  rhost = nil
  reverse = false
  index = nil

  # Parse the options
  @@portfwd_opts.parse(args) { |opt, idx, val|
    case opt
      when '-h'
        cmd_portfwd_help
        return true
      when '-l'
        lport = val.to_i
      when '-L'
        lhost = val
      when '-p'
        rport = val.to_i
      when '-r'
        rhost = val
      when '-R'
        reverse = true
      when '-i'
        index = val.to_i
    end
  }

  # If we haven't extended the session, then do it now since we'll
  # need to track port forwards
  if client.kind_of?(PortForwardTracker) == false
    client.extend(PortForwardTracker)
    client.pfservice = Rex::ServiceManager.start(Rex::Services::LocalRelay)
  end

  # Build a local port forward in association with the channel
  service = client.pfservice

  # Process the command
  case args.shift
    when 'list'

      table = Rex::Text::Table.new(
        'Header'    => 'Active Port Forwards',
        'Indent'    => 3,
        'SortIndex' => -1,
        'Columns'   => ['Index', 'Local', 'Remote', 'Direction'])

      cnt = 0

      # Enumerate each TCP relay
      service.each_tcp_relay { |lhost, lport, rhost, rport, opts|
        next if (opts['MeterpreterRelay'] == nil)

        direction = 'Forward'
        direction = 'Reverse' if opts['Reverse'] == true

        table << [cnt + 1, "#{rhost}:#{rport}", "#{lhost}:#{lport}", direction]

        cnt += 1
      }

      print_line
      if cnt > 0
        print_line(table.to_s)
        print_line("#{cnt} total active port forwards.")
      else
        print_line('No port forwards are currently active.')
      end
      print_line

    when 'add'

      if reverse
        # Validate parameters
        unless lport && lhost && rport
          print_error('You must supply a local port, local host, and remote port.')
          return
        end

        begin
          channel = client.net.socket.create(
            Rex::Socket::Parameters.new(
              'LocalPort' => rport,
              'Proto'     => 'tcp',
              'Server'    => true
            )
          )

          # Start the local TCP reverse relay in association with this stream
          relay = service.start_reverse_tcp_relay(channel,
            'LocalPort'         => channel.params.localport,
            'PeerHost'          => lhost,
            'PeerPort'          => lport,
            'MeterpreterRelay'  => true)
          rport = relay.opts['LocalPort']
        rescue Exception => e
          print_error("Failed to create relay: #{e.to_s}")
          return false
        end

      else
        # Validate parameters
        unless lport && rhost && rport
          print_error('You must supply a local port, remote host, and remote port.')
          return
        end

        # Start the local TCP relay in association with this stream
        relay = service.start_tcp_relay(lport,
          'LocalHost'         => lhost,
          'PeerHost'          => rhost,
          'PeerPort'          => rport,
          'MeterpreterRelay'  => true,
          'OnLocalConnection' => Proc.new { |relay, lfd| create_tcp_channel(relay) })
        lport = relay.opts['LocalPort']
      end

      print_status("Local TCP relay created: #{lhost}:#{lport} <-> #{rhost}:#{rport}")

    # Delete local port forwards
    when 'delete', 'remove', 'del', 'rm'

      found = false
      unless index.nil?
        counter = 1
        service.each_tcp_relay do |lh, lp, rh, rp, opts|
          if counter == index
            lhost, lport, rhost, rport = lh, lp, rh, rp
            reverse = opts['Reverse'] == true
            found = true
            break
          end

          counter += 1
        end

        unless found
          print_error("Invalid index: #{index}")
        end
      end

      if reverse
        # No remote port, no love.
        unless rport
          print_error('You must supply a remote port.')
          return
        end

        if service.stop_reverse_tcp_relay(lport)
          print_status("Successfully stopped reverse TCP relay on :#{lport}")
        else
          print_error("Failed to stop reverse TCP relay on #{lport}")
        end
      else
        # No local port, no love.
        unless lport
          print_error('You must supply a local port.')
          return
        end

        # Stop the service
        if service.stop_tcp_relay(lport, lhost)
          print_status("Successfully stopped TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
        else
          print_error("Failed to stop TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
        end
      end

    when 'flush'

      counter = 0
      service.each_tcp_relay do |lhost, lport, rhost, rport, opts|
        next if (opts['MeterpreterRelay'] == nil)

        if opts['Reverse'] == true
          if service.stop_reverse_tcp_relay(lport)
            print_status("Successfully stopped reverse TCP relay on :#{lport}")
          else
            print_error("Failed to stop reverse TCP relay on #{lport}")
            next
          end
        else
          if service.stop_tcp_relay(lport, lhost)
            print_status("Successfully stopped TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
          else
            print_error("Failed to stop TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
            next
          end
        end

        counter += 1
      end
      print_status("Successfully flushed #{counter} rules")

    else
      cmd_portfwd_help
  end
end

#cmd_portfwd_helpObject


574
575
576
577
578
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 574

def cmd_portfwd_help
  print_line 'Usage: portfwd [-h] [add | delete | list | flush] [args]'
  print_line
  print @@portfwd_opts.usage
end

#cmd_portfwd_tabs(str, words) ⇒ Object


580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 580

def cmd_portfwd_tabs(str, words)
  return %w[add delete list flush] + @@portfwd_opts.fmt.keys if words.length == 1

  case words[-1]
  when '-L'
    return tab_complete_source_address
  when '-i'
    if client.respond_to?('pfservice')
      return (1..client.pfservice.each_tcp_relay { |lh, lp, rh, rp, opts| }.length).to_a.map!(&:to_s)
    end
  when 'add', 'delete', 'list', 'flush'
    return @@portfwd_opts.fmt.keys
  end

  []
end

#cmd_resolve(*args) ⇒ Object

Resolve 1 or more hostnames on the target session


608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 608

def cmd_resolve(*args)
  args.unshift('-h') if args.length == 0

  hostnames = []
  family = AF_INET

  @@resolve_opts.parse(args) { |opt, idx, val|
    case opt
    when '-h'
      print_line('Usage: resolve host1 host2 .. hostN [-h] [-f IPv4|IPv6]')
      print_line
      print_line(@@resolve_opts.usage)
      return false
    when '-f'
      if val.downcase == 'ipv6'
        family = AF_INET6
      elsif val.downcase != 'ipv4'
        print_error("Invalid family: #{val}")
        return false
      end
    else
      hostnames << val
    end
  }

  response = client.net.resolve.resolve_hosts(hostnames, family)

  table = Rex::Text::Table.new(
    'Header'    => 'Host resolutions',
    'Indent'    => 4,
    'SortIndex' => 0,
    'Columns'   => ['Hostname', 'IP Address']
  )

  response.each do |result|
    if result[:ip].nil?
      table << [result[:hostname], '[Failed To Resolve]']
    else
      table << [result[:hostname], result[:ip]]
    end
  end

  print_line
  print_line(table.to_s)
end

#cmd_route(*args) ⇒ Object

Displays or modifies the routing table on the remote machine.


242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 242

def cmd_route(*args)
  # Default to list
  if (args.length == 0)
    args.unshift('list')
  end

  # Check to see if they specified -h
  @@route_opts.parse(args) do |opt, idx, val|
    case opt
    when '-h'
      cmd_route_help
      return true
    end
  end

  cmd = args.shift

  # Process the commands
  case cmd
    when 'list'
      routes = client.net.config.routes

      # IPv4
      tbl = Rex::Text::Table.new(
        'Header'  => 'IPv4 network routes',
        'Indent'  => 4,
        'Columns' => [
          'Subnet',
          'Netmask',
          'Gateway',
          'Metric',
          'Interface'
        ])

      routes.select {|route|
        Rex::Socket.is_ipv4?(route.netmask)
      }.each { |route|
        tbl << [ route.subnet, route.netmask, route.gateway, route.metric, route.interface ]
      }

      if tbl.rows.length > 0
        print_line("\n#{tbl.to_s}")
      else
        print_line('No IPv4 routes were found.')
      end

      # IPv6
      tbl = Rex::Text::Table.new(
        'Header'  => 'IPv6 network routes',
        'Indent'  => 4,
        'Columns' => [
          'Subnet',
          'Netmask',
          'Gateway',
          'Metric',
          'Interface'
        ])

      routes.select {|route|
        Rex::Socket.is_ipv6?(route.netmask)
      }.each { |route|
        tbl << [ route.subnet, route.netmask, route.gateway, route.metric, route.interface ]
      }

      if tbl.rows.length > 0
        print("\n#{tbl.to_s}")
      else
        print_line('No IPv6 routes were found.')
      end

    when 'add'
      # Satisfy check to see that formatting is correct
      unless Rex::Socket::RangeWalker.new(args[0]).length == 1
        print_error "Invalid IP Address"
        return false
      end

      unless Rex::Socket::RangeWalker.new(args[1]).length == 1
        print_error 'Invalid Subnet mask'
        return false
      end

      print_line("Creating route #{args[0]}/#{args[1]} -> #{args[2]}")

      client.net.config.add_route(*args)
    when 'delete'
      # Satisfy check to see that formatting is correct
      unless Rex::Socket::RangeWalker.new(args[0]).length == 1
        print_error 'Invalid IP Address'
        return false
      end

      unless Rex::Socket::RangeWalker.new(args[1]).length == 1
        print_error 'Invalid Subnet mask'
        return false
      end

      print_line("Deleting route #{args[0]}/#{args[1]} -> #{args[2]}")

      client.net.config.remove_route(*args)
    else
      print_error("Unsupported command: #{cmd}")
  end
end

#cmd_route_helpObject


347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 347

def cmd_route_help
  print_line('Usage: route [-h] command [args]')
  print_line
  print_line('Display or modify the routing table on the remote machine.')
  print_line
  print_line('Supported commands:')
  print_line
  print_line('   add    [subnet] [netmask] [gateway]')
  print_line('   delete [subnet] [netmask] [gateway]')
  print_line('   list')
  print_line
  print_line
  print @@route_opts.usage
end

#cmd_route_tabs(str, words) ⇒ Object


362
363
364
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 362

def cmd_route_tabs(str, words)
  return %w[add delete list] + @@route_opts.fmt.keys if words.length == 1
end

#commandsObject

List of supported commands.


82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 82

def commands
  all = {
    'ipconfig' => 'Display interfaces',
    'ifconfig' => 'Display interfaces',
    'route'    => 'View and modify the routing table',
    'portfwd'  => 'Forward a local port to a remote service',
    'arp'      => 'Display the host ARP cache',
    'netstat'  => 'Display the network connections',
    'getproxy' => 'Display the current proxy configuration',
    'resolve'  => 'Resolve a set of host names on the target',
  }

  reqs = {
    'ipconfig' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES],
    'ifconfig' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_INTERFACES],
    'route'    => [
      # Also uses these, but we don't want to be unable to list them
      # just because we can't alter them.
      #COMMAND_ID_STDAPI_NET_CONFIG_ADD_ROUTE,
      #COMMAND_ID_STDAPI_NET_CONFIG_REMOVE_ROUTE,
      COMMAND_ID_STDAPI_NET_CONFIG_GET_ROUTES
    ],
    # Only creates tcp channels, which is something whose availability
    # we can't check directly at the moment.
    'portfwd'  => [],
    'arp'      => [COMMAND_ID_STDAPI_NET_CONFIG_GET_ARP_TABLE],
    'netstat'  => [COMMAND_ID_STDAPI_NET_CONFIG_GET_NETSTAT],
    'getproxy' => [COMMAND_ID_STDAPI_NET_CONFIG_GET_PROXY],
    'resolve'  => [COMMAND_ID_STDAPI_NET_RESOLVE_HOST],
  }

  filter_commands(all, reqs)
end

#create_tcp_channel(relay) ⇒ Object (protected)

Creates a TCP channel using the supplied relay context.


659
660
661
662
663
664
665
666
667
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 659

def create_tcp_channel(relay)
  client.net.socket.create(
    Rex::Socket::Parameters.new(
      'PeerHost' => relay.opts['PeerHost'],
      'PeerPort' => relay.opts['PeerPort'],
      'Proto'    => 'tcp'
    )
  )
end

#nameObject

Name for this dispatcher.


119
120
121
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb', line 119

def name
  'Stdapi: Networking'
end