#!/usr/bin/perl -T # Francesco `ascii` Ongaro - ascii@ush.it - www.ush.it use strict; use Socket; my $reply = "nouser"; my $customident = 0; # We need a request my $in = ''; ret(0, 0, "ERROR : NO-USER") unless sysread STDIN, $in, 128; # The request must be valid my($local, $remote) = $in =~ /^\s*(\d+)\s*,\s*(\d+)/; ret(0, 0, "ERROR : INVALID-PORT") unless defined $local && defined $remote; # The data must be valid $remote = 0 if $remote !~ /^([ \d])+$/; $local = 0 if $local !~ /^([ \d])+$/; if($remote<1 || $remote>65535 || $local<1 || $local>65535) { response($local, $remote, "ERROR : INVALID-PORT"); } # Then we completely fuck the response my $user = encode_ip('1.2.3.4'); response($local, $remote, "USERID : UNIX : $user"); sub response { my($l, $r, $t) = @_; print "$l , $r : $t\r\n"; exit; } sub encode_ip { my $ip = $_[0]; return join('', map(sprintf("%0.2x", $_), split(/\./, $ip))); }