This file is indexed.

/usr/share/perl5/Scrappy/Plugin/RandomProxy.pm is in libscrappy-perl 0.94112090-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
package Scrappy::Plugin::RandomProxy;

BEGIN {
    $Scrappy::Plugin::RandomProxy::VERSION = '0.94112090';
}

use Moose::Role;

has proxy_address => (
    is  => 'rw',
    isa => 'Str'
);

has proxy_protocol => (
    is      => 'rw',
    isa     => 'Str',
    default => 'HTTP'
);

has proxy_list => (
    is      => 'rw',
    isa     => 'ArrayRef',
    default => sub { [] }
);

sub get_proxy_list {
    my $self = shift;

    # fetch list of HTTP proxies unless already gathered
    unless ($self->proxy_list) {

        # get a proxy from http://www.hidemyass.com/proxy-list/
        $self->user_agent->random_user_agent;

        # goto hidemyass.com
        $self->get('http://www.hidemyass.com/proxy-list/');

        # special post to get HTTP-80 proxies only
        my %headers = (
            'Content-Type' => 'application/x-www-form-urlencoded',
            'Referer'      => 'http://www.hidemyass.com/proxy-list/'
        );
        my $form = {
            'c[]' => [
                'United States',        'Indonesia',
                'China',                'Brazil',
                'Russian Federation',   'Iran, Islamic Republic of',
                'Germany',              'India',
                'Korea, Republic of',   'Kazakhstan',
                'Ukraine',              'Japan',
                'Colombia',             'Thailand',
                'Egypt',                'Taiwan',
                'Spain',                'Canada',
                'Argentina',            'Poland',
                'Czech Republic',       'Turkey',
                'South Africa',         'Venezuela',
                'France',               'Netherlands',
                'Peru',                 'Vietnam',
                'Mexico',               'Switzerland',
                'Bulgaria',             'Kenya',
                'Ecuador',              'Latvia',
                'Portugal',             'Slovakia',
                'Chile',                'Italy',
                'Denmark',              'Moldova, Republic of',
                'United Kingdom',       'Greece',
                'Norway',               'Israel',
                'Hungary',              'Nigeria',
                'Ireland',              'Australia',
                'Hong Kong',            'Finland',
                'Philippines',          'United Arab Emirates',
                'Ghana',                'Bangladesh',
                'Lebanon',              'Romania',
                'Syrian Arab Republic', 'Austria',
                'Sri Lanka',            'Serbia',
                'Sweden',               'Macau',
                'Iraq',                 'Malaysia',
                'Macedonia',            'Malta',
                'Jamaica',              'Niger',
                'Belarus',              'Bahamas',
                'Antarctica',           'Bosnia and Herzegovina',
                'Mozambique',           'Benin',
                'Grenada',              "Cote D'Ivoire",
                'Mauritania',           'Brunei Darussalam',
                'Ethiopia',             'Pakistan',
                'Chad',                 'Paraguay',
                'Puerto Rico',          'Cambodia',
                'Singapore',            'Guatemala',
                'Fiji',                 'Croatia',
                'Kuwait',               'Palestinian Territory',
                'Albania',              'Zimbabwe',
                'Bolivia',              'Maldives',
                'Luxembourg'
            ],
            'pr[]' => ['0'],
            'a[]'  => ['2', '3', '4'],
            p      => '80',
            pl     => 'on',
            s      => '0',
            o      => '0',
            pp     => '3',
            ac     => 'on',
            sortBy => 'date'
        };
        $self->post('http://www.hidemyass.com/proxy-list/', $form, %headers);

        my @proxies = ();
        my $rows    = $self->select('#proxylist-table tr.row')->data;

        foreach my $row (@{$rows}) {
            my $cols = $self->select('td', $row->{html})->data;
            my ($server, $port, $type) =
              ($cols->[1]->{text}, 80, $cols->[6]->{text});
            if ($type eq 'HTTP') {
                push @proxies, "$server:$port";
            }
        }

        $self->proxy_list([@proxies]);
        $self->log(
            "info",
            "Proxy list created from hidemyass.com",
            proxy_list => [@proxies]
        );
    }

    return $self;
}

sub use_random_proxy {
    my $self = shift;

    $self->get_proxy_list;

    # select and use a random a proxy
    my @proxies = @{$self->proxy_list};
    my $proxy   = $proxies[rand(@proxies)];

    $self->proxy_address($proxy);
    $self->proxy('http', 'http://' . $proxy . '/');
    $self->log("info", "Proxy has been set to $proxy using the HTTP protocol");

    return $self;
}

1;