Exemplo n.º 1
0
def check(ip):
    hostname = 'Unknown'
    try:
        hostname = socket.gethostbyaddr(ip)[0]
    except:
        pass
    print 'Trying %s (%s) ' % (ip, hostname)
    c = pyvnc.pyvncclient()
    cret = c.connect(ip, 0, '')
    print 'Connect returned %d' % cret
    if(cret == -1):
        return
    print 'CONNECTED to: %s' % c.servername
    print 'State is %d geometry is %dx%d' % (c.state, c.width, c.height)
    # Try to interrupt screensaver
    c.sendmouseevent(10,10,0)
    c.sendkeyevent(pyvnc.Control_L, 1)
    c.sendmouseevent(1,1,0)
    c.sendkeyevent(pyvnc.Control_L, 0)
    time.sleep(1)

    c.checkforupdates(1.0)
    print 'updatedarea =', c.updatedarea()

    im = Image.fromstring('RGBX', (c.width, c.height), c.getbuffer())
    im = im.convert('RGB')
    im.save(ip+'.png')
    print 'IMAGE %s.png saved' % ip
    c.clearupdates

    return
Exemplo n.º 2
0
	def __init__(self, host, display, passwd, parent=None):
		QtCore.QThread.__init__(self, parent)
		self.clientVnc = pyvnc.pyvncclient()
		self.connected = False
		connectionVnc = self.clientVnc.connect(host, display, passwd)
		print "Connect return %d" % connectionVnc
		if connectionVnc == 0:
			self.connected = True
			self.running = True
			print "Connected to: '%s'" % (self.clientVnc.servername)
			print "Fileno is %d" % (self.clientVnc.fileno())
			print "Checkforupdates returned %d" % self.clientVnc.checkforupdates(1.0)
			print "Updatedarea = ", self.clientVnc.updatedarea()
			self.width = self.clientVnc.width
			self.height = self.clientVnc.height
			self.image = QtGui.QImage()
			self.numImage = 0
			self.start(QtCore.QThread.IdlePriority)