#!/usr/bin/perl # identd 1.0 # comments: amir@virusexperts.com $SIG{'ALRM'} = sub { exit }; alarm(10); $| = 1; while() { chomp; my $line = $_; $line =~ s/\s//g; my($port1,$port2) = split(/,/,$line); open(PROC_TCP,") { my($laddr,$lport,$raddr,$rport,$uid) = $proc_tcp =~ /^\s*\S+\: (\S+)\:(\S+)\s+(\S+)\:(\S+)\s+\S+\s+\S+\:\S+\s+\S+\:\S+\s+\S+\s+(\S+)/; $lport = hex($lport); $rport = hex($rport); if($port1 == $lport && $port2 == $rport) { ($unam) = getpwuid($uid); } } if($unam) { print "$port1 , $port2 : USERID : UNIX : $unam\n"; } else { print "$port1 , $port2 : ERROR : UNKNOWN-ERROR\n"; } close(PROC_TCP); exit; }