Advertisement
Doddy

Exploit DB Manager 0.6

Jan 1st, 2015
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 9.34 KB | None | 0 0
  1. #!usr/bin/perl
  2. #Exploit DB Manager 0.6
  3. #(C) Doddy Hackman 2015
  4.  
  5. use LWP::UserAgent;
  6. use Getopt::Long;
  7. use Color::Output;
  8. Color::Output::Init;
  9.  
  10. my @agents = (
  11. 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0',
  12.     'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14',
  13. 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36',
  14. 'Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0',
  15. 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.8pre) Gecko/20070928 Firefox/2.0.0.7 Navigator/9.0RC1',
  16.     'Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))',
  17. 'Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14',
  18. 'Mozilla/5.0 (Windows; U; Windows NT 6.1; tr-TR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27'
  19. );
  20.  
  21. my $nave = LWP::UserAgent->new();
  22. $nave->agent( $agents[ rand @agents ] );
  23. $nave->timeout(5);
  24.  
  25. GetOptions(
  26.     "search=s"       => \$search,
  27.     "page=i"         => \$page,
  28.     "read_exploit=s" => \$read_exploit,
  29.     "download=s"     => \$download,
  30.     "file=s"         => \$file,
  31.     "download_all=s" => \$download_all
  32. );
  33.  
  34. my $directorio_down = "downloads";
  35.  
  36. unless ( -d $directorio_down ) {
  37.     mkdir( $directorio_down, "0777" );
  38.     chmod 0777, $directorio_down;
  39. }
  40. chdir($directorio_down);
  41.  
  42. head();
  43. if ( $search ne "" ) {
  44.     if ( $page eq "" ) {
  45.         by_search( $search, "1" );
  46.     }
  47.     else {
  48.         by_search( $search, $page );
  49.     }
  50. }
  51. elsif ( $read_exploit ne "" ) {
  52.     by_read_exploit($read_exploit);
  53. }
  54. elsif ($download) {
  55.  
  56.     if ($file) {
  57.         by_download( $download, $file );
  58.     }
  59.     else {
  60.         by_download( $download, "" );
  61.     }
  62.  
  63. }
  64. elsif ($download_all) {
  65.  
  66.     if ( $page ne "" ) {
  67.         by_download_all( $download_all, $page );
  68.     }
  69.     else {
  70.         by_download_all( $download_all, "1" );
  71.     }
  72.  
  73. }
  74. else {
  75.     sintax();
  76. }
  77. copyright();
  78.  
  79. sub by_download_all {
  80.  
  81.     my $query = $_[0];
  82.     my $page  = $_[1];
  83.  
  84.     printear_titulo("\n[+] Searching  ...\n\n");
  85.  
  86.     my $directorio = $query;
  87.     $directorio =~ s/\.//;
  88.     $directorio =~ s/\=//;
  89.  
  90.     unless ( -d $directorio ) {
  91.         mkdir( $directorio, "0777" );
  92.         chmod 0777, $directorio;
  93.     }
  94.     chdir($directorio);
  95.  
  96.     my $code =
  97.       toma( "http://www.exploit-db.com/search/?action=search&filter_page="
  98.           . $page
  99.           . "&filter_description="
  100.           . $query
  101.           . "&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve="
  102.       );
  103.  
  104.     sleep(6);
  105.  
  106.     my %links_to_download;
  107.     my @ids        = "";
  108.     my @nombres    = "";
  109.     my @links      = "";
  110.     my @links_down = "";
  111.  
  112.     while ( $code =~
  113.         /<a href="http:\/\/www.exploit-db.com\/exploits\/(.*?)">(.*?)<\/a>/migs
  114.       )
  115.     {
  116.         my $id   = $1;
  117.         my $name = $2;
  118.         $name =~ s/&lt;//;
  119.         $name =~ s/\<//;
  120.         $name =~ s/(\s)+$//;
  121.  
  122.         my $link      = "http://www.exploit-db.com/exploits/" . $id;
  123.         my $link_down = "http://www.exploit-db.com/download/" . $id;
  124.         push( @nombres,    $name );
  125.         push( @ids,        $id );
  126.         push( @links,      $link );
  127.         push( @links_down, $link_down );
  128.     }
  129.  
  130.     printear("[+] Exploits Found : ");
  131.     print int(@links) - 1 . "\n\n";
  132.  
  133.     for my $num ( 1 .. int(@links) - 1 ) {
  134.         printear("[+] Title : ");
  135.         print $nombres[$num] . "\n";
  136.         printear("[+] Link : ");
  137.         print $links[$num] . "\n";
  138.  
  139.         my $titulo = $nombres[$num];
  140.         $titulo =~ s/=//ig;
  141.         $titulo =~ s/\///ig;
  142.         $titulo = $titulo . ".txt";
  143.         printear("[+] Downloading ID : ");
  144.         print $ids[$num];
  145.         print "\n";
  146.         sleep(6);
  147.  
  148.         if ( $nave->mirror( $links_down[$num], $titulo ) ) {
  149.             printear("[+] Status : ");
  150.             print "OK\n\n";
  151.             chmod 0777, $titulo;
  152.         }
  153.         else {
  154.             printear("[+] Status : ");
  155.             print "FAIL\n\n";
  156.         }
  157.     }
  158.  
  159.     printear_titulo("[+] Finished\n");
  160.  
  161. }
  162.  
  163. sub by_download {
  164.  
  165.     my $id   = $_[0];
  166.     my $file = $_[1];
  167.  
  168.     printear_titulo("\n[+] Downloading exploit ID : ");
  169.     print $id. "\n";
  170.  
  171.     if ( $file ne "" ) {
  172.  
  173.         if (
  174.             $nave->mirror(
  175.                 "http://www.exploit-db.com/download/" . $id . "/", $file
  176.             )
  177.           )
  178.         {
  179.             printear( "\n[+] File '" . $file . "' Downloaded !\n" );
  180.             chmod 0777, $file;
  181.         }
  182.         else {
  183.             printear("\n[-] WTF !\n");
  184.         }
  185.  
  186.     }
  187.     else {
  188.         my $code = toma( "http://www.exploit-db.com/exploits/" . $id . "/" );
  189.         if ( $code =~ /<h1 style="(.*?)">(.*?)<\/h1>/ ) {
  190.             my $titulo       = $2;
  191.             my $exploit_name = $titulo;
  192.             $titulo =~ s/\.//;
  193.             $titulo =~ s/\=//;
  194.             $titulo = $titulo . ".txt";
  195.             sleep(6);
  196.             if (
  197.                 $nave->mirror(
  198.                     "http://www.exploit-db.com/download/" . $id . "/", $titulo
  199.                 )
  200.               )
  201.             {
  202.                 printear( "\n[+] File '" . $exploit_name . "' Downloaded !\n" );
  203.                 chmod 0777, $titulo;
  204.             }
  205.             else {
  206.                 printear("\n[-] WTF !\n");
  207.             }
  208.         }
  209.     }
  210.  
  211. }
  212.  
  213. sub by_read_exploit {
  214.  
  215.     printear_titulo("\n[+] Searching  ...\n\n");
  216.  
  217.     my $id     = $_[0];
  218.     my $code   = toma( "http://www.exploit-db.com/exploits/" . $id . "/" );
  219.     my $source = toma( "http://www.exploit-db.com/download/" . $id . "/" );
  220.  
  221.     if ( $code =~ /<h1 style="(.*?)">(.*?)<\/h1>/ ) {
  222.         my $titulo = $2;
  223.  
  224.         printear("[+] Title : ");
  225.         print $titulo. "\n";
  226.     }
  227.     else {
  228.         printear("[-] WTF !\n");
  229.     }
  230.  
  231.     if ( $code =~ /Author: (.*?)</ ) {
  232.         my $autor = $1;
  233.  
  234.         printear("[+] Author : ");
  235.         print $autor. "\n";
  236.     }
  237.     if ( $code =~ /Published: (.*?)</ ) {
  238.         my $fecha = $1;
  239.         printear("[+] Published : ");
  240.         print $fecha. "\n";
  241.     }
  242.  
  243.     if ( $code =~ /Vulnerable App: &nbsp;&nbsp; <a href="(.*?)">/ ) {
  244.         my $app = $1;
  245.         printear("[+] Vulnerable App : ");
  246.         print $app. "\n";
  247.     }
  248.  
  249.     print "\n-------------------------------------\n";
  250.     printear($source);
  251.     print "-------------------------------------\n";
  252.  
  253. }
  254.  
  255. sub by_search {
  256.  
  257.     my $query = $_[0];
  258.     my $page  = $_[1];
  259.  
  260.     printear_titulo("\n[+] Searching  ...\n\n");
  261.  
  262.     my $code =
  263.       toma( "http://www.exploit-db.com/search/?action=search&filter_page="
  264.           . $page
  265.           . "&filter_description="
  266.           . $query
  267.           . "&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve="
  268.       );
  269.  
  270.     my @dates   = "";
  271.     my @nombres = "";
  272.     my @tipos   = "";
  273.     my @autores = "";
  274.     my @links   = "";
  275.  
  276.     while ( $code =~ /<td class="list_explot_date">(.*?)<\/td>/migs ) {
  277.         my $date = $1;
  278.         push( @dates, $date );
  279.     }
  280.  
  281.     while ( $code =~
  282.         /<a href="http:\/\/www.exploit-db.com\/exploits\/(.*?)">(.*?)<\/a>/migs
  283.       )
  284.     {
  285.         my $id   = $1;
  286.         my $name = $2;
  287.         $name =~ s/&lt;//;
  288.         my $link = "http://www.exploit-db.com/exploits/" . $id;
  289.         push( @nombres, $name );
  290.         push( @links,   $link );
  291.     }
  292.  
  293.     while ( $code =~
  294.         /<a href="http:\/\/www.exploit-db.com\/platform\/(.*?)">(.*?)<\/a>/migs
  295.       )
  296.     {
  297.         my $type = $2;
  298.         push( @tipos, $type );
  299.     }
  300.  
  301.     while ( $code =~
  302. /<a href="http:\/\/www.exploit-db.com\/author\/(.*?)" title="(.*?)">/migs
  303.       )
  304.     {
  305.         my $autor = $2;
  306.         push( @autores, $autor );
  307.     }
  308.  
  309.     printear("[+] Exploits Found : ");
  310.     print int(@links) - 1 . "\n";
  311.  
  312.     for my $num ( 1 .. int(@links) - 1 ) {
  313.         printear("\n[+] Title : ");
  314.         print $nombres[$num] . "\n";
  315.         printear("[+] Date : ");
  316.         print $dates[$num] . "\n";
  317.         printear("[+] Type : ");
  318.         print $tipos[$num] . "\n";
  319.         printear("[+] Author : ");
  320.         print $autores[$num] . "\n";
  321.         printear("[+] Link : ");
  322.         print $links[$num] . "\n";
  323.     }
  324.  
  325. }
  326.  
  327. sub printear {
  328.     cprint( "\x036" . $_[0] . "\x030" );
  329. }
  330.  
  331. sub printear_logo {
  332.     cprint( "\x037" . $_[0] . "\x030" );
  333. }
  334.  
  335. sub printear_titulo {
  336.     cprint( "\x0310" . $_[0] . "\x030" );
  337. }
  338.  
  339. sub sintax {
  340.     printear("\n[+] Sintax : ");
  341.     print "perl $0 <option> <value>\n";
  342.     printear("\n[+] Options : \n\n");
  343.     print "-search <query> -page <count> : Search exploits in page\n";
  344.     print "-read_exploit <id exploit> : Read exploit\n";
  345.     print "-download <id exploit> : Download an exploit\n";
  346.     print "-download_all <query> -page <count> : Download all exploits\n";
  347.     printear("\n[+] Example : ");
  348.     print "perl exploitdb.pl -search smf -page 1\n";
  349.     copyright();
  350. }
  351.  
  352. sub head {
  353.     printear_logo("\n-- == Exploit DB Manager 0.6 == --\n\n");
  354. }
  355.  
  356. sub copyright {
  357.     printear_logo("\n\n-- == (C) Doddy Hackman 2015 == --\n\n");
  358.     exit(1);
  359. }
  360.  
  361. sub toma {
  362.     return $nave->get( $_[0] )->content;
  363. }
  364.  
  365. #The End ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement