generate client-side shell script
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Feb 2010 19:38:31 +0000 (20:38 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 17 Feb 2010 19:38:31 +0000 (20:38 +0100)
server.pl

index bf8e56d..b158748 100755 (executable)
--- a/server.pl
+++ b/server.pl
@@ -1,5 +1,8 @@
 #!/usr/bin/perl
 
+# install on client with:
+# echo install | nc 10.60.0.92 9001 > bak ; chmod 755 bak
+
 use warnings;
 use strict;
 use autodie;
@@ -22,6 +25,11 @@ while (my $client = $server->accept()) {
        my ($command,$path,$message) = split(/\s+/,<$client>,3);
        my $ip = $client->peerhost;
 
+       if ( $command eq 'install' ) {
+               print $client '#!/bin/sh',$/,'echo $* | nc 10.60.0.92 9001',$/;
+               next;
+       }
+
        warn "$ip [$command] $path | $message\n";
 
        if ( ! -d $ip ) {