2010-11-14 03:37:45 +00:00
|
|
|
#!/usr/bin/env ruby
|
2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2011-05-06 18:41:38 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', '..'))
|
|
|
|
|
2010-11-14 03:37:45 +00:00
|
|
|
##
|
|
|
|
# $Id: $
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
#
|
|
|
|
# RFB protocol support
|
|
|
|
#
|
|
|
|
# by Joshua J. Drake <jduck>
|
|
|
|
#
|
|
|
|
# Based on:
|
|
|
|
# vnc_auth_none contributed by Matteo Cantoni <goony[at]nothink.org>
|
|
|
|
# vnc_auth_login contributed by carstein <carstein.sec[at]gmail.com>
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'rex/socket'
|
|
|
|
require 'rex/proto/rfb'
|
|
|
|
|
|
|
|
sd = Rex::Socket::Tcp.create('PeerHost' => ENV["VNCHOST"], 'PeerPort' => Rex::Proto::RFB::DefaultPort)
|
|
|
|
|
|
|
|
v = Rex::Proto::RFB::Client.new(sd)
|
|
|
|
if not v.connect('password')
|
|
|
|
$stderr.puts v.error
|
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
loop {
|
|
|
|
sret = select([sd],nil,nil,10)
|
|
|
|
puts sret.inspect
|
|
|
|
if sret and sret[0].include? sd
|
|
|
|
buf = sd.sysread(8192)
|
|
|
|
puts "read #{buf.length} bytes: #{buf.inspect}"
|
|
|
|
end
|
|
|
|
}
|