Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Paste Description for nettezzaumana

> cat `which _pastebin.pl ` | _pastebin.pl -t perl -n nettezzaumana

nettezzaumana
Sunday, November 7th, 2010 at 12:52:15pm UTC 

  1. #!/usr/bin/perl
  2. ## Script for posting command's output directly from command line.
  3. ## i wrote this script to be able use it on solaris operating system without
  4. ## installing any exotic or not core perl modules (.pm)
  5. ##
  6. ## script has just one dependency: wget knowing option --post-file= ..
  7. ##
  8. ## This script is written in "compat" way, so as mentioned above, no additional .pms
  9. ## are used, so this script should work almost everywhere with perl.
  10. ##
  11. ## author: dpecka[at]opensuse[dot]org
  12. ## enjoy !!
  13.  
  14. ## This Software is released under: 3-clause license ("New BSD License")
  15. ##
  16. ## Copyright (c) 2010, Daniel Pecka
  17. ## All rights reserved.
  18. ##
  19. ## Redistribution and use in source and binary forms, with or without
  20. ## modification, are permitted provided that the following conditions are met:
  21. ##     * Redistributions of source code must retain the above copyright
  22. ##      notice, this list of conditions and the following disclaimer.
  23. ##    * Redistributions in binary form must reproduce the above copyright
  24. ##      notice, this list of conditions and the following disclaimer in the
  25. ##      documentation and/or other materials provided with the distribution.
  26. ##    * Neither the name of the organization nor the
  27. ##      names of its contributors may be used to endorse or promote products
  28. ##      derived from this software without specific prior written permission.
  29. ##
  30. ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  31. ## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  32. ## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. ## DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  34. ## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  35. ## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  36. ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  37. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  39. ## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. ##
  41.  
  42.  
  43. use strict;
  44. use warnings;
  45.  
  46. sub usage {
  47.         print STDERR << 'EOF';
  48. Usage: foo | pastebin.sh [-f] [-t type] [-d description] [-e expiration] [-n name]
  49. -f      exploit pastebin.ca even if input have less then 5 lines
  50. -t      expects one from types listed below
  51. -d      short paste description
  52. -e      expire in time, default is "never", you can choose from list below (m=minutes,h=hours ..)
  53. -n      alternate nick, default is your $USER enviroment variable
  54. -h      this help message thrown to /dev/stderr
  55.  
  56. escape white characters in name and description string ..
  57.  
  58. Types:  action ada apache asm asp asterisk bash c c# c++ css delphi diff
  59.         html java javascript lisp lua mirc nasm net objc pascal patch perl
  60.         php pli python raw ruby scheme sql vbs xml
  61.  
  62. Expire: 5m 10m 15m 30m 45m 1h 2h 4h 8h 12h
  63.         1d 2d 3d 1w 2w 3w 1mn 2mn 3mn 4mn 5mn 6mn 1y
  64. EOF
  65.         exit 2;
  66. };
  67.  
  68. ## several checks .. we need to know if we have sufficient wget
  69. my $wpath;
  70.  
  71. sub checks {
  72.         chomp($wpath = `which wget 2>/dev/null`);
  73.         die "can't find wget within your \$PATH, it's over ..\n" if ! -x "$wpath";
  74.         chomp(my $winfo = `$wpath --help | grep post-file=`);
  75.         die "it seems like your wget has not option --post-file=, it's over ..\n" if ! "$winfo";
  76.  
  77. };
  78.  
  79. ## parses cli and assigns a base vars
  80. my($pforc, $ptype, $pdesc, $pexpi, $puser);
  81.  
  82. $pforc = "false";
  83. $ptype = 33;
  84. $pdesc = "";
  85. $pexpi = "";
  86. $puser = $ENV{"USER"};
  87.  
  88. sub parse_cli {
  89.         return 0 if ! @ARGV;
  90.         while(@ARGV) {
  91.                 $_ = shift(@ARGV);
  92.                 if(/^-f$/) { $pforc="true"; next; };
  93.  
  94.                 if(/^-t$/) {
  95.                         $ptype = shift(@ARGV);
  96.                         $ptype =~ y/[A-Z]/[a-z]/;
  97.                         my %types = (   raw              => "1",
  98.                                         asterisk        => "2",
  99.                                         c              => "3",
  100.                                         "c++"      => "4",
  101.                                         php          => "5",
  102.                                         perl        => "6",
  103.                                         java        => "7",
  104.                                         vbs          => "8",
  105.                                         "c#"        => "9",
  106.                                         ruby        => "10",
  107.                                         python    => "11",
  108.                                         pascal    => "12",
  109.                                         mirc        => "13",
  110.                                         pli          => "14",
  111.                                         xml          => "15",
  112.                                         sql          => "16",
  113.                                         scheme    => "17",
  114.                                         action    => "18",
  115.                                         ada          => "19",
  116.                                         apache    => "20",
  117.                                         nasm        => "21",
  118.                                         asp          => "22",
  119.                                         bash        => "23",
  120.                                         css          => "24",
  121.                                         delphi    => "25",
  122.                                         html        => "26",
  123.                                         javascript      => "27",
  124.                                         lisp        => "28",
  125.                                         lua          => "29",
  126.                                         asm          => "30",
  127.                                         objc        => "31",
  128.                                         net          => "32",
  129.                                         diff        => "33",
  130.                                         patch      => "33",
  131.                                         );
  132.  
  133.                         if(!grep(/^$ptype$/, keys(%types))) {
  134.                                 print STDERR "bad type: $ptype\n";
  135.                                 die "choose one from: ", join(" ", sort(keys(%types))), "\n";
  136.                         };
  137.                         $ptype = $types{"$ptype"};
  138.                         next;
  139.                 };
  140.  
  141.                 if(/^-d$/) {
  142.                         $pdesc = shift(@ARGV);
  143.                         $pdesc =~ s/%/%25/g;
  144.                         $pdesc =~ s/&/%26/g;
  145.                         $pdesc =~ s/\+/%2B/g;
  146.                         next;
  147.                 };
  148.  
  149.                 if(/^-e$/) {
  150.                         $pexpi = shift(@ARGV);
  151.                         $pexpi =~ y/[A-Z]/[a-z]/;
  152.                         my %expires = ( m5      => "5 minutes",
  153.                                         m01     => "10 minutes",
  154.                                         m51     => "15 minutes",
  155.                                         m03     => "30 minutes",
  156.                                         m54     => "45 minutes",
  157.                                         h1      => "1 hour",
  158.                                         h2      => "2 hours",
  159.                                         h4      => "4 hours",
  160.                                         h8      => "8 hours",
  161.                                         h21     => "12 hours",
  162.                                         d1      => "1 day",
  163.                                         d2      => "2 days",
  164.                                         d3      => "3 days",
  165.                                         w1      => "1 week",
  166.                                         w2      => "2 weeks",
  167.                                         w3      => "3 weeks",
  168.                                         nm1     => "1 month",
  169.                                         nm2     => "2 months",
  170.                                         nm3     => "3 months",
  171.                                         nm4     => "4 months",
  172.                                         nm5     => "5 months",
  173.                                         nm6     => "6 months",
  174.                                         y1      => "1 year",
  175.                                         );
  176.                         my $pexpi_tmp = scalar(reverse($pexpi));
  177.                         if(!grep(/^$pexpi_tmp$/, keys(%expires))) {
  178.                                 print STDERR "bad expiration time: $pexpi\n";
  179.                                 die "choose one from: 5m 10m 15m 30m 45m 1h 2h 4h 8h 12h 1d 2d 3d 1w 2w 3w 1mn 2mn 3mn 4mn 5mn 6mn 1y\n";
  180.                         };
  181.                         $pexpi = $expires{"$pexpi_tmp"};
  182.                         next;
  183.                 };
  184.  
  185.                 if(/^-n$/) { $puser=shift(@ARGV); next; };
  186.  
  187.                 usage() if(/^(-h|--help)$/);
  188.                 print STDERR "bad option: $_\n";
  189.                 usage();
  190.         };
  191.  
  192. };
  193.  
  194. ## build and upload tmp file ..
  195. sub build_upload_file {
  196.         my $pfile;
  197.         my $plines = 0;
  198.         open($pfile, ">", "/tmp/pastebin.pl.tmp");
  199.         print $pfile "name=$puser&type=$ptype&description=$pdesc&expiry=$pexpi&s=Submit+Post&content=";
  200.         while(<>) {
  201.                 s/%/%25/g;
  202.                 s/&/%26/g;
  203.                 s/\+/%2B/g;
  204.                 print $pfile "$_";
  205.                 $plines += 1;
  206.         };
  207.         close($pfile);
  208.         die "input is shorter then 5 lines, use -f option to force exploit pastebin.ca\n" if(($plines < 5) && "$pforc" !~ /^true$/);
  209. };
  210.  
  211. my $pastebinkey = "4g64jruLaAtRJt8XvjDn1Qt3jsQTgCmx";
  212.  
  213. sub upload_file {
  214.         chomp(my @wget_output = `$wpath -O - --tries=5 --timeout=60 --post-file=/tmp/pastebin.pl.tmp http://pastebin.ca/quiet-paste.php?api=$pastebinkey 2>&1`);
  215.         foreach(@wget_output) {
  216.                 next if ! /SUCCESS:/;
  217.                 print "$_\n" if s#^.*:([0-9][0-9]*).*#http://pastebin.ca/$1#;
  218.                 return 0;
  219.         };
  220.         die "can't post at pastebin.ca:\n@wget_output\n";
  221. };
  222.  
  223. ### Body from here:
  224.  
  225. checks();
  226. parse_cli();
  227. build_upload_file();
  228. upload_file();
  229.  
  230. unlink "/tmp/pastebin.pl.tmp";
  231.  
  232. #print << "EOF";
  233. #pforce: $pforc
  234. #ptype: $ptype
  235. #pdesc: $pdesc
  236. #pexpi: $pexpi
  237. #puser: $puser
  238. #EOF
  239.  
  240. exit 0;

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right