Quakenet auth with xchat2 (~/.xchat2/qnet.pl)

Moderators: digital, horus

Quakenet auth with xchat2 (~/.xchat2/qnet.pl)

Postby analyzer on 09 Mar 2008, 14:39

#!/usr/bin/perl
#
# Q Authing script for Quakenet.
#
# Instructions: Change Q_auth_name and Q_auth_pass to your Q user/pass. Stick in your Xchat script directory and job's done.
# Script will attempt to auth with Q on first server join.
# It will also check every $check_intervals milliseconds that it is authed and re-auth if not.
#
# Config Section

my $Q_auth_name = "authname"; # Your Q AuthName
my $Q_auth_pass = "authpass"; # Your Q Password
my @personalchan = ("#chan1", "#chan2", "#chan3", "#chan4");
my $recheck = 0; # Whether to periodically check you're still authed. (Netsplits and bouncers can de-auth you)
# NOTE! Enabling this results in ALL Q chat being hidden from you!
my $modex = 1; # Whether to hide your IP/hostname from whois once authed. 1 = yes, 0=no.
my $attempts=3; # Number of failed attempts to auth before giving up.
my $check_intervals = 50000; # milliseconds between auth attempts and checks. 300000 = 5 minutes, 600000=10 minutes. 1800000=30 mins.
#
# End Config
#
# Startup registers
Xchat::register( "Q Authing Script", "V.001", "Q_Auther", "" );
Xchat::hook_print( "Server Text", "qserver_watch"); # Watch for server messages for initial run.
Xchat::hook_print("Notice","qchat_watch"); # Hook Q's replies
my $check_timer;
my $cur_attempt=0;
my $newcon=1;

Xchat::print("Q Authing script loaded.");

if ($recheck == 1)
{
$check_timer=Xchat::hook_timer(50000,"check_qauth");
check_qauth();
}

# Called on messages from server. Tends not to work too well with bouncers.
sub qserver_watch
{
$qline = $_[0][0];
# Change this is Qnet change their welcome string
if ($qline =~ /Welcome to the QuakeNet/)
{
Xchat::print("Found Quakenet connection string, attempting auto-auth for $Q_auth_name");
auth();
# Also add a +x to hide the IP (On quakenet this replaces your hostmask with *@authname.quakenet.org.
# Comment following line if for some insane reason you don't want that.
if ($modex == 1) { Xchat::command("umode +x"); }
}

if ($qline =~ /now your hidden host/)
{
if ($newcon == 1)
{
foreach my $chan (@personalchan)
{
Xchat::command("join " . $chan)
}
$newcon=0;
}
}

return Xchat::EAT_NONE;
}

sub qchat_watch
{
$qline = $_[0][1];
# Auth check
if ($recheck == 1)
{
if ($qline =~ /You have authed as/ )
{
#Xchat::print("Received auth confirmation from Q");
$cur_attempt=0; # Reset counter as we're now authed.
Xchat::command("umode +x");
#Xchat::command("mode " . xchat.get_info('nick') . " +x");
}
if($qline =~ /You have NOT authed/ )
{
$cur_attempt++;
Xchat::print("Warning: Q Authorisation has failed, retrying. Attempt $cur_attempt/$attempts... (q.pl)");
auth();
}
if ($recheck == 1)
{
return Xchat::EAT_ALL; # Have to hide Q's notices or it'll spam the current chan.
}
else
{
return Xchat::EAT_NONE;
}
}
}

sub check_qauth
{
Xchat::command("msg Q\@CServe.quakenet.org whoami");
if ($cur_attempt+1 >= $attempts)
{
Xchat::print("Error: Auth attempt " . $cur_attempt+1 . " exceeds max attempts $attempts. Final attempt.");
return Xchat::REMOVE;
}
else
{
return Xchat::KEEP;
}
}

sub auth
{
Xchat::command("msg Q\@CServe.quakenet.org auth $Q_auth_name $Q_auth_pass");
}
analyzer
Administrateur
Administrateur
 
Posts: 27
Joined: 22 Mar 2005, 19:37

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron