Sha256: 9b0af2265a368282b556d4107a3775d59008db4bcbbfecb18784b92e4ef6d637

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

#!/usr/bin/env ruby
# -*- coding: binary -*-

module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module Webcam

###
#
# This meterpreter extension can list and capture from webcams and/or microphone
#
###
class Webcam

	def initialize(client)
		@client = client
	end

	def webcam_list
		response = client.send_request(Packet.create_request('webcam_list'))
		names = []
		response.get_tlvs( TLV_TYPE_WEBCAM_NAME ).each{ |tlv|
			names << tlv.value
		}
		names
	end

	# Starts recording video from video source of index #{cam}
	def webcam_start(cam)
		request = Packet.create_request('webcam_start')
		request.add_tlv(TLV_TYPE_WEBCAM_INTERFACE_ID, cam)
		client.send_request(request)
		true
	end

	def webcam_get_frame(quality)
		request = Packet.create_request('webcam_get_frame')
		request.add_tlv(TLV_TYPE_WEBCAM_QUALITY, quality)
		response = client.send_request(request)
		response.get_tlv( TLV_TYPE_WEBCAM_IMAGE ).value
	end

	def webcam_stop
		client.send_request( Packet.create_request( 'webcam_stop' )  )
		true
	end

	# Record from default audio source for #{duration} seconds;
	# returns a low-quality wav file
	def record_mic(duration)
		request = Packet.create_request('webcam_audio_record')
		request.add_tlv(TLV_TYPE_AUDIO_DURATION, duration)
		response = client.send_request(request)
		response.get_tlv( TLV_TYPE_AUDIO_DATA ).value
	end

	attr_accessor :client

end

end; end; end; end; end; end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb
librex-0.0.66 lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb