home *** CD-ROM | disk | FTP | other *** search
- ;%%%%%%%%%%%%%%%%%%%%%%%%
- ;script iTelnet Daemon
- ;version 7.20
- ;author Quietust
- ;email quietust@ircN.org
- ;url http://www.ircN.org
- ;%%%%%%%%%%%%%%%%%%%%%%%%
- on 1:START {
- sockclose telnet
- if ($portfree(%telnetport)) socklisten telnet %telnetport
- else iecho Warning! Unable to open $hc(Telnet daemon) on port $hc(%telnetport) $+ !
- }
- on 1:SOCKLISTEN:telnet {
- set %i 0
- :start
- inc %i
- if ($sock($addtok(telnet,%i,46)) == $null) sockaccept $addtok(telnet,%i,46)
- else goto start
- sockwrite -n $addtok(telnet,%i,46) $crlf $+ $crlf $+ $me ( $+ $strip(%iver) (c)1998 The Quietust) $+ $crlf $+ $crlf $+ Please enter your nickname.
- pl.fbc n *** Incoming connection from $sock($addtok(telnet,%i,46)).ip
- }
- on 1:SOCKREAD:telnet.* {
- if ($sockerr > 0) return
- sockread %pl.parse
- if ($sockbr == 0) return
- tel.login $sockname $backspace(%pl.parse)
- }
- alias tel.login {
- if ($gettok($1,2,46) isnum) {
- if ($gettok($1,3,46)) {
- if ($2 === $password($gettok($1,3,46))) {
- sockwrite $1 $crlf
- sockrename $1 $deltok($1,2,46)
- .timer 1 0 tel.login $deltok($1,2,46) .
- }
- else {
- sockwrite -n $1 Negative on that, Houston.
- sockclose $1
- }
- }
- elseif ($password($2)) {
- if (($sock($addtok(telnet.*,$2,46))) || ($sock($addtok(telnet,$2,46)))) {
- sockwrite -n $1 Error! You are already connected at the interface menu!
- sockclose $1
- }
- else {
- sockwrite -n $1 $crlf $+ Enter your password.
- sockrename $1 $addtok($1,$2,46)
- }
- }
- elseif ($usrhost($2)) {
- sockwrite -n $1 You have no password set.
- sockclose $1
- }
- else {
- sockwrite -n $1 You have no access.
- sockclose $1
- }
- }
- elseif ((%partyline == on) && ($2 == partyline) && ($chkflag($gettok($1,2,46),$null,p))) {
- if ($sock($puttok($1,partyline,1,46))) {
- sockwrite -n $1 You are already connected using that interface!
- .timer 1 0 tel.login $1 .
- }
- else {
- sockrename $1 $puttok($1,partyline,1,46)
- pl.login $puttok($1,partyline,1,46)
- }
- }
- elseif ((%rcontrol == on) && ($2 == remote) && ($chkflag($gettok($1,2,46),$null,r))) {
- if ($sock($puttok($1,remote,1,46))) {
- sockwrite -n $1 You are already connected using that interface!
- .timer 1 0 tel.login $1 .
- }
- else {
- sockrename $1 $puttok($1,remote,1,46)
- rc.login $puttok($1,remote,1,46)
- }
- }
- elseif ($2 == quit) {
- sockwrite -n $1 Goodbye...
- sockclose $1
- }
- elseif ($2 == .) sockwrite -n $1 Available interfaces: $iif((%partyline == on) && $chkflag($gettok($1,2,46),$null,p),partyline) $iif((%rcontrol == on) && $chkflag($gettok($1,2,46),$null,r),remote) quit $+ $crlf $+ Enter interface to use.
- elseif ($2) {
- sockwrite -n $1 Invalid interface!
- .timer 1 0 tel.login $1 .
- }
- }
- on 1:SOCKREAD:partyline.* {
- if ($sockerr > 0) return
- sockread %pl.parse
- if ($sockbr == 0) return
- if ($backspace(%pl.parse) != $null) pl.parse $sockname $ifmatch
- }
- alias pl.parse {
- if ((($chkflag($gettok($1,2,46),*,m)) || ($chkflag($gettok($1,2,46),$null,n))) && ($left($2,1) == ,)) pl.fbc m - $+ $gettok($1,2,46) $+ - $getright($2-)
- elseif (($pl.var($gettok($1,2,46),channel) == $null) || ($left($2,1) == .)) {
- set %tmp.pl.parse $iif($left($2,1) == .,$getright($2),$2)
- if ($isalias($addtok(partyline,%tmp.pl.parse,46))) {
- $addtok(partyline,%tmp.pl.parse,46) $1-
- set %tmp.pl.parse $iif($left($2,1) == .,$getright($2),$2)
- if ($result == -2) sockwrite -n $1 You have chat turned off.
- elseif ($result == -1) {
- if ($pl.var($gettok($1,2,46),channel) != $null) sockwrite -n $1 What? Try '.help'
- else sockwrite -n $1 What? Try 'help'
- }
- elseif ($result == 0) return
- elseif ($result == 1) pl.fbc m $chr(35) $+ $gettok($1,2,46) $+ $chr(35) %tmp.pl.parse $3-
- elseif ($result == 2) pl.fbc m $chr(35) $+ $gettok($1,2,46) $+ $chr(35) %tmp.pl.parse (something)
- elseif ($result == 3) pl.fbc m $chr(35) $+ $gettok($1,2,46) $+ $chr(35) %tmp.pl.parse $3 (something)
- elseif ($result isnum) pl.fbc m $chr(35) $+ $gettok($1,2,46) $+ $chr(35) %tmp.pl.parse $3- [ $+ [ $result ] ] (something)
- else partyline.boot partyline. $+ $gettok(%owner,1,44) .boot $gettok($1,2,46) Command ' $+ %tmp.pl.parse $+ ' returned invalid value!
- }
- elseif ($pl.var($gettok($1,2,46),channel) != $null) sockwrite -n $1 What? Try '.help'
- else sockwrite -n $1 What? Try 'help'
- }
- elseif ($pl.var($gettok($1,2,46),channel) != $null) {
- partyline.say $1 .say $2-
- if ($result == -2) sockwrite -n $1 You have chat turned off.
- }
- }
- alias pl.login {
- sockwrite -n $1 $crlf $+ Connected to $me $+ , running $strip(%iver) (c) 1999 The Quietust $+ $crlf
- qplay -f $td(cmotd.txt) sockwrite -n $1
- sockwrite -n $1 $crlf $+ Commands start with '.' (like '.quit' or '.help') $+ $crlf $+ Everything else goes out to the party line. $+ $crlf
- sockmark $1 on off - - $ctime 0
- pl.bc $1 *** $gettok($1,2,46) joined the party line.
- }
- alias pl.chkowner {
- set %i 0
- :start
- inc %i
- if ($gettok(%owner,%i,44)) {
- set %tmp.pl.chkowner +
- if ($chkflag($gettok(%owner,%i,44),$null,n) == $false) set %tmp.pl.chkowner %tmp.pl.chkowner $+ n
- if ($chkflag($gettok(%owner,%i,44),$null,m) == $false) set %tmp.pl.chkowner %tmp.pl.chkowner $+ m
- if ($chkflag($gettok(%owner,%i,44),$null,p) == $false) set %tmp.pl.chkowner %tmp.pl.chkowner $+ p
- if (%tmp.pl.chkowner != +) chattr $gettok(%owner,%i,44) %tmp.pl.chkowner
- goto start
- }
- }
- alias pl.set {
- if ($2 == echo) sockmark $addtok(partyline,$1,46) $3 $gettok($sock($addtok(partyline,$1,46)).mark,2-,32)
- elseif ($2 == timestamp) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1,32) $3 $gettok($sock($addtok(partyline,$1,46)).mark,3-,32)
- elseif ($2 == consolechannel) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-2,32) $3 $gettok($sock($addtok(partyline,$1,46)).mark,4-,32)
- elseif ($2 == consolemode) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-3,32) $3 $gettok($sock($addtok(partyline,$1,46)).mark,5-,32)
- elseif ($2 == idle) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-4,32) $3 $gettok($sock($addtok(partyline,$1,46)).mark,6-,32)
- elseif ($2 == channel) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-5,32) $3 $gettok($sock($addtok(partyline,$1,46)).mark,7-,32)
- elseif ($2 == away) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-6,32) $3-
- }
- alias pl.var {
- if ($2 == echo) return $gettok($sock($addtok(partyline,$1,46)).mark,1,32)
- elseif ($2 == timestamp) return $gettok($sock($addtok(partyline,$1,46)).mark,2,32)
- elseif ($2 == consolechannel) return $gettok($sock($addtok(partyline,$1,46)).mark,3,32)
- elseif ($2 == consolemode) return $gettok($sock($addtok(partyline,$1,46)).mark,4,32)
- elseif ($2 == idle) return $gettok($sock($addtok(partyline,$1,46)).mark,5,32)
- elseif ($2 == channel) return $gettok($sock($addtok(partyline,$1,46)).mark,6,32)
- elseif ($2 == away) return $gettok($sock($addtok(partyline,$1,46)).mark,7-,32)
- }
- alias pl.unset {
- if ($2 == channel) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-5,32) - $gettok($sock($addtok(partyline,$1,46)).mark,7-,32)
- elseif ($2 == away) sockmark $addtok(partyline,$1,46) $gettok($sock($addtok(partyline,$1,46)).mark,1-6,32)
- }
- alias pl.clr sockmark $addtok(partyline,$1,46)
- alias pl.bc {
- set %i 0
- :start
- inc %i
- set %dcnick $gettok($sock(partyline.*,%i),2,46)
- if (%dcnick) {
- if ($pl.var(%dcnick,channel) != $null) {
- if (($gettok($1,2,46) == %dcnick) && ($pl.var(%dcnick,echo) == off)) goto start
- if ($pl.var(%dcnick,channel) == $pl.var($gettok($1,2,46),channel)) {
- if ($pl.var(%dcnick,timestamp) == on) sockwrite -n $addtok(partyline,%dcnick,46) $timestamp $2-
- else sockwrite -n $addtok(partyline,%dcnick,46) $2-
- }
- }
- goto start
- }
- }
- alias pl.fbc {
- set %i 0
- :start
- inc %i
- set %dcnick $gettok($sock(partyline.*,%i),2,46)
- if (%dcnick) {
- if ($chkflag(%dcnick,*,$1)) {
- if ($pl.var(%dcnick,timestamp) == on) sockwrite -n $addtok(partyline,%dcnick,46) $timestamp $2-
- else sockwrite -n $addtok(partyline,%dcnick,46) $2-
- }
- goto start
- }
- }
- alias partychat telnet $ip $sock(telnet).port
- alias pl.whom {
- set %pl.tmp $flags($1)
- if (n isincs %pl.tmp) return * $+ $1
- if (m isincs %pl.tmp) return + $+ $1
- if (o isincs %pl.tmp) return @ $+ $1
- if ($chkflag($1,$pl.var($1,consolechannel),o)) return @ $+ $1
- return $1
- }
- on 1:SOCKCLOSE:partyline.* {
- if ($pl.var($gettok($sockname,2,46),channel) != $null) {
- pl.bc $sockname *** $gettok($sockname,2,46) lost dcc link.
- pl.clr $gettok($sockname,2,46)
- }
- }
- on 1:CHAT:.partyline {
- qctcp $nick DCC CHAT chat $longip($ip) %telnetport
- close -c $nick
- }
- alias pl.checkflags {
- set %tmp.pl.checkflags $addtok(partyline,$1,46)
- if ($sock(%tmp.pl.checkflags)) {
- if ((x !isin $2) && (x isin $3)) {
- sockwrite -n %tmp.pl.checkflags -+- POOF! -+-
- sockwrite -n %tmp.pl.checkflags You now have file area access.
- }
- if ((m !isin $2) && (m isin $3)) {
- sockwrite -n %tmp.pl.checkflags *** POOF! ***
- sockwrite -n %tmp.pl.checkflags You are now a master.
- }
- if ((n !isin $2) && (n isin $3)) {
- sockwrite -n %tmp.pl.checkflags @@@ POOF! @@@
- sockwrite -n %tmp.pl.checkflags You are now an OWNER.
- }
- if ((r !isin $2) && (r isin $3)) {
- sockwrite -n %tmp.pl.checkflags ### POOF! ###
- sockwrite -n %tmp.pl.checkflags You now have REMOTE CONTROL access.
- }
- if ((r isin $2) && (r !isin $3)) {
- sockwrite -n %tmp.pl.checkflags ### POOF! ###
- sockwrite -n %tmp.pl.checkflags You no longer have remote control access.
- }
- if ((n isin $2) && (n !isin $3)) {
- sockwrite -n %tmp.pl.checkflags @@@ POOF! @@@
- sockwrite -n %tmp.pl.checkflags You are no longer an owner.
- }
- if ((m isin $2) && (m !isin $3)) {
- sockwrite -n %tmp.pl.checkflags *** POOF! ***
- sockwrite -n %tmp.pl.checkflags You are no longer a master.
- }
- if ((x isin $2) && (x !isin $3)) {
- sockwrite -n %tmp.pl.checkflags -+- POOF! -+-
- sockwrite -n %tmp.pl.checkflags You no longer have file area access.
- }
- if ((p isin $2) && (p !isin $3)) {
- sockwrite -n %tmp.pl.checkflags -*- POOF! -*-
- sockwrite -n %tmp.pl.checkflags You no longer have party line access.
- .timer 1 0 partyline.boot partyline. $+ $gettok(%owner,1,44) .boot $1 User no longer has party line access.
- }
- }
- set %tmp.pl.checkflags $addtok(remote,$1,46)
- if ($sock(%tmp.pl.checkflags)) {
- if ((r isin $2) && (r !isin $3)) {
- sockwrite -n %tmp.pl.checkflags ### POOF! ###
- sockwrite -n %tmp.pl.checkflags You no longer have remote control access.
- if ($sock($addtok(telnet,$1,46))) sockclose %tmp.pl.checkflags
- else {
- sockwrite -n %tmp.pl.checkflags Returning to interface menu...
- sockrename %tmp.pl.checkflags $addtok(telnet,$1,46)
- tel.login $addtok(telnet,$1,46) .
- }
- }
- }
- }
- on 1:SOCKREAD:su.* {
- if ($sockerr > 0) return
- sockread %su.parse
- if ($sockbr == 0) return
- pl.su $sockname $backspace(%su.parse)
- }
- alias pl.su {
- if ($2 === $password($gettok($1,2,46))) {
- sockwrite $1 $crlf
- sockrename $1 $addtok(partyline,$gettok($1,2,46),46)
- pl.login $addtok(partyline,$gettok($1,2,46),46)
- }
- else {
- sockwrite -n $1 Negative on that, Houston.
- sockrename $1 $addtok(partyline,$gettok($1,3,46),46)
- pl.login $addtok(partyline,$gettok($1,3,46),46)
- }
- }
- on 1:SOCKREAD:remote.* {
- if ($sockerr > 0) return
- sockread %rc.parse
- if ($sockbr == 0) return
- rc.parse $sockname $backspace(%rc.parse)
- }
- alias rc.login {
- iecho Remote control interface with $gettok($1,2,46) initialized.
- sockwrite -n $1 Remote control interface initiated. $+ $crlf $+ Type ".return" to return to the interface menu.
- }
- alias rc.parse {
- if ($2 == .return) {
- sockwrite -n $1 Remote control interface terminated.
- if ($sock($puttok($1,telnet,1,46))) sockclose $1
- else {
- sockwrite -n $1 Returning to interface menu...
- sockrename $1 $puttok($1,telnet,1,46)
- tel.login $puttok($1,telnet,1,46) .
- }
- iecho Remote control interface with $gettok($1,2,46) terminated.
- }
- else $2-
- }
- alias rc.relay {
- set %rc.txt $1-
- if ($gettok(%rc.txt,1,32) isnum) set %rc.txt $deltok(%rc.txt,1,32)
- if ($left($gettok(%rc.txt,1,32),1) == -) set %rc.txt $deltok(%rc.txt,1,32)
- sockwrite -n remote.* %rc.txt
- }
- on 1:SOCKCLOSE:remote.* {
- .timer 1 0 iecho Remote control interface with $gettok($sockname,2,46) terminated.
- }
- on 1:CHAT:.remote {
- qctcp $nick DCC CHAT chat $longip($ip) %telnetport
- close -c $nick
- }
-