PAUTO FXP AUTO TRADER SOURCE CODE LEAK
Next Leak Fir3 Security is just an Illusion
## Pauto Source code. (C) Fuas / Eff3ct
## Do not distrubite this source.
## If change or use parts. please credit me.
use Win32::Console;
use Win32::Registry;
use Time::HiRes qw(gettimeofday tv_interval);
use IO::Socket;
use Config::IniFiles;
use DBI;
use POSIX;
use Win32::GUI;
use Win32::GUI::Loft::Design;
use constant WM_COPYDATA => 74;
use constant WM_CLOSE => 0x00000010;
use LWP;
$STDOUT = new Win32::Console(STD_OUTPUT_HANDLE);
$STDOUT->Cls($FG_GREEN);
use threads;
use threads::shared;
$ircnick=&generate_random_string(6);
$ircnick="tnt$ircnick";
print "USING PATH $0\n";
$mainpath=$0;
@path=split(/\\/,$0);
$file=$path[-1];
$mainpath=~s/$file//i;
chdir $mainpath;
package Foo::Server;
{
use HTTP::Server::Simple::CGI;
our @ISA = qw(HTTP::Server::Simple::CGI HTTP::Server::Simple::Authen);
our $CALLBACK;
sub handle_request { $CALLBACK->(@_) }
use HTTP::Server::Simple::Static;
use HTTP::Server::Simple::Authen;
use Authen::Simple::Passwd;
use Config::INI::Reader;
use Ananke::SqlLink;
sub authen_handler { $PASS->(@_) }
$Foo::Server::PASS = sub {
Authen::Simple::Passwd->new(passwd => './www/passwd');
};
sub show_google {
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
print '<html>';
print '<head>';
print '<title>Googleit MOFO</title>';
print '<meta http-equiv="REFRESH" content="0;url=http://www.google.com"></HEAD>';
print '<BODY>';
print 'JUST FOOKN GOOGLE IT';
print '</BODY>';
print '</HTML>';
}
$Foo::Server::CALLBACK = sub {
$webroot="./www/htdocs";
($server, $cgi) = @_;
$path = $cgi->path_info();
$options = $cgi->query_string;
$user = $server->authenticate or return;
if ( $path eq "/" ) { &show_google; }
$file="$webroot$path";
if ( $file=~m,(\.(JPG|GIF|PNG)),i ) {
return $server->serve_static($cgi,$webroot);
}
if ( $file=~m,skiplists,i ) { &output_web_skiplists; return 0; }
if ( $file=~m,monitor,i ) { &output_web_sent; return 0; }
if ( $file=~m,presearch,i ) { &output_pre_search($options); return 0; }
if ( $file=~m,webform,i ) { &output_web_form($options); return 0; }
if (!(-e $file)) {
print "SORRY WEBPAGE NOT FOUND";
return 0;
}
open(WEBPAGE, $file);@WEBPAGE=<WEBPAGE>;close(WEBPAGE);
foreach $line (@WEBPAGE) {
print $line;
}
};
sub web_header {
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"';
print'"http://www.w3.org/TR/html4/strict.dtd">';
print '<html>';
print '<head>';
print '<title>PAUTO V2.90 FINAL STATS</title>';
print '<style>body{font-size: 55.5%; font-family: Arial, Helvetica, sans-serif; height: 100%; margin: 0 auto; text-align: center;}</style>';
print '<A HREF="monitor">MONITOR</A> <A HREF="presearch">PREBOT SEARCH</A> <A HREF="skiplists">SKIPLISTS</A>' ;
print '</head>';
}
sub output_pre_search {
&web_header;
print '<body>';
$file=$_[0];
$file=~s,searchname\=,,;
if (!($file)) { $file="%"; }
print "<p>searched for $file<\p>";
print '<h2 align="center";>PAUTO V2.90 FINAL PREBOT SEARCH</h2>';
print '<form name="input" action="presearch" method="get">';
print 'Search for? ';
print '<input type="text" name="searchname" value="" size="20">';
print '<br>';
print '<input type="submit" value="Submit">';
print '</form>';
print '<div style="position:absolute; border: solid; border-width: thin; width: 50%;';
print 'align: centre;';
print 'left:350px;';
print 'top:180px;';
print 'width:620px;';
print 'height:270px;';
print 'background-color:#ffffff;';
print 'overflow:auto;">';
print '<h2 align="center";>PRE BOT INFO</h2>';
print '<TABLE border="1" style="border: 1px #555 solid; border-collapse: collapse;"; align="center";>';
print '<tr>';
print '<th>TIME</th>';
print '<th>SECTION</th>';
print '<th>RLSNAME</th>';
print '</tr>';
if ( $useexternal_prebot != 1 ) {
$dbase2="prebot.db";
$prebase2 = DBI->connect("dbi:SQLite:dbname=$dbase2","","") || &pberror;
$sth2 = $prebase2->prepare ("create table IF NOT EXISTS prebots(time varchr(20),name varchr(100),section varchr(30),bot varchr(20),chan)");
$sth2->execute();
$prebotqry = $prebase2->prepare("SELECT time,name,section,bot FROM prebots WHERE name like ? ORDER BY time DESC LIMIT 50");
while ( @row = $prebotqry->fetchrow_array ) {
($tme, $name, $section, $chan)=@row;
$readable_time = localtime($tme);
($day, $mon, $date, $ctime, $year)=split(" ",$readable_time);
($hour,$min)=split(":",$ctime);
$ctime="$hour:$min";
$showtime="$date $mon $ctime";
print "<TR><TD>$showtime<TD>$section<TD>$name";
}
} else {
if ( !($mysql)) {
$mysql = new Ananke::SqlLink({
'type' => 'mysql',
'db' => 'preinfo',
'host' => 'localhost',
'port' => '7000',
'username' => 'root',
'passwd' => 'ninja1',
});
}
$chk_rls = "%$file%";
$q = "SELECT * FROM prebots where name like \"%$chk_rls%\"";
@r = $mysql->return($q,'array');
foreach $i (@r) {
@row=();
$tme=${$i}[0];
$name=${$i}[1];
$section=${$i}[2];
$chan=${$i}[3];
$readable_time = localtime($tme);
($day, $mon, $date, $ctime, $year)=split(" ",$readable_time);
($hour,$min)=split(":",$ctime);
$ctime="$hour:$min";
$showtime="$date $mon $ctime";
print "<TR><TD>$showtime<TD>$section<TD>$name";
}
}
print '</TABLE>';
print '</div>';
print '</body> ';
}
sub output_web_sent {
$dbase="sent.db";
$raceinfo = DBI->connect("dbi:SQLite:dbname=$dbase","","");
$qry = $raceinfo->prepare("SELECT * FROM sentchains WHERE sendrls like ? ORDER BY time DESC LIMIT 50");
&web_header;
print '<meta http-equiv="refresh" content="30">';
print '<h2 align="center";>PAUTO V2.90 FINAL WEBSTATS PAGE</h2>';
print '<div style="position:absolute; border: solid; border-width: thin; width: 50%;';
print 'text-align: left;';
print 'left:500px;';
print 'top:70px;';
print 'width:620px;';
print 'height:240px;';
print 'background-color:#ffffff;';
print 'overflow:auto;">';
print '<h2 align="center";>LAST SENT CHAINS INFO</h2>';
print '<TABLE border="1" style="border: 1px #555 solid; border-collapse: collapse;"; align="center";>';
print '<tr>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">RLSNAME</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">SECTION</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">CHAINS</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">CHAIN NAME</th>';
print '</tr>';
$chk_rls = "%";
$qry->execute( $chk_rls );
while ( @row = $qry->fetchrow_array ) {
($rlstime,$rlsname,$sec,$chain,$name)=@row;
print "<tr><td>>$rlsname</td><td> $sec </td><td>$chain</td><td> $name </td></tr>";
}
print '</TABLE>';
print '</div>';
print '<div style="position:absolute; border: solid; border-width: thin; width: 50%;';
print 'text-align: left;';
print 'left:20px;';
print 'top:70px;';
print 'width:460px;';
print 'height:490px;';
print 'background-color:#ffffff;';
print 'overflow:auto;">';
$dbase="raced.db";
$raceinfo = DBI->connect("dbi:SQLite:dbname=$dbase","","");
print '<h2 align="center";>LAST SEEN RACES</h2>';
print '<TABLE border="1" style="border: 1px #555 solid; border-collapse: collapse;"; align="center";>';
print '<tr>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">SECTION</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">RLSNAME</th>';
print '</tr>';
my $qry = $raceinfo->prepare("SELECT * FROM raceinfo WHERE name like ? ORDER BY time DESC LIMIT 50");
$chk_rls = "%";
$qry->execute( $chk_rls );
while ( @row = $qry->fetchrow_array ) {
($tme, $section, $rlsname)=@row;
$readable_time = localtime($tme);
#print "@row\n";
print "<TR><td>$section<TD>$rlsname";
}
print '</TABLE>';
print '</div>';
print '<div style="position:absolute; border: solid; border-width: thin; width: 50%;';
print 'text-align: left;';
print 'left:500px;';
print 'top:320px;';
print 'width:620px;';
print 'height:240px;';
print 'background-color:#ffffff;';
print 'overflow:auto;">';
print '<h2 align="center";>PRE BOT INFO</h2>';
print '<TABLE border="1" style="border: 1px #555 solid; border-collapse: collapse;"; align="center";>';
print '<tr>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">TIME</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">SECTION</th>';
print '<th style="border-bottom: 1px #333 solid;border-right: 1px #666 dashed;">RLSNAME</th>';
print '</tr>';
$dbase2="prebot.db";
$prebase2 = DBI->connect("dbi:SQLite:dbname=$dbase2","","") || &pberror;
$sth2 = $prebase2->prepare ("create table IF NOT EXISTS prebots(time varchr(20),name varchr(100),section varchr(30),bot varchr(20),chan)");
$sth2->execute();
$prebotqry = $prebase2->prepare("SELECT time,name,section,bot FROM prebots WHERE name like ? ORDER BY time DESC LIMIT 50");
$chk_rls = "%";
$prebotqry->execute( $chk_rls );
while ( @row = $prebotqry->fetchrow_array ) {
($tme, $name, $section, $chan)=@row;
$readable_time = localtime($tme);
#print "@row\n";
$readable_time = localtime($tme);
($day, $mon, $date, $ctime, $year)=split(" ",$readable_time);
($hour,$min)=split(":",$ctime);
$ctime="$hour:$min";
$showtime="$date $mon $ctime";
print "<TR><TD>$showtime<TD>$section<TD>$name";
}
print '</TABLE>';
print '</div>';
print '</body>';
print '</html>';
;
}
sub output_web_skiplists {
&web_header;
open(FILE, "www//skiplists.htm");@webpage=<FILE>;close(FILE);
foreach $output_line (@webpage) {
chomp($output_line);
print $output_line;
}
}
sub output_web_form {
use CGI::FormBuilder;
@fields = qw(first_name last_name email phone mailing_list);
$form = CGI::FormBuilder->new(
method => 'post',
fields => \@fields,
validate => {
email => 'EMAIL', # validate fields using
},
required => 'ALL',
);
# add options to our mailing list field
$form->field(name => 'mailing_list',
options => [qw/Subscribe Unsubscribe/]);
if ($form->submitted) {
# you would write code here to act on the form data
$fname = $form->field('first_name');
$lname = $form->field('last_name');
print "testing stuff here too\n";
print $form->confirm(header => 1);
print "FORM COMMITED ENDING NOW\n";
} else {
print $form->render(header => 1);
print "FORM COMMITED ENDING NOW 2\n";
}
}
}
package main;
my %siteinfo;
use Win32::SystemInfo;
use String::CRC32;
use Math::BaseCalc;
sub httpd_thread {
$configini = new Config::IniFiles( -file => "inifiles\\main.ini" ) || die "CANNOT FIND MAIN.INI";
$httpd = $configini->val("general","httpserver");
$httpdport = $configini->val("general","httpdport");
if ( $httpd ) { Foo::Server->new($httpdport)->run(); print "HTTP SERVER STARTED\n"; }
}
&load_main_win;
$configini = new Config::IniFiles( -file => "inifiles\\main.ini" ) || system "CANNOT FIND MAIN.INI";
defined(my $splash = $Win32::GUI::Loft::window{pautov2});
$splash->rlsname->Text("Starting Pauto...");
$Win32::GUI::Loft::window{pautov2}->Show();
$splash->rlsname->Text("Opened SQL Link to LocalHost");
$Win32::GUI::Loft::window{pautov2}->Show();
$prebot_type=$configini->val("prebot","use");
if ( !($prebot_type)) { $prebot_type="internal"; }
if ( $prebot_type eq "external" ) {
$sqlpb=1;
$sqlip=$configini->val("prebot","ip");
$sqlport=$configini->val("prebot","port");
$sqluser=$configini->val("prebot","user");
$sqldb=$configini->val("prebot","db");
$sqlpass=$configini->val("prebot","passwd");
$sqladd=$configini->val("prebot","addtodb");
$sqltables=$configini->val("prebot","tables");
$sql_table_time=$configini->val("prebot","time");
$sql_table_name=$configini->val("prebot","name");
$sql_table_section=$configini->val("prebot","section");
print "using external SQL prebot\n";
} else {
$sqlpb=0;
print "using Internal SQLlite prebot\n";
}
print "loaded ini file\n";
$configini = new Config::IniFiles( -file => "inifiles\\main.ini" ) || system "CANNOT FIND MAIN.INI";
$splash->rlsname->Text("Loaded Main.ini");
$Win32::GUI::Loft::window{pautov2}->Show();
$httpd = $configini->val("general","httpserver");
$chainsini = new Config::IniFiles( -file => "inifiles\\chains.db2" ) || system "CANNOT LOAD CHAINS FILE";
&rehash_information;
$splash->rlsname->Text("Loaded All Site Information");
$Win32::GUI::Loft::window{pautov2}->Show();
$configini = new Config::IniFiles( -file => "inifiles\\main.ini" ) || system "CANNOT FIND MAIN.INI";
$CHANGE_TV = $configini->val("general","change_tv_sections");
$CHANGE_MOVIE = $configini->val("general","change_movie_sections");
if ( $CHANGE_TV ) { print "TV GENRE SECTIONS ENABLED\n"; }
if ( $CHANGE_MOVIE ) { print "MOVIE SECTION CHANGE -- ON\n"; }
if (!($configini)) { system "CONFIG INI FILE NOT FOUND\n"; }
open(CODES, "codes.txt");@codes=<CODES>;close(CODES);
open(CCODES, "ccodes.txt");@ccodes=<CCODES>;close(CCODES);
$splash->rlsname->Text("Loaded CCodes.txt");
$Win32::GUI::Loft::window{pautov2}->Show();
my($sock, $oldmsg, $newmsg, $hisaddr, $hishost, $MAXLEN, $PORTNO);
$LOADED_sections=$configini->val("general","sections");
$LOADED_globalskip=$configini->val("general","globalskip");
$splash->rlsname->Text("Global Skiplist Opened");
$Win32::GUI::Loft::window{pautov2}->Show();
$race_from_pre_sections = $configini->val("general","race_from_pre");
$splash->rlsname->Text("RACEING $race_from_pre_sections FROM PREBOT...");
$Win32::GUI::Loft::window{pautov2}->Show();
$http_thrd = threads->new( \&httpd_thread );
$http_thrd->detach;
$random_string=&generate_random_string(6);
$PORTNO = $configini->val("general","port");
$HOST = $configini->val("general","host");
$PORTNO=~s, ,,ig;
$HOST=~s, ,,ig;
$MAXLEN = 256;
$udpsock = IO::Socket::INET->new(LocalHost => $HOST, LocalPort => $PORTNO, Proto => 'udp');
$splash->rlsname->Text("Opend UDP ON $HOST:$PORTNO");
$Win32::GUI::Loft::window{pautov2}->Show();
$splash->rlsname->Text("WAITING FOR FIRST CONNECTION .. STAND BY");
$Win32::GUI::Loft::window{pautov2}->Show();
$TCPPORTNO = $configini->val("general","tcpport");
$TCPHOST = $configini->val("general","tcphost");
$TCPPORTNO=~s, ,,ig;
$TCPHOST=~s, ,,ig;
$tcpsock = new IO::Socket::INET (
LocalHost => $TCPHOST,
LocalPort => $TCPPORTNO,
proto => 'tcp',
Listen => 1,
Reuse => 1,
);
$main_thread=threads->self;
$tcp_thrd = threads->new( \&recieve_tcp );
$MAXLEN=32;
while ($udpsock->recv($newmsg, $MAXLEN)) {
my($port, $ipaddr) = sockaddr_in($udpsock->peername);
print "GOT UDP OF $newmsg\n";
$hishost = gethostbyaddr($ipaddr, AF_INET);
print "GOT STATUS SENDING $TCPHOST $TCPPORTNO $hishost $0 NOW\n";
$udpsock->send("!status $TCPHOST $TCPPORTNO $0\n");
$splash->rlsname->Text("Recieved !status command..");
$Win32::GUI::Loft::window{pautov2}->Show();
$udpsock->close;
($cmd,$nick)=split(/ /,$newmsg);
}
$splash->rlsname->Text("Thread pool updated");
$Win32::GUI::Loft::window{pautov2}->Show();
$tooltips=$version;
$version="Pauto V2.90 FINAL 17 Jan 2010 -- FINAL VERSION.......";
my $lastpre :shared;
my $lastrace :shared;
my $numraces :shared;
$numraces=0;
$splash->rlsname->Text("READY... $version");
$Win32::GUI::Loft::window{pautov2}->Show();
Win32::GUI::Dialog();
$tcp_thrd->detach();
$DOS = Win32::GUI::GetPerlWindow();
Win32::GUI::Show($DOS);
print "Thanks for using Pauto V2.90 FINAL\n";
$win->NI->Remove();
die "end now\n";
system;
sub generate_random_string {
$length_of_randomstring=shift;# the length of
# the random string to generate
@chars=('a'..'z','A'..'Z','0'..'9','_');
$random_string;
foreach (1..$length_of_randomstring)
{
# rand @chars will generate a random
# number between 0 and scalar @chars
$random_string.=$chars[rand @chars];
}
return $random_string;
}
sub recieve_tcp {
$tcp_connection = $tcpsock->accept();
print $tcp_connection "PERL AUTO V2.70 CONSONLE WINDOW\n";
while(<$tcp_connection>) {
$got_input = $_;
$newmsg=$got_input;
$newmsg=~s,(\r|\n),,ig;
## Filter Area
$newmsg=~s,\d\d\d\d-\d\d-\d\d/,,ig;
$newmsg=~s,xxx/,,ig;
$newmsg=~s,\d\d\d\d/,,ig;
$newmsg=~s,\d\d-\d\d\d\d/,,ig;
$newmsg=~s,/d/d-\d\d/,,ig;
if ( $newmsg=~m,^rehash$,i ) { &rehash_information; warn "REHASH SITES CALLED FROM MIRC\n"; next; }
if ( $newmsg=~m,!getaffils,i ) {
($cmd, $item)=split(/ /,$newmsg);
$affil_sites=&find_affils_for_race("something-something-$item");
print $tcp_connection "!affillist $affil_sites\n";
next;
}
if ( $newmsg=~m,!manualrace,i ) {
($cmd, $section, $rlsname)=split(/ /,$newmsg);
print "doing manual chain race now\n";
$chk_pretime{$rlsname}="";
if ( $racebot_sortsection{$rlsname} ) { $section=$racebot_sortsection{$rlsname}; } else {
$section=~s,([^\w|-]),,ig;
$origsect=$section;
if ( length($rlsname) < 5 ) { next; }
$sections=$LOADED_sections;
if ( $section=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
$racebot_sortsection{$rlsname}=$section;
}
debug("$nick : $site : RACE BOT OUTPUT :: FOUND NEW RACE $rlsname");
$itemset = "$site~$rlsname";
$timer{$itemset} = [gettimeofday];
$info=&check_single_site($site,$section,$rlsname,0);
print $tcp_connection "!MANUALrace $section $rlsname\n";
$mainwin->rlsname->Text("$rlsname");
$mainwin->section->Text("$section");
do_chains_for_race($rlsname,$section,1,0,0,1,1);
next;
}
if ( $newmsg=~m,(PAUTODIE),i ) {
defined($win = $Win32::GUI::Loft::window{pautov2});
Win32::GUI::SendMessage($win, WM_CLOSE, 0, 0);
print "AUTO KILLED FROM MIRC\n";
last;
}
if ( $newmsg=~m,!sortsect,i ) {
($cmd,$section,$rlsname)=split(/ /,$newmsg);
$sections=$LOADED_sections;
if ( $section=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section2=&sort_race_section($section, $rlsname);
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
print $tcp_connection "!sorted Section To $section for $rlsname\n";
print "!sorted Section To $section for $rlsname\n";
next;
}
if ($newmsg=~m,!addpre, ) {
($cmd,$chan,$nick,$sect,$rlsname)=split(/ /,$newmsg);
while ( $rlsname=~m,(\W$|^\W),g ) { $rlsname=~s,(\W$|^\W),,g; }
if ( $prebot_sortsection{$rlsname} ) { $section=$prebot_sortsection{$rlsname}; } else {
$section="";
$sections=$LOADED_sections;
if ( $sect=~m,$sections,i ) { $section = $1; }
$section=&sort_race_section($section, $rlsname);
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$prebot_sortsection{$rlsname}=$section;
}
if ( !($dbase2)) { &do_sql2; }
$prebotqry2->execute("%$rlsname%");
$found=0;
while ( @row = $prebotqry2->fetchrow_array ) { $found=1; }
if ( !($found )) {
$unixtime = mktime (localtime);
$prebotinsert2->execute($unixtime, $rlsname, $section, $nick, $chan);
print $tcp_connection "!addpre $section $rlsname $nick $chan\n";
if ( $sqladd ) {
if ( $sqlpb ) {
if ( !($mysql)) {
$mysql = new Ananke::SqlLink({
'type' => 'mysql',
'db' => $sqldb,
'host' => $sqlip,
'port' => $sqlport,
'username' => $sqluser,
'passwd' => $sqlpass,
});
}
$q = "INSERT INTO prebots($sqltables) VALUES (\"$unixtime\",\"$rlsname\",\"$section\",\"$nick\",\"$chan\")";
$mysql->do($q); undef $q;
}
}
$nowtime=mktime (localtime);
$mainini = new Config::IniFiles( -file => "inifiles\\main.ini" );
$Fnick = $mainini->val('general', 'forum_nick' );
$s = new IO::Socket::INET(PeerAddr => $ip, Proto => 'udp');
if ( $need_pretime_confirm{$rlsname} ) {
$wait_time=$need_pretime_confirm{$rlsname};
$waiting_time=$nowtime-$wait_time;
if ( $waiting_time < 15 ) {
do_chains_for_race($rlsname,$section,1,0,0,1,1);
print $tcp_connection "!waitrace $section $rlsname $nick_$chan\n";
} else { $need_pretime_confirm{$rlsname}=""; }
}
if ( $race_from_pre_sections ) {
if ( $section=~m,$race_from_pre_sections$,i ) {
if ( &checkrace($rlsname,$section) eq "RACED" ) { next; }
print $tcp_connection "PRERACEING $section $rlsname FROM PREBOT\n";
$mainwin->rlsname->Text("$rlsname");
$mainwin->section->Text("$section");
do_chains_for_race($rlsname,$section,1,0,0,0,0);
}
}
next;
}
next;
}
################### new race below
if ( $newmsg=~m,!checkmaninfo,i ) {
($cmd,$section,$rls)=split(/ /,$newmsg);
@info=&find_pretime($rls);
($pttime,$ptrls,$ptsection,$ptbot)=@info;
$nowtime=mktime (localtime);
$pretime = $nowtime - $pttime;
print $tcp_connection "!manchk PRETIME: $pretime seconds ago\n";
$tvrage=0;
$imdb=0;
if ( $section=~m,TV,i ) { $tvrage=1; }
if ( $section=~m,XVID|DVDR|X264,i ) { $imdb=1; }
if ( $tvrage == 1 ) { $imdb=0; }
if ( $rls=~m,MDVDR,i ) { $imdb=0; }
if ( $tvrage == 1 ) {
@tvinfo2=&check_tvrage($rls);
print $tcp_connection "!manchk TVRAGE: @tvinfo2\n";
}
if ( $imdb == 1 ) {
$imdbinfo=&new_imdb($rls);
print $tcp_connection "!manchk IMDB: $imdbinfo\n";
}
$race_sections=&return_section($section);
$race_sections=~s,(^\W),,g;
$allowedsites=&check_allow($rls,$section,$race_sections);
print $tcp_connection "!manchk ALLOWED: $allowedsites\n";
next;
}
### DO NEW RACE
if ( $newmsg=~m,!newrace,i ) {
($cmd, $nick, $site, $section, $rlsname)=split(/ /,$newmsg);
$chk_pretime{$rlsname}="";
if ( $racebot_sortsection{$rlsname} ) { $section=$racebot_sortsection{$rlsname}; } else {
$section=~s,([^\w|-]),,ig;
$origsect=$section;
if ( length($rlsname) < 5 ) { next; }
$sections=$LOADED_sections;
if ( $section=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
$racebot_sortsection{$rlsname}=$section;
}
debug("$nick : $site : RACE BOT OUTPUT :: FOUND NEW RACE $rlsname");
$itemset = "$site~$rlsname";
$timer{$itemset} = [gettimeofday];
$info=&check_single_site($site,$section,$rlsname,1);
if ( &checkrace($rlsname,$section) eq "RACED" ) {
print $tcp_connection "!oldrace $section $rlsname $site $nick $info $section $ptbot\n";
next;
}
print $tcp_connection "!newrace $section $rlsname $site $nick $info $section\n";
$mainwin->rlsname->Text("$rlsname");
$mainwin->section->Text("$section");
if ( $race_from_pre_sections ) {
if ( !($rlsname=~m,/(CD\d|SAMPLE|SUBS),i )) {
if ( $section=~m,$race_from_pre_sections,i ) { next; }
}
}
$numraces++;
do_chains_for_race($rlsname,$section,1,0,0);
next;
}
############ Manaual race below
if ( $newmsg=~m,!manual,i ) {
($cmd,$section,$rlsname,$sites)=split(/ /,$newmsg);
debug("MANUAL TRADE OF $rlsname $section $sites");
$info=&send_chain_2_rush($rlsname,$section,$sites,"MANUAL");
next;
}
###### AFFILIATED RACE BELOW
if ( $newmsg=~m,!affilrace,i ) {
($cmd, $nick, $site, $section, $rlsname, $group)=split(/ /,$newmsg);
if ( length($rlsname) < 5 ) { next; }
if ( $affilbot_sortsection{$rlsname} ) { $section=$affilbot_sortsection{$rlsname}; } else {
$sections=$LOADED_sections;
if ( $section=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
$affilbot_sortsection{$rlsname}=$section;
}
if ( !($dbase2)) { &do_sql2; }
$prebotqry2->execute("%$rlsname%");
$found=0;
while ( @row = $prebotqry2->fetchrow_array ) { $found=1; }
if ( !($found )) {
$unixtime = mktime (localtime);
$prebotinsert2->execute($unixtime, $rlsname, $section, $nick, $chan);
print $tcp_connection "!addpre $section $rlsname $nick $chan\n";
}
$mainini = new Config::IniFiles( -file => "inifiles\\main.ini" );
$Fnick = $mainini->val('general', 'forum_nick' );
$itemset = "$SITENAME~$rlsname";
$timer{$itemset} = [gettimeofday];
$info=&check_single_site($site,$section,$rlsname,0);
$inifile="inifiles//$site.ini";
$mainini = new Config::IniFiles( -file => $inifile );
$affils = $mainini->val("general","siteaffils");
@groups=split(/-/,$rls);
$group1=$groups[-1];
if ( !($affils=~m,($group),i )) {
print "WRITING AFFIL $group -- $group1 TO SITE $site\n";
$affils2 = $mainini->newval('general', 'siteaffils',"$affils $group");
$mainini->RewriteConfig;
}
print $tcp_connection "!affil $section $rlsname $site $nick $info\n";
if ( &checkrace($rlsname,$section) eq "RACED" ) { next; }
do_chains_for_race($rlsname,$section,1,0,0);
next;
}
###### COMPLETED RACE BELOW
if ( $newmsg=~m,!comprace,i ) {
($cmd, $nick, $site, $sect, $rlsname)=split(/ /,$newmsg);
if ( length($rlsname) < 5 ) { next; }
if ( $compbot_sortsection{$rlsname} ) { $section=$compbot_sortsection{$rlsname}; } else {
$sections=$LOADED_sections;
if ( $sect=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
$compbot_sortsection{$rlsname}=$section;
}
$itemset = "$site~$rlsname";
if ( $timer{$itemset}) {
$elapsed = tv_interval ($timer{$itemset});
$timer{$itemset}="";
} else { $elapsed = "UNKNOWN"; }
debug("$nick : $site : RACE BOT OUTPUT :: RACE COMPLETE");
print $tcp_connection "!COMPLETE $section $rlsname $site $nick $elapsed\n";
next;
}
###### NUKED RACE BELOW
if ( $newmsg=~m,!nukerace,i ) {
($cmd, $nick, $site, $sect, $rlsname)=split(/ /,$newmsg);
if ( $nukebot_sortsection{$rlsname} ) { $section=$nukebot_sortsection{$rlsname}; } else {
$sections=$LOADED_sections;
if ( $sect=~m,$sections,i ) { $section = $1; }
if ( $section=~m,MP3,i ) { $section="MP3"; }
if ( !($section)) { print $tcp_connection "!nosect SECTION MISSING FROM $newmsg FROM $chan\n"; next }
$section=&sort_race_section($section, $rlsname);
$section=uc($section);
$nukebot_sortsection{$rlsname}=$section;
}
$info=&check_single_site($site,$section,$rlsname,1);
debug("$nick :: RACE BOT OUTPUT :: FOUND NUKE RACE $rlsname");
print $tcp_connection "!nukerace $section $rlsname $site $nick $info\n";
next;
}
if ( $newmsg=~m,!imdb,i ) {
($cmd,$rlsname)=split(/ /,$newmsg);
$imdbinfo=&new_imdb($rlsname);
print $tcp_connection "!imdb $imdbinfo\n";
next;
}
##### DO SEND CHAINS FROM MANUAL
print "TCP: $got_input\n";
}
close($tcpsock);
}
sub debug {
if ( $tcp_connection ) { print $tcp_connection "!debug @_\n"; }
}
sub do_pftp_chain {
$rlsname=$_[0];
if ( $rlsname=~m,/\w,i ) { return 0;}
$section=$_[1];
$chain=$_[2];
$pftpchain=$_[3];
$fxp=$_[4];
if ( !($pftpchain )) { $pftpchain="pftp"; }
$chain=~s,^\W;,,;
@pchains="";
@pchains=split(";",$chain);
@allowed=();
@affils=();
@finalchains=();
$loop="YES";
foreach $ssite (@pchains) {
if ( $ssite eq "-" ) { $loop="NO"; next; }
$test=&check_single_site($ssite,$section,$rlsname,0);
if ( $test=~m,YES,i ) { push (@allowed,$ssite); }
if ( $test=~m,AFFIL,i ) { push (@affils,$ssite); }
}
$numsites=@allowed;
if (( $numsites < 2 ) && ( !(@affils))) { return 0; }
if ( !($numsites)) { return 0; }
$sitenum=1;
if ( @affils ) { $afil=$affils[0]; }
if ( $affils[0] ) { unshift(@allowed,$affils[0]); $loop="NO"; }
foreach $chain_site (@allowed) {
if ( $chain_site eq "-" ) { $loop = "NO"; next; }
$chain="";
$site1=$chain_site; $site2=$allowed[$sitenum];
if (!($site2)) { next; }
if (!($site1)) { next; }
if ( $site1 eq $site2 ) { next; }
$chain="$site1,$site2";
if ( $chain ) { push (@finalchains,$chain); }
$sitenum++;
}
if ( $loop eq "YES" ) {
if ( $site2 ) { $site1=$site2; }
$site2=$allowed[0];
if ( $site1 ne $site2 ) { $chain="$site1,$site2"; push (@finalchains,$chain); }
}
$fchain=join(",",@finalchains);
if ( !($fchain)) { return 0; }
$mainini = new Config::IniFiles( -file => "inifiles//main.ini" );
$pftpport=$mainini->val($pftpchain, 'pftpport'); $pftpip=$mainini->val($pftpchain, 'pftpip');
$pftppass=$mainini->val($pftpchain, 'pftppass'); $pftpline=$mainini->val($pftpchain, 'pftpline');
if ( !($pftpport) ) { return 0; }
$pftpline=~s,section,$section,; $pftpline=~s,rlsname,$rlsname,;
$pftpline=~s,sites,$fchain,; $pftpline="$pftppass $pftpline";
$ipaddr = inet_aton($pftpip); $portaddr = sockaddr_in($pftpport, $ipaddr);
if ( $MySocket ) { $MySocket->close; }
$MySocket=new IO::Socket::INET->new(PeerPort=>$pftpport,
Proto=>'udp',
PeerAddr=>$pftpip);
if ( $fxp ) { $MySocket->send($pftpline); select(undef, undef, undef, 0.3); }
if ( $show ) { $chkwin->chains_out->AddString("PFTP: $fchain"); }
if ( $tcp_connection ) { print $tcp_connection "!pftpsent $section $rlsname $fchain PFTP\n"; }
return 0;
}
sub do_chains_for_race {
$rlsname=$_[0];
$section=$_[1];
$fxp=$_[2];
$ret=$_[3];
$show=$_[4];
$manual=$_[5];
$prebot_race=$_[6];
$check_pretime=1;
if ( $manual ) { $check_pretime="n"; }
if ( $prebot_race ) { $check_pretime="n"; }
if ( $show ) {
$chkwin = $Win32::GUI::Loft::window{PAUTOCHK};
$chkwin->chains_out->Reset;
}
$chain_race_affils=""; $regex_affil_line="";
$chain_race_affils=&find_affils_for_race($rlsname,$section);
$chain_race_affils=~s,^\s|\s$,,ig;
@current_affils=();
if ( $chain_race_affils ) {
$regex_affil_line="($chain_race_affils)";
$regex_affil_line=~s, ,|,ig;
@current_affils=split(" ",$chain_race_affils);
}
#warn "got $regex_affil_line for $rlsname\n";
@chain_affils=();
$chain_affils="";
if ( $chain_race_affils ) { @chain_affils=split(/ /,$chain_race_affils); debug("USING AFFILS $chain_race_affils");}
foreach $afil (@chain_affils) {
$tmpini = new Config::IniFiles( -file => "inifiles\\$afil.ini" );
$no_affil = $tmpini->val("general","affil_slots");
if (!($no_affil)) { $no_affil=1; }
if ( $no_affil ne -1 ) {
$times_to_use_affil{"$afil"}=$no_affil;
} else { $times_to_use_affil{"$afil"}=0; }
}
@tmp_holder=();
@chain_affils=();
@chain_affils=@tmp_holder;
$race_sections=&return_section($section);
$race_sections=~s,(^\W),,g;
if ( $show ) {
defined($chkwin = $Win32::GUI::Loft::window{PAUTOCHK});
$check_pretime=$chkwin->CR_PRETIME_CHECK->Checked;
}
$allowedsites=&check_allow($rlsname,$section,$race_sections,$check_pretime);
$allowedsites=~s,^\s|\s$,,ig;
@asite_tmp=split(" ",$allowedsites);
$info=&findchain($section,$rlsname);
if ( $show ) { $chkwin->chkrls_chainname->Text($info); }
@chains=&findnamedchain($info);
($CHNAME,$CHSECT,$CHDET,$CHSTRING)=@chains;
@chainloop=split("/",$CHSTRING);
$chainnum=0;
$affil_loop=0;
$allowed_regex="";
if ( $allowedsites ) {
$allowed_regex="($allowedsites)";
$allow
Lol my source code released on my birthday. how ironic __Fuas__
ReplyDeletehrhr Happy Bday _Fuas_ ;) I dont know it was your birthday .... Sorrryyy ;)
ReplyDeletethe code was released more than three years ago in Pauto_290_Final-DE-2010-ET.
ReplyDeletekinda lame you announce it now
... and its incomplete LOL
ReplyDelete