This file is indexed.

/usr/share/pyshared/gozerbot/compat/config.py is in gozerbot 0.99.1-2.

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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# gozerbot/config.py
#
#

""" this is where the config dict lives .. use pickle to persist config data
    .. use this pickle on start until the config file has changed  """

__copyright__ = 'this file is in the public domain'

from gozerbot.datadir import datadir
import os, pickle, subprocess

# version string
ver = 'GOZERBOT 0.8.1.1 RELEASE'

def diffdict(dictfrom, dictto):
    """ check for differences between two dicts """
    temp = {}
    for i in dictto.iteritems():
        if dictfrom.has_key(i[0]):
            if dictfrom[i[0]] != i[1]:
                temp.setdefault(i[0], i[1])
        else:
            temp.setdefault(i[0], i[1])
    return temp

class Config(dict):

    """ config object is a dict """

    def __init__(self, ddir, *args, **kw):
        dict.__init__(self, *args, **kw)
        self.dir = str(ddir)
        self['dbtype'] = 'mysql'

    def __getitem__(self, item):
        """ get config item .. return None if not available"""
        if not self.has_key(item):
            return None
        else:
            return dict.__getitem__(self, item)

    def set(self, item, value):
        """ set a config item """
        dict.__setitem__(self, item, value)
        self.save()

    def load(self):
        """ load the config file """
        frompickle = {}
        picklemodtime = None
        # first do reload of the data/config file
        self.reload()
        # see if there is a configpickle
        try:
            picklemodtime = os.stat(self.dir + os.sep + 'configpickle')[8]
            configpickle = open(self.dir + os.sep + 'configpickle', 'r')
            frompickle = pickle.load(configpickle)
            configpickle.close()
        except OSError:
            return
        except:
            pass
        # see if data/config is more recent than the configpickle
        configmodtime = os.stat(self.dir + os.sep + 'config')[8]
        if picklemodtime and picklemodtime > configmodtime:
            # if so update the config dict with the pickled data
            # a = diffdict(self, frompickle)
            self.update(frompickle)
        # set version
        if self['dbenable']:
            self['version'] = ver + ' ' + self['dbtype'].upper()
        else:
            self['version'] = ver
    
    def save(self):
        """ save config data to pickled file """
        picklefile = open(self.dir + os.sep + 'configpickle', 'w')
        pickle.dump(self, picklefile)
        picklefile.close()

    def reload(self):
        """ use execfile to reload data/config """
        try:
            execfile(self.dir + os.sep + 'config', self)
        except IOError:
            self.defaultconfig()
        # remove builtin data
        try:
            del self['__builtins__']
        except:
            pass
        # set version
        if self['dbenable']:
            self['version'] = ver + ' ' + self['dbtype'].upper()
        else:
            self['version'] = ver

    def defaultconfig(self):
        """ init default config values if no config file is found """
        self['loglevel'] = 100
        self['jabberenable'] = 0
        self['ircdisable'] = 0
        self['stripident'] = 1
        self['owneruserhost'] = ['bart@127.0.0.1', ]
        self['nick'] = 'gozerbot'
        self['server'] = 'localhost'
        self['port'] = 6667
        self['ipv6'] = 0
        self['username'] = 'gozerbot'
        self['realname'] = 'GOZERBOT'
        self['defaultcc'] = "!"
        self['nolimiter'] = 0
        self['quitmsg'] = 'http://gozerbot.org'
        self['dbenable'] = 0
        self['udp'] = 0
        self['partyudp'] = 0
        self['mainbotname'] = 'main'
        self['addonallow'] = 0
        self['allowedchars'] = []

configtxt = """# config
#
#

__copyright__ = 'this file is in the public domain'

# gozerdata dir umask
umask = 0700

# logging level .. the higher this value is the LESS the bot logs
loglevel = 10

## jabber section:

jabberenable = 0
jabberowner = 'bartholo@localhost'
jabberhost = 'localhost'
jabberuser = 'gozerbot@localhost'
jabberpass = 'pass'
jabberoutsleep = 0.1

## irc section:

ircdisable = 0

# stripident .. enable stripping of ident from userhost
stripident = 1

# userhost of owner .. make sure this matches your client's userhost
# if it doesn't match you will get an userhost denied message when you
# try to send commands to the bot
owneruserhost = ['bart@127.0.0.1', ]

# the nick the bot tries to use, only used if no nick is set
# otherwise the bot will use the last nick used by the !nick command
nick = 'gozerbot'

# alternick
#alternick = 'gozerbot2'

# server to connect to
server = 'localhost'

# irc port to connect to 
port = 6667

# ircd password for main bot
#password = 'bla'

# ipv6
ipv6 = 0

# bindhost .. uncomment and edit to use
#bindhost = 'localhost'

# bots username
username = 'gozerbot'

# realname
realname = 'GOZERBOT'

# default control character
defaultcc = "!"

# no limiter
nolimiter = 0

# quit message
quitmsg = 'http://gozerbot.org'

# nickserv .. set pass to enable nickserv ident
nickservpass = ""
nickservtxt = ['set unfiltered on', ]

## if you want to use a database:

dbenable = 0 # set to 1 to enable
dbtype = 'mysql' # one of mysql or sqlite
dbname = "gb_db"
dbhost = "localhost"
dbuser = "bart"
dbpasswd = "mekker2"
dboldstyle = False # set to True if mysql database is <= 4.1

## if you want to use udp:

# udp
udp = 0 # set to 1 to enable
partyudp = 0
udpipv6 = 0
udphost = 'localhost'
udpport = 5500
udpmasks = ['192.168*', ]
udpallow = ['127.0.0.1', ]
udpallowednicks = ['#dunkbots', 'dunker']
udppassword = 'mekker'
udpseed = "" # set this to 16 char wide string if you want to encrypt the data
udpstrip = 1 # strip all chars < char(32)
udpsleep = 0 # sleep in sendloop .. can be used to delay packet traffic

# tcp
tcp = 0 # set to 1 to enable
partytcp = 0
tcpipv6 = 0
tcphost = 'localhost'
tcpport = 5500 
tcpmasks = ['192.168*', ]
tcpallow = ['127.0.0.1', ]
tcpallowednicks = ['#dunkbots', 'dunker', 'dunker@jabber.xs4all.nl']
tcppassword = 'mekker'
tcpseed = "bla1234567890bla"
# set this to 16 char wide string if you want to encrypt the data
tcpstrip = 1
tcpsleep = 0   

## other stuff:

# plugin server 
pluginserver = 'http://gozerbot.org'

# upgradeurl .. only needed if mercurial repo changed
#upgradeurl = 'http://gozerbot.org/hg/gozerbot'

# mail related
mailserver = None
mailfrom = None

# collective boot server
collboot = "gozerbot.org:8088"

# name of the main bot
mainbotname = 'main'

# allowed character for strippedtxt
allowedchars = []

# set to 1 to allow addons
addonallow = 0

# enable loadlist
loadlist = 0
"""

def writeconfig():
    """ wtite default config file to datadir/config """
    if not os.path.isfile(datadir + os.sep + 'config'):
        cfgfile = open(datadir + os.sep + 'config', 'w')
        cfgfile.write(configtxt)
        cfgfile.close()

loadlist = """
core
misc
irc
not
grep
reverse
count
chanperm
choice
fleet
ignore
upgrade
job
reload
rest
tail
user
googletalk
all
at
backup
install
reload
tell
reverse
to
underauth
userstate
alias
nickserv
"""

def writeloadlist():
    """ write loadlist to datadir """
    if not os.path.isfile(datadir + os.sep + 'loadlist'):
        cfgfile = open(datadir + os.sep + 'loadlist', 'w')
        cfgfile.write(loadlist)
        cfgfile.close()

# create the config dict and load it from file
#config = Config(datadir)