Class: Msf::Sessions::NetwareConsole

Inherits:
Object
  • Object
show all
Includes:
Msf::Session::Basic, Msf::Session::Provider::SingleCommandShell
Defined in:
lib/msf/core/session/netware_console.rb

Overview

This class provides basic interaction with a command shell on the remote endpoint. This session is initialized with a stream that will be used as the pipe for reading and writing the command shell.

Instance Attribute Summary

Attributes included from Msf::Session::Interactive

#ring, #rstream

Attributes included from Rex::Ui::Interactive

#completed, #interacting, #on_command_proc, #on_print_proc

Attributes included from Rex::Ui::Subscriber::Input

#user_input

Attributes included from Rex::Ui::Subscriber::Output

#user_output

Attributes included from Msf::Session

#alive, #db_record, #exploit, #exploit_datastore, #exploit_task, #exploit_uuid, #framework, #info, #routes, #sid, #sname, #target_host, #target_port, #username, #uuid, #workspace

Attributes included from Framework::Offspring

#framework

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Msf::Session::Provider::SingleCommandShell

#set_shell_token_index, #shell_command_token, #shell_command_token_unix, #shell_command_token_win32, #shell_read_until_token

Methods included from Msf::Session::Interactive

#cleanup, #initialize, #interactive?, #kill, #run_cmd, #tunnel_local, #tunnel_peer

Methods included from Rex::Ui::Interactive

#detach, #interact

Methods included from Rex::Ui::Subscriber

#copy_ui, #init_ui, #reset_ui

Methods included from Rex::Ui::Subscriber::Input

#gets

Methods included from Rex::Ui::Subscriber::Output

#flush, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #print_warning

Methods included from Msf::Session

#alive?, #cleanup, #dead?, #initialize, #inspect, #interactive?, #kill, #log_file_name, #log_from_local, #log_from_remote, #log_source, #name, #name=, #register?, #session_host, #session_host=, #session_port, #session_port=, #set_from_exploit, #set_via, #tunnel_local, #tunnel_peer, #tunnel_to_s, #via_exploit, #via_payload

Class Method Details

.typeObject

Returns the type of session.


29
30
31
# File 'lib/msf/core/session/netware_console.rb', line 29

def self.type
  "shell"
end

Instance Method Details

#_stream_read_remote_write_local(stream) ⇒ Object


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/msf/core/session/netware_console.rb', line 75

def _stream_read_remote_write_local(stream)
  buf = stream.get
  bsize = 25 * 80 +8

  while buf.length > 0
    data = buf[0, bsize]

    user_output.print("\e[24A")

    for i in 0..24
      user_output.print(data[8+i*80, 80] + "\n")
    end

    col = data[4, 2].unpack('v')[0]
    line = 25-data[6, 2].unpack('v')[0]
    user_output.print("\e[#{line}A")
    user_output.print("\e[#{col}C")

    if (buf.length == bsize)
      buf = ''
    else
      buf = buf[bsize, buf.length]
    end
  end
end

#descObject

Returns the session description.


36
37
38
# File 'lib/msf/core/session/netware_console.rb', line 36

def desc
  "NetWare Console"
end

#shell_closeObject

Closes the shell.


71
72
73
# File 'lib/msf/core/session/netware_console.rb', line 71

def shell_close()
  rstream.close
end

#shell_initObject

The shell will have been initialized by default.


50
51
52
# File 'lib/msf/core/session/netware_console.rb', line 50

def shell_init
  return true
end

#shell_read(length = nil) ⇒ Object

Read from the command shell.


57
58
59
# File 'lib/msf/core/session/netware_console.rb', line 57

def shell_read(length = nil)
  return rstream.read(length)
end

#shell_write(buf) ⇒ Object

Writes to the command shell.


64
65
66
# File 'lib/msf/core/session/netware_console.rb', line 64

def shell_write(buf)
  rstream.write(buf)
end

#typeObject

Calls the class method.


43
44
45
# File 'lib/msf/core/session/netware_console.rb', line 43

def type
  self.class.type
end