-
Notifications
You must be signed in to change notification settings - Fork 0
/
aimrelayclient.pl
55 lines (38 loc) · 1.01 KB
/
aimrelayclient.pl
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
#!/usr/local/bin/perl
use IO::Socket;
use Text::CSV;
use Text::CSV::Simple;
use strict;
use vars qw (@chatvars $portnumber $securitycode $parser $j $a $sock $argnum);
$parser = Text::CSV::Simple->new;
@chatvars = $parser->read_file('chat_vars.csv');
for ($j=0; $j<=$#chatvars; $j++) {
if (lc($chatvars[$j][0]) eq "portnumber") {
$portnumber=$chatvars[$j][1];
} elsif (lc($chatvars[$j][0]) eq "securitycode") {
$securitycode=$chatvars[$j][1];
}
}
$a='';
foreach $argnum (0 .. $#ARGV) {
$a=$a.$ARGV[$argnum]." ";
}
$a=trim($a);
my $sock = new IO::Socket::INET (
PeerAddr => 'localhost',
PeerPort => $portnumber,
Proto => 'tcp',
);
die "Could not create socket: $!\n" unless $sock;
print $sock "$a\n";
while (<$sock>) {
print "$_";
}
close($sock);
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}