Hi Monks, i hope you are all right!
This is my first question so please pardon me if it is
execess newbie.
I`m trying to code a client/server remote administrator with
some functions like port knocking and etc.. but
one special situation i have a problem.
I make server connect to my client to avoid firewall configurations and it connects right but when i try to
do my commands only the first one is executed, take a look:
-----
# ./client.pl
Connection estabilished from:
Source IP-> 127.0.0.1
Source port-> 32894
command> uname
Linux
-----
And then it is freeze. I know that server is ok becouse
when i use netcat as client everythings goes nice, here is a piece of client`s code:
sub listen() {
$local = IO::Socket::INET->new(Listen=>1,
Proto=>'tcp',
LocalAddr=>'eth0',
LocalPort=>5000,
ReuseAddr=>1,) or die "$!";
$local->autoflush(1);
$addr_handle = $local->accept();
$remotehost = $addr_handle->peerhost ;
$remoteport = $addr_handle->peerport ;
print "Connection estabilished from:\nSource IP-> $remotehost\nSource
+port-> $remoteport\n";
print "command> ";
while(defined ($comm = <STDIN>)) {
print $addr_handle $comm;
while(<$addr_handle>) {
print STDOUT $_
}
print "command> ";
}
}
Any help would be nice.
Happy new year!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.