This file is indexed.

/usr/bin/chronicle-ping is in chronicle 4.6-2.

This file is owned by root:root, with mode 0o755.

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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#!/usr/bin/perl -w

=head1 NAME

chronicle-ping - Send outgoing PING requests for new pages.

=cut

=head1 SYNOPSIS

  Help Options

    --help        Show a brief help overview.
    --version     Show the version of this script.

  Mandatory Options

    --url         The URL of the entry to ping.
    --service     The URL of the service to ping.

  Misc Options

    --name        The name of the blog.

=cut

=head1 ABOUT

This script is designed to receive an URL as its argument, and make an
outgoing ping for it.

If a service URL (pointing to an XML-RPC end-point) is specified it will
be used, otherwise the ping will be made to a number of default sites.

=cut

=head1 AUTHOR

 Steve
 --
 http://www.steve.org.uk/

=cut

=head1 LICENSE

Copyright (c) 2010 by Steve Kemp.  All rights reserved.

This module is free software;
you can redistribute it and/or modify it under
the same terms as Perl itself.
The LICENSE file contains the full text of the license.

=cut



use strict;
use warnings;


use Getopt::Long;
use Pod::Usage;
use XMLRPC::Lite;



#
# The default sites to ping if no service is specified.
#
my %default = (

    # See http://codex.wordpress.org/Update_Services for
    # a more comprehensive list.
    'Blog People'   => 'http://www.blogpeople.net/servlet/weblogUpdates',
    'Blog Update'   => 'http://blogupdate.org/ping/',
    'BlogRolling'   => 'http://rpc.blogrolling.com/pinger/',
    'Google'        => 'http://blogsearch.google.com/ping/RPC2',
    'Moreover'      => 'http://api.moreover.com/RPC2',
    'NewsGator'     => 'http://services.newsgator.com/ngws/xmlrpcping.aspx',
    'Ping-o-Matic!' => 'http://rpc.pingomatic.com/',
    'Syndic8'       => 'http://ping.syndic8.com/xmlrpc.php',
    'Weblogs.com'   => 'http://rpc.weblogs.com/RPC2',
);


#
#  Parse command line arguments
#
my %CONFIG = parseCommandLineArguments();


#
#  Validate and update our arguments
#
validateOptions();


#
#  Perform the ping
#
ping( $CONFIG{ 'service' } );



=begin doc

Parse the command line options we expect to receive.

=end doc

=cut

sub parseCommandLineArguments
{
    my $HELP   = 0;
    my $MANUAL = 0;

    my %options;

    if (
        !GetOptions(

            # help options
            "help",    \$HELP,
            "manual",  \$MANUAL,
            "verbose", \$options{ 'verbose' },

            # mandatory options
            "url=s",     \$options{ 'url' },
            "service=s", \$options{ 'service' },

            # misc
            "name=s", \$options{ 'name' },
        ) )
    {
        exit 1;
    }


    pod2usage(1) if $HELP;
    pod2usage( -verbose => 2 ) if $MANUAL;

    return (%options);
}



=begin doc

Ensure our options look sane.

=end doc

=cut

sub validateOptions
{

    #
    #  Ensure we received the mandatory arguments
    #
    if ( !defined( $CONFIG{ 'url' } ) )
    {
        print "Missing argument --url\n";
        exit 1;
    }


    #
    #  If we don't have a title use the name
    #
    if ( !$CONFIG{ 'name' } )
    {
        $CONFIG{ 'name' } = $CONFIG{ 'url' };
    }

    #
    #  If we have a service make sure it looks like an URL
    #
    if ( ( $CONFIG{ 'service' } ) &&
         ( $CONFIG{ 'service' } !~ /^https?:\/\// ) )
    {
        print "Your ping service looks unlike an URL\n";
        exit 1;
    }
}


=begin doc

Send a ping for the given service, reverting to all our known ping sites
if one isn't specified.

=end doc

=cut

sub ping
{
    my ($service) = (@_);

    #
    #  If we don't have a service specified then use each of our
    # default ones in turn.
    #
    if ( !defined($service) )
    {
        foreach my $name ( keys %default )
        {
            $CONFIG{ 'verbose' } && print "Sending ping via $name\n";
            send_ping( $default{ $name }, $CONFIG{ 'url' } );
        }
    }
    else
    {
        $CONFIG{ 'verbose' } && print "Sending ping via $service\n";
        send_ping( $service, $CONFIG{ 'url' } );
    }
}



=begin doc

Send a ping for the given URL to the specified RPC end-point.

Report errors liberally.

=end doc

=cut

sub send_ping
{
    my ( $rpc, $url ) = (@_);

    print "Sending to $rpc\n";

    my $xmlrpc = XMLRPC::Lite->proxy($rpc);
    my $call;
    eval {
        $call = $xmlrpc->call( 'weblogUpdates.ping', $CONFIG{ 'name' }, $url );
    };
    if ($@)
    {
        chomp $@;
        warn "\tPing to $url failed: '$@'\n";
        next;
    }

    unless ( defined $call )
    {

        warn "\tPing $url failed for an unknown reason\n";
        next;
    }

    if ( $call->fault )
    {

        chomp( my $message = $call->faultstring );
        warn "\tPing to $url failed: '$message'\n";
        next;
    }

    my $result = $call->result;
    if ( $result->{ flerror } )
    {

        warn "\tPing to $url returned the following error: '",
          $result->{ message }, "'\n";
        next;
    }

    print "\tPing $url returned: '$result->{ message }'\n";
}