spam-report.pl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/usr/bin/perl -wT
  2. require 5.001;
  3. use strict;
  4. use CGI;
  5. umask 002;
  6. my $input = new CGI;
  7. # sanity checks
  8. my $sane = 1;
  9. # list name could be tighter: only lowercase or only existing list
  10. $sane &&= ($input->param('listname') =~ /^[0-9a-z\-]+$/);
  11. $sane &&= ($input->param('date') =~ /^\d{4}\/(\d{2})?$/);
  12. $sane &&= ($input->param('msg') =~ /^msg\d+\.html$/);
  13. my $message;
  14. my $title;
  15. if ($sane) {
  16. # log all connections that present sane input
  17. my $logfile = '/org/lists.debian.org/spam-log/spam-report.log';
  18. open (LOG, ">>$logfile") ;
  19. my $time = time;
  20. print LOG "time: $time; ";
  21. #if (exists $ENV{'REMOTE_HOST'}) {
  22. # print LOG "host: $ENV{'REMOTE_HOST'}; addr: $ENV{'REMOTE_ADDR'} sub_cnt: $#subscribe unsub_cnt: $#unsubscribe: email: $user_email\n";
  23. #} else {
  24. print LOG "addr: $ENV{'REMOTE_ADDR'}; list: ".$input->param('listname').", date: ".$input->param('date').", msg: ".$input->param('msg')."\n";
  25. #}
  26. close LOG;
  27. $message = <<SUCCESS
  28. <h2>Report accepted</h2>
  29. <p>
  30. Thank you for reporting this email as a potential spam message. Scores are reviewed regularly, and are used to mark emails as spam.
  31. </p>
  32. SUCCESS
  33. ;
  34. $title = 'Email status recorded';
  35. }
  36. else {
  37. $message = <<ERRMSG
  38. <h2>An error occurred</h2>
  39. <p>
  40. Unfortunately, your report could not be recorded. Please try again or contact the listmasters.
  41. </p>
  42. ERRMSG
  43. ;
  44. }
  45. print $input->header;
  46. print $input->start_html(-title=>$title, -style=>{ -src => ['/debian.css','/debian-en.css']});
  47. print <<BLAH
  48. <div id="header">
  49. <div id="upperheader">
  50. <div id="logo">
  51. <a href="/"><img src="/Pics/openlogo-50.png" width="50" height="61" alt=""></a>
  52. </div> <!-- end logo -->
  53. </div> <!-- end upperheader -->
  54. <!--UdmComment-->
  55. <div id="navbar">
  56. <p class="hidecss"><a href="#inner">Skip Quicknav</a></p>
  57. <ul>
  58. <li><a href="http://www.debian.org/intro/about">About Debian</a></li>
  59. <li><a href="http://www.debian.org/distrib/">Getting Debian</a></li>
  60. <li><a href="http://www.debian.org/support">Support</a></li>
  61. <li><a href="http://www.debian.org/devel/">Developers'&nbsp;Corner</a></li>
  62. </ul>
  63. </div> <!-- end navbar -->
  64. <p id="breadcrumbs"><a href="/">mailing lists </a>/ Spam Report accepted </p>
  65. </div> <!-- end header -->
  66. <div id="content">
  67. <div class="index_include">
  68. $message
  69. <p><hr noshade width="100%" size="1">
  70. Back to:
  71. <a href="http://www.debian.org/">Debian Project homepage</a> ||
  72. <a href="/">Debian mailing lists</a>
  73. <hr noshade width="100%" size="1">
  74. <p><small>You may <a href="http://www.debian.org/Bugs/Reporting">submit bugs</a>
  75. against the list archives using the
  76. <a href="http://bugs.debian.org/listarchives"><var>listarchives</var>
  77. pseudo-package</a> or contact the maintainer at
  78. <a href="mailto:listarchives\@debian.org">listarchives\@debian.org</a>.
  79. The scripts which generate the archives are
  80. <a href="http://packages.debian.org/unstable/web/lists-archives.html">available</a>
  81. under the GPL.</small></p>
  82. <p><small>See the Debian <a href="http://www.debian.org/contact">contact
  83. page</a> for further information on contacting us.</small></p>
  84. </div>
  85. </div>
  86. BLAH
  87. ;
  88. print $input->end_html;
  89. exit 0;