Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5975ecc
Showing
10 changed files
with
1,392 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!perl | ||
use Module::Build; | ||
use strict; | ||
use warnings; | ||
|
||
my $build = Module::Build->new( | ||
create_makefile_pl => 'traditional', | ||
license => 'perl', | ||
module_name => 'Net::VNC', | ||
requires => { | ||
'Class::Accessor::Fast' => '0', | ||
'Crypt::DES' => '0', | ||
'Image::Imlib2' => '0', | ||
'Test::More' => '0', | ||
}, | ||
script_files => { 'bin/vnccapture' }, | ||
); | ||
$build->create_build_script; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Revision history for Perl module Net::VNC: | ||
|
||
0.36 Fri Jun 29 19:58:51 BST 2007 | ||
- make vnccapture's outfile option work (patch by Owen Crow) | ||
|
||
0.35 Fri Jul 28 11:41:23 BST 2006 | ||
- fix typo-d 'has_alpha' which breaks with recent Image::Imlib2 | ||
|
||
0.34 Thu Jul 27 12:12:57 BST 2006 | ||
- fixed failing cursor bug with realvnc 3.3 | ||
|
||
0.33 Sun Jun 25 16:13:33 BST 2006 | ||
- fixed a few cross-endian bugs (thanks to Chris Dolan again!) | ||
|
||
0.32 Tue Apr 25 20:03:09 BST 2006 | ||
- many patches from Chris Dolan: | ||
- Added optional support for the mouse cursor | ||
- Support for CoRRE encoding | ||
- performance enhancement: split out the 8/16/24 bit support into | ||
their own modes | ||
- rearchitected the encoding system: list all known, but flag them | ||
as supported or not | ||
- ... this will simplify the addition of new encodings | ||
- ... this allows enabling/disabling classes of encodings (like cursor) | ||
- bugfix for signedness of encoding type | ||
- added skeletal support for the remaining server messages: cut-text and bell | ||
|
||
0.31 Mon Mar 13 20:05:27 GMT 2006 | ||
- 24-bit truecolour support | ||
- non-authenticated login | ||
- incremental update | ||
- all provided by Chris Dolan | ||
|
||
0.30 Mon Jan 23 10:12:05 GMT 2006 | ||
- die with a more accurate reason if there was an error | ||
connecting | ||
- drop the connection timeout to 15 seconds | ||
- reordered documentation to try and confuse Leo less | ||
|
||
0.29 Thu Jan 19 15:56:05 GMT 2006 | ||
- first release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bin/vnccapture | ||
Build.PL | ||
CHANGES | ||
lib/Net/VNC.pm | ||
Makefile.PL | ||
MANIFEST This list of files | ||
META.yml | ||
README | ||
t/pod.t | ||
t/pod_coverage.t | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- #YAML:1.0 | ||
name: Net-VNC | ||
version: 0.36 | ||
abstract: ~ | ||
license: ~ | ||
generated_by: ExtUtils::MakeMaker version 6.32 | ||
distribution_type: module | ||
requires: | ||
Class::Accessor::Fast: 0 | ||
Crypt::DES: 0 | ||
Image::Imlib2: 0 | ||
Test::More: 0 | ||
meta-spec: | ||
url: http://module-build.sourceforge.net/META-spec-v1.2.html | ||
version: 1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Note: this file was auto-generated by Module::Build::Compat version 0.03 | ||
use ExtUtils::MakeMaker; | ||
WriteMakefile | ||
( | ||
'NAME' => 'Net::VNC', | ||
'VERSION_FROM' => 'lib/Net/VNC.pm', | ||
'PREREQ_PM' => { | ||
'Class::Accessor::Fast' => '0', | ||
'Crypt::DES' => '0', | ||
'Image::Imlib2' => '0', | ||
'Test::More' => '0' | ||
}, | ||
'INSTALLDIRS' => 'site', | ||
'EXE_FILES' => [ | ||
'bin/vnccapture' | ||
], | ||
'PL_FILES' => {} | ||
) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
NAME | ||
Net::VNC - A simple VNC client | ||
|
||
SYNOPSIS | ||
use Net::VNC; | ||
|
||
my $vnc = Net::VNC->new({hostname => $hostname, password => $password}); | ||
$vnc->login; | ||
|
||
print $vnc->name . ": " . $vnc->width . ' x ' . $vnc->height . "\n"; | ||
|
||
my $image = $vnc->capture; | ||
$image->save("out.png"); | ||
|
||
DESCRIPTION | ||
Virtual Network Computing (VNC) is a desktop sharing system which uses | ||
the RFB (Remote FrameBuffer) protocol to remotely control another | ||
computer. This module acts as a VNC client and communicates to a VNC | ||
server using the RFB protocol, allowing you to capture the screen of the | ||
remote computer. | ||
|
||
This module dies upon connection errors (with a timeout of 15 seconds) | ||
and protocol errors. | ||
|
||
METHODS | ||
new | ||
The constructor. Given a hostname and a password returns a Net::VNC | ||
object: | ||
|
||
my $vnc = Net::VNC->new({hostname => $hostname, password => $password}); | ||
|
||
login | ||
Logs into the remote computer: | ||
|
||
$vnc->login; | ||
|
||
name | ||
Returns the name of the remote computer: | ||
|
||
print $vnc->name . ": " . $vnc->width . ' x ' . $vnc->height . "\n"; | ||
|
||
width | ||
Returns the width of the remote screen: | ||
|
||
print $vnc->name . ": " . $vnc->width . ' x ' . $vnc->height . "\n"; | ||
|
||
height | ||
Returns the height of the remote screen: | ||
|
||
print $vnc->name . ": " . $vnc->width . ' x ' . $vnc->height . "\n"; | ||
|
||
capture | ||
Captures the screen of the remote computer, returning an Image::Imlib2 | ||
object: | ||
|
||
my $image = $vnc->capture; | ||
$image->save("out.png"); | ||
|
||
AUTHOR | ||
Leon Brocard acme@astray.com | ||
|
||
Many thanks for Foxtons Ltd for giving me the opportunity to write this | ||
module. | ||
|
||
COPYRIGHT | ||
Copyright (C) 2006, Leon Brocard | ||
|
||
This module is free software; you can redistribute it or modify it under | ||
the same terms as Perl itself. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/perl -w | ||
|
||
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 => '', | ||
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 |
Oops, something went wrong.