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
| #!usr/bin/perl
########################
# Server of chat by killua 1.0 #
#######################
use IO::Socket::INET;
if(@ARGV < 2)
{
usage();
}
$port= @ARGV[0];
$pseudo= @ARGV[1];
sub usage {
print q(
###############################
# Server #
###############################
);
}
my $sock = new IO::Socket::INET->new(
LocalPort=>$port,
Proto=>'tcp'
) or die("[+]Ecoute impossible...\n");
print"[+]Ecoute du port $port en cours...\n";
while(1) {
$sock->recv($rep,128);
if(my $rep ne ''){
print $sock->peerhost, "Msg:", $rep,"\n";
}
print"killua:";$msg=<STDIN>;
chomp $msg;
if($msg ne '')
{
if($sock->send($msg)){
}
}
} |
Partager