This file is indexed.

/usr/lib/python2.7/dist-packages/pygopherd/handlers/scriptexec.py is in pygopherd 2.0.18.3+nmu4ubuntu1.

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
# pygopherd -- Gopher-based protocol server in Python
# module: Script execution
# Copyright (C) 2002 John Goerzen
# <jgoerzen@complete.org>
#
#    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; version 2 of the License.
#
#    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


from pygopherd import protocols, gopherentry
from pygopherd.handlers.base import BaseHandler, VFS_Real
from pygopherd.handlers.virtual import Virtual
import pygopherd.pipe
from stat import *
import imp, re, os

class ExecHandler(Virtual):
    def canhandlerequest(self):
        # We ONLY handle requests from the real filesystem.
        return isinstance(self.vfs, VFS_Real) and \
               self.statresult and S_ISREG(self.statresult[ST_MODE]) and \
               (S_IMODE(self.statresult[ST_MODE]) & S_IXOTH)
        
    def getentry(self):
        entry = gopherentry.GopherEntry(self.getselector(), self.config)
        entry.settype('0')
        entry.setname(os.path.basename(self.getselector()))
        entry.setmimetype('text/plain')
        entry.setgopherpsupport(0)
        return entry

    def write(self, wfile):
        # We work on a separate thing to avoid contaminating our own
        # environment.  Just saying newenv = os.environ would still
        # do that.
        newenv = {}
        for key in os.environ.keys():
            newenv[key] = os.environ[key]
        newenv['SERVER_NAME'] = self.protocol.server.server_name
        newenv['SERVER_PORT'] = str(self.protocol.server.server_port)
        newenv['REMOTE_ADDR'] = self.protocol.requesthandler.client_address[0]
        newenv['REMOTE_PORT'] = str(self.protocol.requesthandler.client_address[1])
        newenv['REMOTE_HOST'] = newenv['REMOTE_ADDR']
        newenv['SELECTOR'] = self.selector
        newenv['REQUEST'] = self.getselector()
        if self.searchrequest:
            newenv['SEARCHREQUEST'] = self.searchrequest
        wfile.flush()

        args = [self.getfspath()]
        if self.selectorargs:
            args.extend(self.selectorags.split(' '))

        pygopherd.pipe.pipedata(self.getfspath(), args, newenv,
                                childstdout = wfile)