[Perl] ICQ Real Status Checker by [biophreak] - Скрипт проверки статуса icq номера.
Написан на perl
Автор: biophreak
IRSC v2.5 - ICQ Real Status Checker by biophreak
Скачать:
Написан на perl
Автор: biophreak
IRSC v2.5 - ICQ Real Status Checker by biophreak
Скачать:
Code:
#!usr/bin/perl
# IRSC v2.5 - ICQ Real Status Checker by biophreak
use warnings 'all';
use strict;
use diagnostics;
use Socket;
use constant UINLIST => 'uins.txt';
my %Status = ('00' => 'Online', '01' => 'Away', '02' => 'Dnd', '03' => 'Dnd', '04' => 'N/A', '05' => 'N/A', '10' => 'Occupied', '11' => 'Occupied', '13' => 'Dnd', '20' => 'Free4Chat', 'd8' => 'Unknown');
(open U, UINLIST and my @uins = <U> and close U) or die "Cannot open file ".UINLIST.": $!\n";
my $check_uin;
my $seq_num = rand(65535);
exit print "Specify valid ICQ UIN.\nIt must be numeric only and 5-9 of length\n" unless ($check_uin = shift and $check_uin =~ /^(\d{5,9})$/o);
my($uin, $pass) = $uins[rand $#uins] =~ /^(\d{5,9});(\S{4,8})$/o or (undef, undef);
icq_check($uin, $pass) if defined $uin and defined $pass;
sub icq_check
{
my($uin, $password) = @_;
my($answer_data,$status);
socket(SOCK, AF_INET, SOCK_STREAM, 6) or die "Cannot open socket: $!\n";
connect(SOCK, sockaddr_in(5190, inet_aton('205.188.153.98'))) or die "Cannot connect: $!\n";
select((select(SOCK), local $| = 1)[0]);
sysread(SOCK,$answer_data,96) or die "Cannot read from socket: $!\n";
print SOCK sendSNAC(1 ,("\x00" x 3)."\x01\x00\x01".pack('n',length $uin).$uin."\x00\x02".pack('n',length $password).substr($password^"\xF3\x26\x81\xC4\x39\x86\xDB\x92",0,length $password), seqNum()) and sysread(SOCK,$answer_data,384) or die "Cannot read from socket: $!\n";
if ($answer_data =~ /mis/io) {
close SOCK and exit print "Password for $uin is wrong\n";
} elsif(my($BOSS_address, $BOSS_port,$cookies) = $answer_data =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})\x00\x06\x01\x00(.{256})/so) {
#$cookies = get_cookies($answer_data);
socket(SOCK,AF_INET,SOCK_STREAM,6) or die "Cannot open socket: $!\n";
connect(SOCK,sockaddr_in($BOSS_port,inet_aton($BOSS_address))) or die "Cannot connect to BOSS server: $!\n";
select((select(SOCK), local $| = 1)[0]);
sysread(SOCK,$answer_data,256);
print SOCK sendSNAC(1 ,("\x00" x 3)."\x01\x00\x06".pack('n',256).$cookies, seqNum()) and sysread(SOCK,$answer_data,256);
print SOCK sendSNAC(2, "\x00\x01\x00\x17".("\x00" x 7)."\x01\x00\x03\x00\x02\x00\x01\x00\x03\x00\x01\x00\x15\x00\x01\x00\x04\x00\x01\x00\x06\x00\x01\x00\x09\x00\x01\x00\x0a\x00\x01", seqNum()) and sysread(SOCK,$answer_data,256);
print SOCK sendSNAC(2 ,"\x00\x01\x00\x06".("\x00" x 6), seqNum()) and sysread(SOCK,$answer_data,256);
print SOCK sendSNAC(2 ,"\x00\x01\x00\x08".("\x00" x 7)."\x01\x00\x02\x00\x03\x00\x04\x00\x05", seqNum());
print SOCK sendSNAC(2 ,"\x00\x01\x00\x1e".("\x00" x 7)."\x06\x00\x04\x01".("\x00" x 3), seqNum()) and sysread(SOCK,$answer_data,2048);
print SOCK sendSNAC(2 ,"\x00\x01\x00\x02".("\x00" x 5)."\x02\x00\x01\x00\x03\x01\x10\x02\x8a\x00\x02\x00".("\x01" x 3)."\x02\x8A\x00\x03\x00\x01\x01\x10\x02\x8A\x00\x15\x00\x01\x01\x10\x02\x8A\x00\x04\x00\x01\x01\x10\x02\x8A\x00\x06\x00\x01\x01\x10\x02\x8A\x00\x09\x00\x01\x01\x10\x02\x8A\x00\x0A\x00\x01\x01\x10\x02\x8A", seqNum());
print SOCK sendSNAC(2 ,"\x00\x02\x00\x05".("\x00" x 5)."\x05\x00\x02".pack("c*",length($check_uin)).$check_uin, seqNum()) and sysread(SOCK,$answer_data,2048);
$status = parseSNAC($answer_data);
if($status eq "Offline")
{
my @u = split(//,sprintf("%08x",$uin));
print SOCK sendSNAC(2 ,"\x00\x04\x00\x06".("\x00" x 3)."\x01\x00\x06\x51".("\x00" x 8)."\x04".pack("c*",length($check_uin)).$check_uin."\x00\x05\x00\x09".pack("H*",$u[6].$u[7].$u[4].$u[5].$u[2].$u[3].$u[0].$u[1])."\x0c\x00\x01".("\x00" x 3)."\x06\x00\x00", seqNum()) and sysread(SOCK,$answer_data,2048);
$status = parseSNAC($answer_data);
close SOCK and exit print $check_uin." is ".$status."\n";
}
close SOCK and exit print $check_uin." is ".$status."\n";
} else {
close SOCK and exit print "Too many tries.Try later.\n";
}
close SOCK;
}
#sub get_cookies
#{
# my $cookie = shift;
# for (my $i = 0;;$i++) {return substr($cookie,$i+4,256) if substr($cookie,$i,4) eq "\x00\x06\x01\x00"}
#}
sub parseSNAC
{
my @SNAC = split '',shift;
$_ = unpack("H2",$_) foreach (@SNAC);
return "Offline" if !$SNAC[82] and ($SNAC[7] eq "02" and $SNAC[9] eq "06");
return $Status{$SNAC[83 + (length $check_uin)]} if $SNAC[7] eq "02" and $SNAC[9] eq "06";
return "Invisible" if $SNAC[7] eq "04" and $SNAC[9] eq "01";
return "Offline" if $SNAC[7] eq "04" and $SNAC[9] eq "0c"
}
sub seqNum
{
return 0 if $seq_num > 65535;
return $seq_num++;
}
sub sendSNAC {return "\x2a".pack('h',$_[0]).pack('n', $_[2]).pack('n', length($_[1])).$_[1]}