elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] Mysql Manager 0.5
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] Mysql Manager 0.5  (Leído 1,423 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Mysql Manager 0.5
« en: 14 Abril 2012, 19:49 pm »

Nueva version de un mysql manager que hice hace un largo tiempo.

Código
  1. #!usr/bin/perl
  2. #Mysql Manager 0.5
  3. #Coded By Doddy H
  4. #Modules
  5. #ppm install http://www.bribes.org/perl/ppm/Scalar-List-Utils.ppd
  6. #ppm install http://www.bribes.org/perl/ppm/Storable.ppd
  7. #ppm install http://www.bribes.org/perl/ppm/DBI.ppd
  8. #ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd
  9.  
  10. use DBI;
  11.  
  12. sub head {
  13.    print "\n\n -- == Mysql Manager 0.5 == --\n\n";
  14. }
  15.  
  16. sub copyright {
  17.    print "\n\n-- == (C) Doddy Hackman 2012 == --\n\n";
  18.    exit(1);
  19. }
  20.  
  21. sub sintax {
  22.    print "\n[+] Sintax : $0 <host> <user> <pass>\n";
  23. }
  24.  
  25. head();
  26. unless ( @ARGV > 2 ) {
  27.    sintax();
  28. }
  29. else {
  30.    enter( $ARGV[0], $ARGV[1], $ARGV[2] );
  31. }
  32. copyright();
  33.  
  34. sub enter {
  35.  
  36.    print "\n[+] Connecting to the server\n";
  37.  
  38.    $info = "dbi:mysql::" . $_[0] . ":3306";
  39.    if ( my $enter = DBI->connect( $info, $_[1], $_[2], { PrintError => 0 } ) )
  40.    {
  41.  
  42.        print "\n[+] Enter in the database";
  43.  
  44.        while (1) {
  45.            print "\n\n\n[+] Query : ";
  46.            chomp( my $ac = <stdin> );
  47.  
  48.            if ( $ac eq "exit" ) {
  49.                $enter->disconnect;
  50.                print "\n\n[+] Closing connection\n\n";
  51.                copyright();
  52.            }
  53.  
  54.            $re = $enter->prepare($ac);
  55.            $re->execute();
  56.            my $total = $re->rows();
  57.  
  58.            my @columnas = @{ $re->{NAME} };
  59.  
  60.            if ( $total eq "-1" ) {
  61.                print "\n\n[-] Query Error\n";
  62.                next;
  63.            }
  64.            else {
  65.                print "\n\n[+] Result of the query\n";
  66.                if ( $total eq 0 ) {
  67.                    print "\n\n[+] Not rows returned\n\n";
  68.                }
  69.                else {
  70.                    print "\n\n[+] Rows returned : " . $total . "\n\n\n";
  71.                    for (@columnas) {
  72.                        print $_. "\t\t";
  73.                    }
  74.                    print "\n\n";
  75.                    while ( @row = $re->fetchrow_array ) {
  76.                        for (@row) {
  77.                            print $_. "\t\t";
  78.                        }
  79.                        print "\n";
  80.                    }
  81.                }
  82.            }
  83.        }
  84.    }
  85.    else {
  86.        print "\n[-] Error connecting\n";
  87.    }
  88. }
  89.  
  90. # ¿ The End ?
  91.  
  92.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] Mysql Manager
Scripting
BigBear 0 1,592 Último mensaje 7 Octubre 2011, 01:14 am
por BigBear
[Perl] Manager
Scripting
BigBear 0 1,523 Último mensaje 9 Octubre 2011, 17:50 pm
por BigBear
[Perl] FTP Manager
Scripting
BigBear 0 1,546 Último mensaje 14 Octubre 2011, 15:25 pm
por BigBear
[Perl] USB Manager 0.2
Scripting
BigBear 0 1,543 Último mensaje 3 Diciembre 2011, 16:34 pm
por BigBear
[Perl Tk] Mysql Manager 0.6
Scripting
BigBear 0 1,515 Último mensaje 14 Abril 2012, 19:49 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines