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

 

 


Tema destacado: Estamos en la red social de Mastodon


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Mysql Manager
« en: 7 Octubre 2011, 01:14 am »

Un simple mysql manager , un triste intento de imitacion al comando mysql pero bueno....

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


Un ejemplo de uso

Código:

C:\Documents and Settings\Administrador\Escritorio\Todo\Warfactory II\proyectos\
mysqlman>manager.PL localhost root ""


 -- == Mysql Manager == --


[+] Connecting to the server

[+] Enter in the database


[+] Query : show databases


[+] Result of the query


[+] Rows returned : 6


Database

information_schema
cdcol
hackman
mysql
phpmyadmin
test



[+] Query : exit


[+] Closing connection



-- == (C) Doddy Hackman 2011 == --




« Última modificación: 8 Octubre 2011, 18:58 pm por Doddy » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Facebook Manager [ Perl ]
Scripting
leogtz 0 2,432 Último mensaje 31 Diciembre 2010, 00:45 am
por leogtz
[Perl] FSD Exploit Manager
Scripting
BigBear 0 1,849 Último mensaje 7 Octubre 2011, 01:14 am
por BigBear
[Perl] Manager
Scripting
BigBear 0 1,514 Último mensaje 9 Octubre 2011, 17:50 pm
por BigBear
[Perl] Mysql Manager 0.5
Scripting
BigBear 0 1,417 Último mensaje 14 Abril 2012, 19:49 pm
por BigBear
[Perl Tk] Mysql Manager 0.6
Scripting
BigBear 0 1,509 Último mensaje 14 Abril 2012, 19:49 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines