Wednesday, May 12, 2010

I check my online buddy with this tool

Begitu banyak tool berbasis web yang menyediakan layanan lookup terhadap id yahoo, menurut saya semua sama dan cenderung kurang praktis. Ya memang kurang praktis (menurut saya), karena harus membuka browser, menunggu loading, memasukkan id dan menunggu loading lagi. Panjang kan? masukkin idnya juga satu-satu... hemm...
Langsung timbul deh pertanyaan, "bagaimana supaya tidak perlu ngetik id satu-satu dan langsung mendapat hasil list id buddy yang online". Ya! jawabannya membuat aplikasi sendiri, dan alhasil aplikasi berikut (aplikasi ini telah saya share pada beberapa komunitas online) :
#!/usr/bin/perl
# Online Buddy Lookup by zam
# 11 Mei 2010
use IO::Socket;
use threads;
use threads::shared;

my $dtch:shared;

@bud_list = qw(
this
is
my
buddy
list);#skipped for security reason... :P

print "===========================\n";
print "Online Buddy Lookup by zam\n";
print "===========================\n";
print "List Online Buddy:\n";
while (scalar(@bud_list) > 0){
 threads->create(req, shift(@bud_list));
 @jumthread = threads->list();
 if (scalar(@jumthread > 54)){
  foreach my $thrx (threads->list()){
   $thrx->join();
  }
 }
}
sleep(15);
foreach my $thrsisa (threads->list()){
 lock($dtch);
 $thrsisa->detach() if ! $thrsisa->is_detached();
 $thrsisa->kill('KILL');
}
print "\n+++++++++++++++\nAll Done!\n+++++++++++++++\n";

sub req(){
 my $who = $_[0];
 my $socket = IO::Socket::INET->new(Proto=>"tcp",
  PeerAddr=>"opi.yahoo.com",
  PeerPort=>"80") or die "Connection Failed.";
  print $socket "GET /online?u=$who HTTP/1.1\r\n";
  print $socket "User-Agent: Mozilla 5.0\r\n";
  print $socket "Host: opi.yahoo.com\r\n";
  print $socket "Connection: close\r\n\r\n";
  while ($Data = <$socket>){
   if ($Data =~ /8c/){
    print "[+] $who\n";
   }
  }
  close($socket);
}

yeah...online buddy lookup zam version... =D

No comments:

Post a Comment