Friday, February 8, 2013

Screenshot

import -window root -display :0.0 -screen png:- > screenshot.png

The following worked fine for me to download a screenshot via ssh and display it in a loop. Perfect to "spy" out people or give remote support. Needs 'eog' and ssh!

use
xhost +hostname

on the remote host, otherwise the x-server may reject your connection!
#! /usr/bin/perl -w

my $m = shift;

my $filetype= shift || "jpg";

system('eog -w &');
while (1) {
next_pic();
exit unless $m;
}

sub next_pic {
my $temp=`tempfile -s.$filetype`;
`ssh user\@hostname import -window root -display :0.0 -screen $filetype:- > $temp`;
`eog -w $temp > /dev/null 2>&1`;
unlink $temp;
}

 

No comments:

Post a Comment