/usr/share/pnopaste/index.pl is in pnopaste 1.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 | #!/usr/bin/perl
# This file is part of the pnopaste program
# Copyright (C) 2008-2016 Patrick Matthäi <pmatthaei@debian.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; either version 2 of the License, or
# (at your option) any later version.
use warnings;
no warnings 'once';
use strict;
use Cwd;
use lib cwd;
use CGI qw/:standard/;
use lib::Code;
use lib::HTML;
use lib::Security;
use lib::Highlighting;
use lib::Expire;
# CGI class.
my $CGI = new CGI;
# Security settings for the cgi module.
$CGI::DISABLE_UPLOADS = 1;
$CGI::POST_MAX = 83886080;
# Start the application.
Main();
### Main function - it decides where we go.
sub Main {
my $Full_URL = $CGI->url(-full => 1);
my $Remote_Addr = $CGI->remote_host();
if(!defined $Full_URL){
$Full_URL = 'none';
}
if(!defined $Remote_Addr){
$Remote_Addr = 'none';
}
# Block all banned IPs directly.
if(Security::Blacklist_Host($Remote_Addr) == 1){
HTML::Error(2);
}
#Clean up database from expired entries.
if(Expire::Get_Cleanup()){
Expire::Delete_Old_Entrys();
}
# Get all GET parameters.
my $Params = $CGI->url_param('keywords');
# Seems like someone wants a code.
if($Params and $Params =~ /^\d/){
my $Download = 0;
if($Params =~ /download$/){
$Download = 1;
}
$Params =~ s/^\D*?(\d+).*$/$1/;
$Params = int($Params);
HTML::Code($Params, $Download, $Full_URL);
}
# New code comes in.
elsif($CGI->param('code')){
# Get POST parameters.
my $Code = $CGI->param('code') || '';
my $Desc = $CGI->param('description') || '';
my $Name = $CGI->param('name') || '';
my $Expi = $CGI->param('expires') || $Expire::Standard;
my $Synt = $CGI->param('language') || 'Plain';
Code::Add($Code, $Desc, $Name, $Expi, $Synt, $Remote_Addr, $Full_URL);
}
else {
# Else just show the add page.
HTML::Add($Full_URL);
}
}
1;
|