This file is indexed.

/usr/share/php/Text/CAPTCHA.php is in php-text-captcha 1.0.2-2ubuntu1.

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
<?php
/**
 * Text_CAPTCHA - creates a CAPTCHA for Turing tests.
 * Base class file for using Text_CAPTCHA.
 *
 * PHP version 5
 *
 * @category Text
 * @package  Text_CAPTCHA
 * @author   Christian Wenz <wenz@php.net>
 * @license  http://www.opensource.org/licenses/bsd-license.php BSD License
 * @link     http://pear.php.net/package/Text_CAPTCHA
 */
/**
 * Require Exception class for error handling.
 */
require_once 'Text/CAPTCHA/Exception.php';
/**
 * Require Text_Password class for generating the phrase.
 */
require_once 'Text/Password.php';

/**
 * Text_CAPTCHA - creates a CAPTCHA for Turing tests.
 * Class to create a Turing test for websites by creating an image, ASCII art or
 * something else with some (obfuscated) characters.
 *
 * @category Text
 * @package  Text_CAPTCHA
 * @author   Christian Wenz <wenz@php.net>
 * @author   Michael Cramer <michael@bigmichi1.de>
 * @license  http://www.opensource.org/licenses/bsd-license.php BSD License
 * @link     http://pear.php.net/package/Text_CAPTCHA
 */
class Text_CAPTCHA
{
    /**
     * driver for Text_CAPTCHA
     *
     * @var Text_CAPTCHA_Driver_Base
     */
    private $_driver;

    /**
     * check if an initial driver init was done.
     *
     * @var bool
     */
    private $_driverInitDone = false;

    /**
     * Constructor for the TEXT_CAPTCHA object with the given driver.
     *
     * @param Text_CAPTCHA_Driver $driver driver
     *
     * @throws Text_CAPTCHA_Exception no driver given
     */
    function __construct($driver)
    {
        if (is_null($driver)) {
            throw new Text_CAPTCHA_Exception("No driver given");
        }
        $this->_driver = $driver;
        $this->_driverInitDone = false;
    }

    /**
     * Create a new Text_CAPTCHA object.
     *
     * @param string $driver name of driver class to initialize
     *
     * @return Text_CAPTCHA a newly created Text_CAPTCHA object
     * @throws Text_CAPTCHA_Exception when driver could not be loaded
     *
     */
    public static function factory($driver)
    {
        $driver = basename($driver);
        $class = 'Text_CAPTCHA_Driver_' . $driver;
        $file = str_replace('_', '/', $class) . '.php';
        //check if it exists and can be loaded
        if (!@fclose(@fopen($file, 'r', true))) {
            throw new Text_CAPTCHA_Exception(
                'Driver ' . $driver . ' cannot be loaded.'
            );
        }
        //continue with including the driver
        include_once $file;

        $driver = new $class;

        return new Text_CAPTCHA($driver);
    }

    /**
     * Create random CAPTCHA phrase
     *
     * @param boolean|string $newPhrase new Phrase to use or true to generate a new
     *                                  one
     *
     * @return void
     * @throws Text_CAPTCHA_Exception when driver is not initialized
     */
    public final function generate($newPhrase = false)
    {
        if (!$this->_driverInitDone) {
            throw new Text_CAPTCHA_Exception("Driver not initialized");
        }
        if ($newPhrase === true || is_null($this->_driver->getPhrase())) {
            $this->_driver->createPhrase();
        } else if (strlen($newPhrase) > 0) {
            $this->_driver->setPhrase($newPhrase);
        }
        $this->_driver->createCAPTCHA();
    }

    /**
     * Reinitialize the entire Text_CAPTCHA object.
     *
     * @param array $options Options to pass in.
     *
     * @return void
     */
    public final function init($options = array())
    {
        $this->_driver->resetDriver();
        $this->_driver->initDriver($options);
        $this->_driverInitDone = true;
        $this->generate();
    }

    /**
     * Place holder for the real getCAPTCHA() method used by extended classes to
     * return the generated CAPTCHA (as an image resource, as an ASCII text, ...).
     *
     * @return string|object
     */
    public final function getCAPTCHA()
    {
        return $this->_driver->getCAPTCHA();
    }

    /**
     * Return secret CAPTCHA phrase.
     *
     * @return string secret phrase
     */
    public final function getPhrase()
    {
        return $this->_driver->getPhrase();
    }
}