This file is indexed.

/usr/share/pp-popularity-contest/cron.daily is in pp-popularity-contest 1.0.6-1ubuntu1.

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
#!/usr/bin/perl -T
use strict;
use URI::Escape;
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};   # Make %ENV safer
$ENV{PATH} = '/usr/bin:/bin';

my $dbg = ( $ENV{DEBUG} ? 1 : 0 );
my $spooldir = '/var/spool/pp-popcon';

# don't run if this package is removed but not purged
if( !-f "/usr/bin/pp_popcon_cnt" || !-d $spooldir ) { if($dbg){ die("no /usr/bin/pp_popcon_cnt || no $spooldir"); }; exit 0; }

# usage stats are in files in $spooldir
my $dh;
if( !opendir( $dh, $spooldir ) ){ if($dbg){ die("could not opendir $spooldir: $!"); } exit(0); }
my @statfiles = readdir( $dh ); closedir( $dh );

foreach my $statfile (@statfiles)
{
  if( substr( $statfile, 0, 1 ) eq '.' ){ next; }

  if( $statfile =~ /[^[:alnum:]._-]/o ){ if($dbg){ die("invalid statfile name '$statfile'"); } next; }
     $statfile =~ /^([[:alnum:]._-]+)$/o; $statfile = $1;

  my $statfilepath = "$spooldir/$statfile";
  my $statfilesince = "$spooldir/.$statfile";

  my $count = [ stat( $statfilepath ) ]->[7]; # size
  my $program = $statfile;
  my $since = _unixtime_to_gmtime( [ stat( $statfilesince ) ]->[9] || 1262300400 ); # mtime, default '2010-01-01'

  # transfer usage stats with curl
  if( !$since || !$program || !defined($count) ){ if($dbg){ die("something is invalid: '$since' '$program' '$count'"); } next; }

  if( $count )
  {
    my $curl_cmd = "curl -G --location --max-time 60 --silent --write-out '%{http_code}' --data 'since=".uri_escape($since)."' --data 'program=".uri_escape($program)."' --data 'count=".uri_escape($count)."' ".( $dbg ? '' : ' --output /dev/null' )." http://131.159.28.73/popcon.php 2>&1";

    my $http_response_code = `$curl_cmd`;

    if( $http_response_code eq '200' )
    {
      # reset stats after successful report
      truncate( $statfilepath, 0 );
      system( 'touch', $statfilesince );
    }
    elsif( $dbg ){ die("failed '$curl_cmd': '$http_response_code'"); }
  }
}

exit 0;

sub               _unixtime_to_gmtime
{
  my( $__utime ) = @_;

  my $a = [ gmtime( $__utime ) ];

  return ($a->[5]+1900)."-".($a->[4]+1)."-$a->[3] $a->[2]:$a->[1]:$a->[0]";
}

# vim:et:ts=2: