This file is indexed.

/usr/share/sbnc/scripts/telnet.tcl is in sbnc-tcl 1.3.9-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# shroudBNC - an object-oriented framework for IRC
# Copyright (C) 2005-2014 Gunnar Beutner
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

set ::userport 7080

catch [list listen $::userport script sbnc:telnet] error

proc sbnc:telnet {socket} {
	sbnc:telnetbanner $socket
	control $socket sbnc:telnetmsg
}

proc sbnc:telnetbanner {socket} {
	global telnetusers

	putdcc $socket "Welcome to the shroudBNC partyline"
	putdcc $socket "Bot:"
	set telnetusers($socket) [list]
}

proc sbnc:telnet2text {input} {
	set out [list]

	for {set i 0} {$i < [string length $input]} {incr i} {
		set chr [string index $input $i]

		if {[scan $chr "%c"] == 255} {
			incr i 2
		} else {
			lappend out $chr
		}
	}

	return [join $out ""]
}

proc sbnc:telnetmsg {socket line} {
	global telnetusers

	if {$line == ""} { return }

	set line [sbnc:telnet2text $line]
	set word [lindex [split $line] 0]

	set user $telnetusers($socket)

	if {$user == ""} {
		set telnetusers($socket) [list -1 $word]

		putdcc $socket "Username:"
	} elseif {[lindex $user 0] == -1} {
		set telnetusers($socket) [list 0 [lindex $user 1] $word]

		putdcc $socket "Password:"
	} elseif {[lindex $user 0] == 0} {
		setctx [lindex $user 1]

		if {[passwdok [lindex $user 2] $word]} {
			set telnetusers($socket) [list 1 [lindex $user 1] [lindex $user 2]]

			putdcc $socket "You are now logged in as [lindex $user 2]."
		} else {
			putdcc $socket "Wrong username or password. You are being disconnected."
			utimer 1 [list killdcc $socket]
		}
	} else {
		setctx [lindex $user 1]
		set result [sbnc:telnetcmd $socket [lindex $user 1] [lindex $user 2] $line]

		if {$result != ""} {
			putdcc $socket $result
		}
	}
}

proc sbnc:telnetcmd {socket bot user line} {
	set toks [split $line]

	if {[string index $line 0] == "."} {
		set command [string range [lindex [split $line] 0] 1 end]
	} else {
		return ""
	}

	set count [sbnc:callbinds "dcc" $user "" $command $user $socket [join [lrange [split $line] 1 end]]]

	if {$count < 1} {
		return "Not yet implemented."
	} else {
		return ""
	}
}

# dcc commands
bindall dcc n tcl dcc:tcl
bindall dcc - quit dcc:quit

proc dcc:quit {handle idx text} {
	putdcc $idx "Bye."

	utimer 2 [list killdcc $idx]
}

proc dcc:tcl {handle idx text} {
	set ctx [getctx]
	catch {eval $text} result
	setctx $ctx

	if {$result == ""} { set result "<null>" }
	foreach sline [split $result \n] {
		putdcc $idx "( $text ) = $sline"
	}
}