/usr/bin/vnccapture is in libnet-vnc-perl 0.40-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
use warnings;
use strict;
use Net::VNC;
use Getopt::Long;
use Pod::Usage;
my %opts = (
password => '',
host => 'localhost',
port => 5900,
depth => 24,
type => 'png',
cursor => 0,
outfile => undef,
endian => undef,
verbose => 0,
help => 0,
version => 0,
);
Getopt::Long::Configure('bundling');
GetOptions('P|password=s' => \$opts{password},
'H|host=s' => \$opts{host},
'p|port=s' => \$opts{port},
'd|depth=s' => \$opts{depth},
't|type=s' => \$opts{type},
'C|cursor' => \$opts{cursor},
'o|outfile=s' => \$opts{outfile},
'e|endian' => \$opts{endian},
'v|verbose' => \$opts{verbose},
'h|help' => \$opts{help},
'V|version' => \$opts{version},
) or pod2usage(1);
if ($opts{help}) {
pod2usage(-exitstatus => 0, -verbose => 2);
}
if ($opts{version}) {
print "Net::VNC v$Net::VNC::VERSION\n";
exit 0;
}
my $end = shift || 1;
$end = 1 if ($end =~ /\D/);
my $vnc = Net::VNC->new({hostname => $opts{host},
port => $opts{port},
password => $opts{password},
});
$vnc->server_endian($opts{endian});
$vnc->depth($opts{depth});
$vnc->login();
print "Logged in\n" if ($opts{verbose});
$vnc->hide_cursor(!$opts{cursor});
for my $n (1..$end) {
my $filename
= defined $opts{outfile} ? $opts{outfile}.($end == 1 ? q{} : q{.}.$n)
: sprintf 'snapshot%04d.%s', $n, $opts{type};
$vnc->capture()->save($filename);
print "Wrote $filename\n" if ($opts{verbose});
}
__END__
=head1 NAME
vnccapture - Capture a screenshot via VNC
=head1 SYNOPSIS
vnccapture [options] [numcaptures]
Options:
-P --password=str password for the VNC server, if applicable
-H --host=str address of VNC server (default: 'localhost')
-p --port=num TCP port for VNC server (default: 5900)
-d --depth=8|16|24 screen depth for capture (default: 24)
-t --type=ext image type for output (default: 'png')
-C --cursor include the mouse cursor in the image
-o --outfile capture to the specified path
otherwise capture to "snapshot<num>.<type>"
-v --verbose print status and diagnostics to STDOUT
-h --help verbose help message
-V --version print the Net::VNC version
=head1 DESCRIPTION
Connect to a VNC server and capture the screen one or more times. The
output is written to, for example, C<snapshot0001.png>. The number is
the sequence of captures and the extension is specified by the
C<--type> argument.
The C<--type> argument can be any format that L<Image::Imlib2> can
support.
=head1 SEE ALSO
L<Net::VNC>
L<Image::Imlib2>
=head1 AUTHOR
Chris Dolan, I<cdolan@cpan.org>
=cut
|