This file is indexed.

/usr/share/pyshared/gplugs/gcalc.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
# plugins/gcalc.py
# encoding: utf-8

__copyright__ = 'This file is in the public domain'

from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
from gozerbot.aliases import aliasset

import urllib, urllib2, json, re

url = "http://www.google.com/ig/calculator?oe=utf-8&q="

plughelp.add('gcalc', 'use the google calculator')

def handle_gcalc(bot, ievent):
    if len(ievent.args) > 0:
        expr = " ".join(ievent.args)
    else:
        ievent.missing('Missing an expression')
        return

    try:
	response = urllib2.urlopen(url + urllib.quote_plus(expr)) 
    except IOError:
	ievent.reply('request failed')
	return

    try:
	data = response.read()
	# keys quotes fixup
	data = re.sub("(['\"])?([a-zA-Z0-9]+)(['\"])?:", '"\\2":', data)
	result = json.loads(data)
    except ValueError:
	ievent.reply('decoding failed')
	return

    if result['error']:
        ievent.reply('request failed: ' + result['error'])
    else:
        ievent.reply("%s = %s" % (result['lhs'], result['rhs']))
    return

cmnds.add('gcalc', handle_gcalc, 'USER')
examples.add('gcalc', 'Calculate an expression using the google calculator', 'gcalc 1 + 1')
aliasset('calc', 'gcalc')

#tests.add('gcalc 1 + 1')