/usr/bin/ocs-socket is in clonezilla 3.5.2-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 | #!/usr/bin/perl
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# Description: Send s message to other machine via socket.
# Ref:http://www.perlfect.com/articles/sockets.shtml
use IO::Socket;
$usage="Usage: $0 [-h|--host HOSTNAME] [-p|--port PORT_NO] [-m|--message MSG]";
die "$usage\n" if $#ARGV<0;
while ( $_ = shift ) {
if (/-p|--port/) {
$port = shift;
}elsif(/-h|--host/) {
$host = shift;
}elsif(/-m|--message/) {
$message = shift;
}else{
print $usage;
}
}
die "$usage\n" if ! $host;
die "$usage\n" if ! $port;
die "$usage\n" if ! $message;
my $socket = new IO::Socket::INET (
PeerAddr => "$host",
PeerPort => "$port",
Proto => 'tcp',
);
die "Could not create socket to $host:$port!\n" unless $socket;
print $socket "$message\n";
close($socket);
|