You should probably be castrated for that most incredibly obtuse
excuse for help.. You want to get a NEWBIE performing lan sniffing and performing TCP packet decoding as a first attempt
at TCP interprocess comms? That's pure nastiness!
Heh, well, it's not a beginners subject. Besides, I produced the cleanest code - using modules - which a dedicated beginner should understand. In my own defense:
If a programmer programs in FORTRAN 20 years - they need a break; so providing them with Perl (any Perl) is a godsend IYWMO;
:-D
Now I suggest looking up RPC::pServer and RPC::pClient for settings up a simple, secure effective way of achieving what you want. They even come with a working example client and server.
Hmmm, what were you saying about nasty? :) Here, allow me to make it worse - a fingerd inetd (sic) demon replacement:
#!/usr/bin/perl -w
# in.fingerd # Detects, stops, and reports finger requests & attacks... # Modified from tchrist's code.
use strict; use diagnostics; use Sys::Syslog;
# read Code - set Variables
print "
This server is not allowing finger requests. If you are having trouble, or need to look up a user on this server, please contact either [EMAIL PROTECTED] or [EMAIL PROTECTED]
Thank you for your understanding in this matter,
Systems Administrator/Webmaster http://www/cgi/mail?yourid
";
print "This notice was served (and logged) at ", scalar localtime, " local time.\n\n";
# Set the userID, if known... my $usrID = `/usr/bin/whoami`; my $target = @ARGV ? $ARGV[0] : 'unknown';
my $mailAdmin = '[EMAIL PROTECTED]'; my $mailProject = '[EMAIL PROTECTED]'; my $SENDMAIL = '/usr/lib/sendmail';
$| = 1;
open (MAIL, "| $SENDMAIL $mailAdmin") || die ("$0: Fatal Error! Cannot open sendmail: $!\n");
print MAIL "Reply-to: $mailProject\n"; print MAIL "From: 'in.fingerd.Tracking.Server'\n"; print MAIL "To: 'CompanyName.Server.SysAdmin'\n"; print MAIL "Subject: 'fingerd' service request by $usrID\n"; print MAIL "X-Comments: ===== A Message from the $0 Perl app. =====\n"; print MAIL "SECURITY: Access to $0 by (real $< )(effective $> )\n";
print MAIL "\n"; # To hide 'event' under X-Comments, comment out line...
print MAIL "UserID: $usrID tried \'finger $target\' request on \@ ", scalar localtime;
#print MAIL "\n"; #print MAIL "Relevant data:\n\n"; #print MAIL `ps -ef ; who ; w ; /top -SnU$usrID`;
print MAIL "\n";
print MAIL "=================================================================\n";
print MAIL "NOTE: This message was sent through the in.fingerd Perl System, \n";
print MAIL " Msg Monitor v0.05s (Alpha) by -Sneex- :] (WC Jones), JaxPM\n";
print MAIL "=================================================================\n";
print MAIL "\n"; close (MAIL);
# and finally - log what was found... openlog("in.fingerd", "ndelay", "daemon"); syslog("notice", "Local %s tried %s finger request.\n", $usrID, $target); closelog();
exit;
__END__
It's ugly, but it worked well when I needed to protect myself...
-Sx- (aka -Sneex- circa 1990's) [ yes, Rob, I am male; sometimes I answer to the name Bill. ]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>