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
#################################
#!/usr/bin/perl -w
use strict; # declare the info before use
#################################
# packages
################################
use IO::Socket::SSL; # TCP/IP sockets
##################
# parameter declaration
##################
my $host = '192.168.1.15';
my $port = 12431; # selected-Port
my $uname = "foobar";
my $pw = "foobarPW";
my $protoVer = "31"; # Protocol Version
my $sock = IO::Socket::SSL->new("$host:$port");
#########################
# main procedures
# output
##########################
##################################
# commands
system("clear"); # refresh the console
###############################
print "Sandbox Environment\n";
$sock->print(qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0});
print "XML transfer"
close($sock); # Finish the connection
print "Finished the Line\n";
1 2 3 4 5 6 7 8 9
print "Sandbox Environment\n"; $sock->print(qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0}); print "XML transfer done\n"; print <$sock>; print "Answer from server\n"; close($sock); # Finish the connection print "Finished the Line\n";
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
################################# #!/usr/bin/perl -w use strict; # declare the info before use ################################# # packages ################################ use IO::Socket::SSL; # TCP/IP sockets ################## # parameter declaration ################## my $host = '192.168.1.15'; my $port = 12431; # selected-Port my $uname = "foobar"; my $pw = "foobarPW"; my $protoVer = "31"; # Protocol Version my $sock = IO::Socket::SSL->new("$host:$port"); ######################### # main procedures # output ########################## ################################## # commands system("clear"); # refresh the console ############################### print "Sandbox Environment\n"; $sock->print(qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0}); print "XML transfer\n"; print "Finished the Line\n"; print <$sock>; # read answer (=response) from server print "Answer from server\n"; close($sock); # Finish the connection print "Closed connection\n";
1
2
3
if (scalar @response) { # response array filled?
print "$_\n" for @response; # show response
}
$sock->print(qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0});
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
sub Send_Receive_SSL { my $host = shift; my $port = shift; my $message = shift; my $sock = IO::Socket::SSL->new("$host:$port"); $sock->print($message); my @response = <$sock>; close $sock; return @response; } print "Sandbox Environment\n"; my @antworten = Send_Receive_SSL($host, $port, qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0} );
1 2 3 4 5 6 7 8 9 10 11 12
$sock->print(qq{ <Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>}); $sock->print(qq{<GetSystemName/>}); # terminate string? $sock->print(qq{\0}); print "ANSWER:" print <$sock>; close($sock);
$sock->send(qq{<Open seq="150" protocolVersion=$protoVer username="$uname" password="$pw"/>\0});
sub send { croak("Use of send() not implemented in IO::Socket::SSL; use print/printf/syswrite instead") }