Class: Rex::Post::Meterpreter::Ui::Console::CommandDispatcher::Espia

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

Overview

Espia - Capture audio, video, screenshots from the remote system

Constant Summary collapse

Klass =
Console::CommandDispatcher::Espia

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, #log_error, #msf_loaded?, set_hash, #unknown_command

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, included, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #tab_complete_directory, #tab_complete_filenames, #tab_complete_generic, #tab_complete_source_address, #unknown_command, #update_prompt

Constructor Details

#initialize(shell) ⇒ Espia

Initializes an instance of the espia command interaction.



23
24
25
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 23

def initialize(shell)
  super
end

Instance Method Details

#cmd_dev_audio(*args) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 43

def cmd_dev_audio(*args)
  maxrec = 60

  if (args.length < 1)
    print_line("Usage: dev_audio <rec_secs>\n")
    print_line("Record mic audio\n")
    return true
  end

  secs = args[0].to_i
  if secs  > 0 and secs <= maxrec
    milsecs = secs*1000
    print_line("[*] Recording #{milsecs} miliseconds.\n")
    client.espia.espia_audio_get_dev_audio(milsecs)
    print_line("[*] Done.")
  else
    print_line("[-] Error: Recording time 0 to 60 secs \n")
  end

  return true
end

#cmd_dev_imageObject



36
37
38
39
40
41
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 36

def cmd_dev_image()
  client.espia.espia_video_get_dev_image()
  print_line("[*] Done.")

  return true
end

#cmd_screengrab(*args) ⇒ Object

Grab a screenshot of the current interactive desktop.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 68

def cmd_screengrab( *args )
  if( args[0] and args[0] == "-h" )
    print_line("Usage: screengrab <path.jpeg> [view in browser: true|false]\n")
    print_line("Grab a screenshot of the current interactive desktop.\n")
    return true
  end

  show = true
  show = false if (args[1] and args[1] =~ /^(f|n|0)/i)

  path = args[0] || Rex::Text.rand_text_alpha(8) + ".jpeg"

  data = client.espia.espia_image_get_dev_screen

  if( data )
    ::File.open( path, 'wb' ) do |fd|
      fd.write( data )
    end
    path = ::File.expand_path( path )
    print_line( "Screenshot saved to: #{path}" )
    Rex::Compat.open_file( path ) if show
  end

  return true
end

#commandsObject

List of supported commands.



30
31
32
33
34
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 30

def commands
  {
    "screengrab" => "Attempt to grab screen shot from process's active desktop"
  }
end

#nameObject

Name for this dispatcher



97
98
99
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb', line 97

def name
  "Espia"
end