This file is indexed.

/usr/share/pyshared/gplugs/hexjoin.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
# plugs/hexonjoin.py
#
#

from gozerbot.callbacks import callbacks
from gozerbot.persist.persistconfig import PersistConfig
from gozerbot.aliases import aliasset
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests

import struct, socket

plughelp.add('hexjoin', 'show ip and hostname from user joining a channel')

cfg = PersistConfig()
cfg.define('channels', [])

def hexjoin(bot, ievent):
    what = ievent.user
    ip = None
    try:
        ipint = int(what, 16)
        ipint = socket.ntohl(ipint)
        packed = struct.pack('l', ipint)
        ip = socket.inet_ntoa(str(packed))
    except Exception, ex:
        return
    try:
        hostname = socket.gethostbyaddr(ip)[0]
    except:
        if ip:
            bot.say(ievent.channel, '%s is on %s' % (ievent.nick, ip))
            return
    bot.say(ievent.channel, '%s is on %s' % (ievent.nick, hostname))

def prehexjoin(bot , ievent):
    if not len(ievent.user) == 8:
        return 0
    try:
        int(ievent.user, 16)
    except ValueError:
        return 0
    if (bot.name, ievent.channel) in cfg.get('channels'):
        return 1

callbacks.add('JOIN', hexjoin, prehexjoin)

def handle_hexjoinenable(bot, ievent):
    cfg.append('channels', (bot.name, ievent.channel))
    ievent.reply('%s channel added' % ievent.channel)

cmnds.add('hexjoin-enable', handle_hexjoinenable, 'OPER')
examples.add('hexjoin-enable', 'enable hexjoin in the channel the command is \
given in', 'hexjoin-enable')
tests.add('hexjoin-enable', 'channel added')

def handle_hexjoindisable(bot, ievent):
    try:
        cfg.remove('channels', (bot.name, ievent.channel))
        ievent.reply('%s channel removed' % ievent.channel)
    except ValueError:
        ievent.reply('%s channel is not in channels list' % ievent.channel)

cmnds.add('hexjoin-disable', handle_hexjoindisable, 'OPER')
examples.add('hexjoin-disable', 'disable hexjoin in the channel this command \
is given in', 'hexjoin-disable')
tests.add('hexjoin-disable', 'channel')