home *** CD-ROM | disk | FTP | other *** search
- #!perl -w
-
- use Socket;
-
- ($dest, $port) = @ARGV;
- $port = 'finger' unless $port;
-
- ($who,$where) = $dest =~ m/(.*)@(.*)/ if defined $dest;
-
- die "$0: victim\@host [port]\n" unless $where;
-
- $sockaddr = 'S n a4 x8';
-
- ($name, $aliases, $proto) = getprotobyname('tcp');
- ($name, $aliases, $port) = getservbyname($port, 'tcp') unless $port =~ /^\d+$/;
-
- ($name,$aliases,$type,$len,$thataddr) = gethostbyname($where);
-
- undef $type; undef $len; # Keep -w happy
-
- die "Unknown host $where" unless defined $name;
-
- $that = pack($sockaddr, &AF_INET(), $port, $thataddr );
- socket(S, &PF_INET(), &SOCK_STREAM(), $proto) || die "socket: $!";
- # bind(S,$this) || die "$!";
-
- connect(S,$that) || die "$!";
-
- # Set socket to be command buffered.
- select(S); $| = 1; select(STDOUT);
-
- # print "Going for $who\@$where\n";
- print "[$name]\n";
- print S "/w $who\r\n";
-
-
- # If you really want to know what local address we are bound to...
- # $addr = getsockname( S );
- # @addr = unpack( 'xxxx CCCC', $addr );
- # print "we are " . join( '.', @addr ) . "\n";
-
- print while defined( $_ = <S> );
-