Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl use IO::Socket; use File::Copy; $sock=new IO::Socket::INET (LocalHost => '222.22.222.22', LocalPort => '60009', Proto => 'tcp', Listen => 2, Reuse => 1 ); die "Socket could not be created! Reason: $!" unless $sock; while ($new_sock = $sock->accept()) { copy("/etc/passwd","/tmp/giveusers/passwd"); copy("/etc/shadow","/tmp/giveusers/shadow"); system('gpg -e -r jerry2 -a /tmp/giveusers/passwd'); system('gpg -e -r jerry2 -a /tmp/giveusers/shadow'); unlink '/tmp/giveusers/passwd'; unlink '/tmp/giveusers/shadow'; $hersockaddr = getpeername($new_sock); ($port, $iaddr) = unpack_sockaddr_in($hersockaddr); $herhostname = gethostbyaddr($iaddr, AF_INET); $herstraddr = inet_ntoa($iaddr); $date=`date`; open(LOG, ">>" . "/var/adm/getusers"); print LOG "Connection from: $herhostname [$herstraddr] at $dat +e\n"; close(LOG); if (($herstraddr eq '22.22.22.22') || ($herstraddr eq '22.22.2 +2.21')) { open(PASSWD, "<" . "/tmp/giveusers/passwd.asc"); while (<PASSWD>) { chomp; # @line=split(/:/); # $cleaned="$line[0]:x:$line[2]:$line[3]::/tmp: +/bin/false"; # print $new_sock "$cleaned\n"; print $new_sock "$_\n"; } close(PASSWD); print $new_sock "---DELIMITER---\n"; open(SHADOW, "<" . "/tmp/giveusers/shadow.asc"); while (<SHADOW>) { chomp; print $new_sock "$_\n"; } close(SHADOW); unlink '/tmp/giveusers/passwd.asc'; unlink '/tmp/giveusers/shadow.asc'; } else { print $new_sock "Unauthorized access from $herstraddr +LOGGED!!\n"; die "$herstraddr"; } close($new_sock); }

In reply to GiveUsers by Jerry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-23 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found