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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Mensajes
Páginas: 1 ... 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 [35] 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ... 55
341  Programación / Scripting / Re: [Ruby] Whois Online 0.1 en: 26 Abril 2012, 17:39 pm
reirme ? , no la veo una pregunta tonta , aca te dejo la definicion segun wiki

WHOIS es un protocolo TCP basado en petición/repuesta que se utiliza para efectuar consultas en una base de datos que permite determinar el propietario de un nombre de dominio o una dirección IP en Internet.

edito : actualice el post con un ejemplo de uso.
342  Programación / Scripting / Re: [Python] Whois Online 0.1 en: 23 Abril 2012, 19:44 pm
hacelo si queres.
343  Programación / Scripting / [Perl Tk] Whois Online 0.1 en: 23 Abril 2012, 17:21 pm
Version Tk de un cliente whois que funciona mediante una pagina online.

Una imagen


El codigo

Código
  1. #!usr/bin/perl
  2. #Whois Online 0.1
  3. #Version Tk
  4. #Coded By Doddy H
  5.  
  6. use Tk;
  7. use Tk::ROText;
  8. use LWP::UserAgent;
  9.  
  10. my $nave = LWP::UserAgent->new;
  11. $nave->agent(
  12. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  13. );
  14. $nave->timeout(5);
  15.  
  16. if ( $^O eq 'MSWin32' ) {
  17.    use Win32::Console;
  18.    Win32::Console::Free();
  19. }
  20.  
  21. my $color_fondo = "black";
  22. my $color_texto = "white";
  23.  
  24. my $newas =
  25.  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  26. $newas->geometry("400x300+50+50");
  27. $newas->title("Whois Online 0.1 || Coded By Doddy H");
  28. $newas->resizable( 0, 0 );
  29.  
  30. $newas->Label(
  31.    -text       => "Domain : ",
  32.    -font       => "Impact2",
  33.    -background => $color_fondo,
  34.    -foreground => $color_texto
  35. )->place( -x => "10", -y => "10" );
  36. my $dom = $newas->Entry(
  37.    -width      => "30",
  38.    -background => $color_fondo,
  39.    -foreground => $color_texto
  40. )->place( -x => "85", -y => "13" );
  41.  
  42. my $console = $newas->Scrolled(
  43.    "ROText",
  44.    -scrollbars => "e",
  45.    -width      => 36,
  46.    -height     => 15,
  47.    -background => $color_fondo,
  48.    -foreground => $color_texto
  49. )->place( -x => 15, -y => 50 );
  50.  
  51. $newas->Button(
  52.    -text             => "Search",
  53.    -command          => \&buscar,
  54.    -width            => "10",
  55.    -background       => $color_fondo,
  56.    -foreground       => $color_texto,
  57.    -activebackground => $color_texto
  58. )->place( -x => 310, -y => "50" );
  59. $newas->Button(
  60.    -text             => "Clean",
  61.    -command          => \&limpiar,
  62.    -width            => "10",
  63.    -background       => $color_fondo,
  64.    -foreground       => $color_texto,
  65.    -activebackground => $color_texto
  66. )->place( -x => 310, -y => "80" );
  67. $newas->Button(
  68.    -text             => "Exit",
  69.    -command          => \&salir,
  70.    -width            => "10",
  71.    -background       => $color_fondo,
  72.    -foreground       => $color_texto,
  73.    -activebackground => $color_texto
  74. )->place( -x => 310, -y => "110" );
  75.  
  76. MainLoop;
  77.  
  78. sub buscar {
  79.    $console->delete( "0.1", "end" );
  80.    my $target = $dom->get;
  81.    $newas->update;
  82.    $console->insert( "end", whois($target) );
  83.    $newas->update;
  84. }
  85.  
  86. sub limpiar {
  87.    $console->delete( "0.1", "end" );
  88.    $dom->delete( "0.1", "end" );
  89. }
  90.  
  91. sub salir {
  92.    exit 1;
  93. }
  94.  
  95. sub whois {
  96.  
  97.    my $ob   = shift;
  98.    my $code = tomar(
  99.        "http://networking.ringofsaturn.com/Tools/whois.php",
  100.        { "domain" => $ob, "submit" => "submit" }
  101.    );
  102.  
  103.    my @chau = ( """, ">>>", "<<<" );
  104.  
  105.    if ( $code =~ /<pre>(.*?)<\/pre>/sig ) {
  106.        my $resul = $1;
  107.        chomp $resul;
  108.  
  109.        for my $cha (@chau) {
  110.            $resul =~ s/$cha//ig;
  111.        }
  112.  
  113.        if ( $resul =~ /Whois Server Version/ ) {
  114.            return $resul;
  115.        }
  116.        else {
  117.            return "Not Found";
  118.        }
  119.    }
  120. }
  121.  
  122. sub tomar {
  123.    my ( $web, $var ) = @_;
  124.    return $nave->post( $web, [ %{$var} ] )->content;
  125. }
  126.  
  127. # The End ?
  128.  
  129.  
344  Programación / Scripting / [Perl] Whois Online 0.1 en: 23 Abril 2012, 17:21 pm
Debido a problemas con el modulo Net::Whois::Raw me vi obligado a realizar un whois mediante una pagina online.

Código
  1. #!usr/bin/perl
  2. #Whois Online 0.1
  3. #Coded By Doddy H
  4.  
  5. use LWP::UserAgent;
  6.  
  7. my $nave = LWP::UserAgent->new;
  8. $nave->agent(
  9. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  10. );
  11. $nave->timeout(5);
  12.  
  13. head();
  14. if ( $ARGV[0] ) {
  15.    print whois( $ARGV[0] );
  16. }
  17. else {
  18.    sintax();
  19. }
  20. copyright();
  21.  
  22. sub sintax {
  23.    print "\n[+] Sintax : $0 <domain>\n";
  24. }
  25.  
  26. sub head {
  27.    print "\n-- == Whois Online 0.1 == --\n\n";
  28. }
  29.  
  30. sub copyright {
  31.    print "\n\n(C) Doddy Hackman 2012\n\n";
  32.    exit(1);
  33. }
  34.  
  35. sub whois {
  36.  
  37.    my $ob   = shift;
  38.    my $code = tomar(
  39.        "http://networking.ringofsaturn.com/Tools/whois.php",
  40.        { "domain" => $ob, "submit" => "submit" }
  41.    );
  42.  
  43.    my @chau = ( "&quot;", "&gt;&gt;&gt;", "&lt;&lt;&lt;" );
  44.  
  45.    if ( $code =~ /<pre>(.*?)<\/pre>/sig ) {
  46.        my $resul = $1;
  47.        chomp $resul;
  48.  
  49.        for my $cha (@chau) {
  50.            $resul =~ s/$cha//ig;
  51.        }
  52.  
  53.        if ( $resul =~ /Whois Server Version/ ) {
  54.            return $resul;
  55.        }
  56.        else {
  57.            return "Not Found";
  58.        }
  59.    }
  60. }
  61.  
  62. sub toma {
  63.    return $nave->get( $_[0] )->content;
  64. }
  65.  
  66. sub tomar {
  67.    my ( $web, $var ) = @_;
  68.    return $nave->post( $web, [ %{$var} ] )->content;
  69. }
  70.  
  71. # The End ?
  72.  
  73.  
345  Programación / Scripting / [Python] Whois Online 0.1 en: 23 Abril 2012, 17:20 pm
Un simple script en Python para realizar un whois de forma online (mediante una pagina).

Código
  1. #!usr/bin/python
  2. #Whois Online 0.1
  3. #Coded By Doddy H
  4.  
  5. import urllib2,sys,re
  6.  
  7. nave = urllib2.build_opener()
  8. nave.add_header = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5')]
  9.  
  10. def tomar(web,vars) :
  11. return nave.open(web,vars).read()
  12.  
  13. def head():
  14. print "\n-- == Whois Online 0.1 == --\n\n"
  15.  
  16. def copyright():
  17. print "\n(C) Doddy Hackman 2012\n"
  18. sys.exit(1)
  19.  
  20. def sintax():
  21. print "[+] Sintax : ",sys.argv[0]," <domain>\n"
  22.  
  23. def whois(domain):
  24. try:
  25.  code = tomar("http://networking.ringofsaturn.com/Tools/whois.php","domain="+domain+"&"+"submit=submit")
  26.  if (re.findall("<PRE>(.*?)<\/PRE>",code,re.S)):
  27.   found = re.findall("<PRE>(.*?)<\/PRE>",code,re.S)
  28.   resul = found[0]
  29.   resul = re.sub("&quot;","",resul)
  30.   resul = re.sub("&gt;&gt;&gt;","",resul)
  31.   resul = re.sub("&lt;&lt;&lt;","",resul)
  32.   return resul
  33.  else:
  34.   return "Not Found"
  35. except:
  36.  print "[-] Page offline\n"
  37.  
  38. head()
  39. if len(sys.argv) != 2 :
  40. sintax()
  41. else :
  42. print whois(sys.argv[1])
  43. copyright()
  44.  
  45. # The End
  46.  

346  Programación / Scripting / [Ruby] Whois Online 0.1 en: 23 Abril 2012, 17:19 pm
Un simple script en Ruby para hacer un whois al dominio que quieran.

Código
  1. #!usr/bin/ruby
  2. #Whois Online 0.1
  3. #Coded BY Doddy H
  4.  
  5. require "net/http"
  6.  
  7. def head()
  8.  print "\n-- == Whois Online 0.1 == --\n\n"
  9. end
  10.  
  11. def sintax()
  12.  print "\n[+] Sintax : ruby domain.rb <domain>\n"
  13. end
  14.  
  15. def copyright()
  16.  print "\n\n(C) Doddy Hackman 2012\n\n"
  17. end
  18.  
  19. def tomar(web,par)
  20.  return Net::HTTP.post_form(URI.parse(web),par).body
  21. end
  22.  
  23. def whois(dom)
  24.  code = tomar("http://networking.ringofsaturn.com/Tools/whois.php",{"domain"=>dom,"submit"=>"submit"})
  25.  if  code=~/<pre>(.*?)<\/pre>/mi
  26.    final = $1
  27.    final = final.sub(/&quot;/,"")
  28.    final = final.sub(/&gt;&gt;&gt;/,"")
  29.    final = final.sub(/&lt;&lt;&lt;/,"")
  30.    return final
  31.  else
  32.    return "Not Found"
  33.  end
  34. end
  35.  
  36. domain = ARGV[0]
  37.  
  38. head()
  39. if !domain
  40.  sintax()
  41. else
  42.  print whois(domain)
  43. end
  44. copyright()
  45.  
  46. #The End ?
  47.  

347  Programación / Scripting / [Perl Tk] FTP Manager 0.2 en: 22 Abril 2012, 05:03 am
Version Tk de un cliente FTP que hice en Perl

Las opciones que tiene son

  • Listado de archivos en un directorio
  • Borrar archivos y directorios
  • Crear directorios nuevos
  • Renombrar
  • Descargar y subir archivos

Una imagen


El codigo del programa

Código
  1. #!usr/bin/perl
  2. #FTP Manager 0.2
  3. #Version Tk
  4. #Coded By Doddy H
  5.  
  6. use Tk;
  7. use Tk::FileSelect;
  8. use Cwd;
  9. use Net::FTP;
  10.  
  11. if ( $^O eq 'MSWin32' ) {
  12.    use Win32::Console;
  13.    Win32::Console::Free();
  14. }
  15.  
  16. my $color_fondo = "black";
  17. my $color_texto = "cyan";
  18.  
  19. my $navedos =
  20.  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  21.  
  22. $navedos->title("FTP Manager 0.2");
  23. $navedos->geometry("218x150+20+20");
  24. $navedos->resizable( 0, 0 );
  25.  
  26. $navedos->Label(
  27.    -text       => "Host : ",
  28.    -font       => "Impact1",
  29.    -background => $color_fondo,
  30.    -foreground => $color_texto
  31. )->place( -x => 10, -y => 10 );
  32. my $host = $navedos->Entry(
  33.    -width      => 23,
  34.    -text       => "localhost",
  35.    -background => $color_fondo,
  36.    -foreground => $color_texto
  37. )->place( -x => 60, -y => 13 );
  38.  
  39. $navedos->Label(
  40.    -text       => "User : ",
  41.    -font       => "Impact1",
  42.    -background => $color_fondo,
  43.    -foreground => $color_texto
  44. )->place( -x => 10, -y => 40 );
  45. my $user = $navedos->Entry(
  46.    -width      => 23,
  47.    -text       => "doddy",
  48.    -background => $color_fondo,
  49.    -foreground => $color_texto
  50. )->place( -x => 60, -y => 43 );
  51.  
  52. $navedos->Label(
  53.    -text       => "Pass : ",
  54.    -font       => "Impact1",
  55.    -background => $color_fondo,
  56.    -foreground => $color_texto
  57. )->place( -x => 10, -y => 70 );
  58. my $pass = $navedos->Entry(
  59.    -width      => 23,
  60.    -text       => "doddy",
  61.    -background => $color_fondo,
  62.    -foreground => $color_texto
  63. )->place( -x => 60, -y => 73 );
  64.  
  65. $navedos->Button(
  66.    -text             => "Connect",
  67.    -width            => 13,
  68.    -command          => \&now,
  69.    -background       => $color_fondo,
  70.    -foreground       => $color_texto,
  71.    -activebackground => $color_texto
  72. )->place( -x => 60, -y => 110 );
  73.  
  74. MainLoop;
  75.  
  76. sub now {
  77.  
  78.    my $host = $host->get;
  79.    my $user = $user->get;
  80.    my $pass = $pass->get;
  81.  
  82.    my $socket = Net::FTP->new($host);
  83.    if ( $socket->login( $user, $pass ) ) {
  84.  
  85.        $navedos->destroy;
  86.  
  87.        my $mandos = MainWindow->new(
  88.            -background => $color_fondo,
  89.            -foreground => $color_texto
  90.        );
  91.        $mandos->title("FTP Manager 0.2 || Coded By Doddy H");
  92.        $mandos->geometry("565x335+20+20");
  93.        $mandos->resizable( 0, 0 );
  94.  
  95.        $menul = $mandos->Frame(
  96.            -relief     => "sunken",
  97.            -bd         => 1,
  98.            -background => $color_fondo,
  99.            -foreground => $color_texto
  100.        );
  101.        my $menulnow = $menul->Menubutton(
  102.            -text             => "Options",
  103.            -underline        => 1,
  104.            -background       => $color_fondo,
  105.            -foreground       => $color_texto,
  106.            -activebackground => $color_texto
  107.        )->pack( -side => "left" );
  108.        my $aboutnow = $menul->Menubutton(
  109.            -text             => "About",
  110.            -underline        => 1,
  111.            -background       => $color_fondo,
  112.            -foreground       => $color_texto,
  113.            -activebackground => $color_texto
  114.        )->pack( -side => "left" );
  115.        my $exitnow = $menul->Menubutton(
  116.            -text             => "Exit",
  117.            -underline        => 1,
  118.            -background       => $color_fondo,
  119.            -foreground       => $color_texto,
  120.            -activebackground => $color_texto
  121.        )->pack( -side => "left" );
  122.        $menul->pack( -side => "top", -fill => "x" );
  123.  
  124.        $menulnow->command(
  125.            -label      => "Delete File",
  126.            -background => $color_fondo,
  127.            -foreground => $color_texto,
  128.            -command    => \&delnow
  129.        );
  130.        $menulnow->command(
  131.            -label      => "Delete Directory",
  132.            -background => $color_fondo,
  133.            -foreground => $color_texto,
  134.            -command    => \&deldirnow
  135.        );
  136.        $menulnow->command(
  137.            -label      => "Make Directory",
  138.            -background => $color_fondo,
  139.            -foreground => $color_texto,
  140.            -command    => \&makedirnow
  141.        );
  142.        $menulnow->command(
  143.            -label      => "Rename",
  144.            -background => $color_fondo,
  145.            -foreground => $color_texto,
  146.            -command    => \&renamenow
  147.        );
  148.        $menulnow->command(
  149.            -label      => "Download",
  150.            -background => $color_fondo,
  151.            -foreground => $color_texto,
  152.            -command    => \&downloadnow
  153.        );
  154.        $menulnow->command(
  155.            -label      => "Upload",
  156.            -background => $color_fondo,
  157.            -foreground => $color_texto,
  158.            -command    => \&updatenow
  159.        );
  160.  
  161.        $aboutnow->command(
  162.            -label      => "About",
  163.            -background => $color_fondo,
  164.            -foreground => $color_texto,
  165.            -command    => \&aboutnownow
  166.        );
  167.        $exitnow->command(
  168.            -label      => "Exit",
  169.            -background => $color_fondo,
  170.            -foreground => $color_texto,
  171.            -command    => \&exitnow
  172.        );
  173.  
  174.        $mandos->Label(
  175.            -text       => "Directory : ",
  176.            -font       => "Impact1",
  177.            -background => $color_fondo,
  178.            -foreground => $color_texto
  179.        )->place( -x => 23, -y => 40 );
  180.        my $actual = $mandos->Entry(
  181.            -text       => "/",
  182.            -width      => 60,
  183.            -background => $color_fondo,
  184.            -foreground => $color_texto
  185.        )->place( -x => 105, -y => 43 );
  186.        $mandos->Button(
  187.            -width            => 8,
  188.            -text             => "Enter",
  189.            -command          => \&dirs,
  190.            -background       => $color_fondo,
  191.            -foreground       => $color_texto,
  192.            -activebackground => $color_texto
  193.        )->place( -x => 480, -y => 43 );
  194.  
  195.        $mandos->Label(
  196.            -text       => "Directory",
  197.            -font       => "Impact1",
  198.            -background => $color_fondo,
  199.            -foreground => $color_texto
  200.        )->place( -x => 130, -y => 90 );
  201.        $mandos->Label(
  202.            -text       => "Files",
  203.            -font       => "Impact1",
  204.            -background => $color_fondo,
  205.            -foreground => $color_texto
  206.        )->place( -x => 350, -y => 90 );
  207.  
  208.        my $dir_now = $mandos->Listbox(
  209.            -width      => 25,
  210.            -height     => 13,
  211.            -background => $color_fondo,
  212.            -foreground => $color_texto
  213.        )->place( -x => 88, -y => 130 );
  214.        my $files_now = $mandos->Listbox(
  215.            -width      => 25,
  216.            -height     => 13,
  217.            -background => $color_fondo,
  218.            -foreground => $color_texto
  219.        )->place( -x => 300, -y => 130 );
  220.  
  221.        sub exitnow {
  222.            $socket->close();
  223.            exit(1);
  224.        }
  225.  
  226.        sub aboutnownow {
  227.            $mandos->Dialog(
  228.                -title            => "About",
  229.                -buttons          => ["OK"],
  230.                -text             => "Coded By Doddy H",
  231.                -background       => $color_fondo,
  232.                -foreground       => $color_texto,
  233.                -activebackground => $color_texto
  234.            )->Show();
  235.        }
  236.  
  237.        sub dirs {
  238.  
  239.            $dir_now->delete( "0.0", "end" );
  240.            $files_now->delete( "0.0", "end" );
  241.  
  242.            if ( my @files = $socket->dir() ) {
  243.  
  244.                my @files_found;
  245.                my @dirs_found;
  246.  
  247.                $socket->cwd( $actual->get );
  248.  
  249.                for my $fil (@files) {
  250.                    my @to = split( " ", $fil );
  251.                    my ( $dir, $file ) = @to[ 0, 8 ];
  252.                    if ( $dir =~ /^d/ ) {
  253.                        $dir_now->insert( "end", $file );
  254.                    }
  255.                    else {
  256.                        $files_now->insert( "end", $file );
  257.                    }
  258.                }
  259.            }
  260.        }
  261.  
  262.        sub delnow {
  263.  
  264.            my $ventdos = MainWindow->new(
  265.                -background => $color_fondo,
  266.                -foreground => $color_texto
  267.            );
  268.            $ventdos->geometry("260x80+20+20");
  269.            $ventdos->title("Delete File");
  270.            $ventdos->resizable( 0, 0 );
  271.  
  272.            $ventdos->Label(
  273.                -text       => "File : ",
  274.                -font       => "Impact",
  275.                -background => $color_fondo,
  276.                -foreground => $color_texto
  277.            )->place( -x => 20, -y => 20 );
  278.            my $filechau = $ventdos->Entry(
  279.                -width      => 20,
  280.                -background => $color_fondo,
  281.                -foreground => $color_texto
  282.            )->place( -x => 60, -y => 26 );
  283.            $ventdos->Button(
  284.                -width            => 6,
  285.                -text             => "Delete",
  286.                -command          => \&delnowdos,
  287.                -background       => $color_fondo,
  288.                -foreground       => $color_texto,
  289.                -activebackground => $color_texto
  290.            )->place( -x => 190, -y => 25 );
  291.  
  292.            sub delnowdos {
  293.                if ( $socket->delete( $filechau->get ) ) {
  294.                    $mandos->Dialog(
  295.                        -title            => "Deleted",
  296.                        -buttons          => ["OK"],
  297.                        -text             => "File Deleted",
  298.                        -background       => $color_fondo,
  299.                        -foreground       => $color_texto,
  300.                        -activebackground => $color_texto
  301.                    )->Show();
  302.                }
  303.                else {
  304.                    $mandos->Dialog(
  305.                        -title            => "Error",
  306.                        -buttons          => ["OK"],
  307.                        -text             => "Error",
  308.                        -background       => $color_fondo,
  309.                        -foreground       => $color_texto,
  310.                        -activebackground => $color_texto
  311.                    )->Show();
  312.                }
  313.            }
  314.        }
  315.  
  316.        sub deldirnow {
  317.  
  318.            my $venttres = MainWindow->new(
  319.                -background => $color_fondo,
  320.                -foreground => $color_texto
  321.            );
  322.            $venttres->geometry("300x80+20+20");
  323.            $venttres->title("Delete Directory");
  324.            $venttres->resizable( 0, 0 );
  325.  
  326.            $venttres->Label(
  327.                -text       => "Directory : ",
  328.                -font       => "Impact",
  329.                -background => $color_fondo,
  330.                -foreground => $color_texto
  331.            )->place( -x => 20, -y => 20 );
  332.            my $dirchau = $venttres->Entry(
  333.                -width      => 20,
  334.                -background => $color_fondo,
  335.                -foreground => $color_texto
  336.            )->place( -x => 99, -y => 26 );
  337.            $venttres->Button(
  338.                -width            => 6,
  339.                -text             => "Delete",
  340.                -command          => \&deldirnowdos,
  341.                -background       => $color_fondo,
  342.                -foreground       => $color_texto,
  343.                -activebackground => $color_texto
  344.            )->place( -x => 230, -y => 25 );
  345.  
  346.            sub deldirnowdos {
  347.                if ( $socket->rmdir( $dirchau->get ) ) {
  348.                    $mandos->Dialog(
  349.                        -title            => "Deleted",
  350.                        -buttons          => ["OK"],
  351.                        -text             => "Directory Deleted",
  352.                        -background       => $color_fondo,
  353.                        -foreground       => $color_texto,
  354.                        -activebackground => $color_texto
  355.                    )->Show();
  356.                }
  357.                else {
  358.                    $mandos->Dialog(
  359.                        -title            => "Error",
  360.                        -buttons          => ["OK"],
  361.                        -text             => "Error",
  362.                        -background       => $color_fondo,
  363.                        -foreground       => $color_texto,
  364.                        -activebackground => $color_texto
  365.                    )->Show();
  366.                }
  367.            }
  368.        }
  369.  
  370.        sub makedirnow {
  371.  
  372.            my $ventcuatro = MainWindow->new(
  373.                -background => $color_fondo,
  374.                -foreground => $color_texto
  375.            );
  376.            $ventcuatro->geometry("300x80+20+20");
  377.            $ventcuatro->title("Make Directory");
  378.            $ventcuatro->resizable( 0, 0 );
  379.  
  380.            $ventcuatro->Label(
  381.                -text       => "Directory : ",
  382.                -font       => "Impact",
  383.                -background => $color_fondo,
  384.                -foreground => $color_texto
  385.            )->place( -x => 20, -y => 20 );
  386.            my $dirnow = $ventcuatro->Entry(
  387.                -width      => 20,
  388.                -background => $color_fondo,
  389.                -foreground => $color_texto
  390.            )->place( -x => 99, -y => 26 );
  391.            $ventcuatro->Button(
  392.                -width            => 6,
  393.                -text             => "Make",
  394.                -command          => \&makedirnowdos,
  395.                -background       => $color_fondo,
  396.                -foreground       => $color_texto,
  397.                -activebackground => $color_texto
  398.            )->place( -x => 230, -y => 25 );
  399.  
  400.            sub makedirnowdos {
  401.  
  402.                if ( $socket->mkdir( $dirnow->get ) ) {
  403.                    $mandos->Dialog(
  404.                        -title            => "Ok",
  405.                        -buttons          => ["OK"],
  406.                        -text             => "Ok",
  407.                        -background       => $color_fondo,
  408.                        -foreground       => $color_texto,
  409.                        -activebackground => $color_texto
  410.                    )->Show();
  411.                }
  412.                else {
  413.                    $mandos->Dialog(
  414.                        -title            => "Error",
  415.                        -buttons          => ["OK"],
  416.                        -text             => "Error",
  417.                        -background       => $color_fondo,
  418.                        -foreground       => $color_texto,
  419.                        -activebackground => $color_texto
  420.                    )->Show();
  421.                }
  422.            }
  423.        }
  424.  
  425.        sub renamenow {
  426.  
  427.            my $ventcinco = MainWindow->new(
  428.                -background => $color_fondo,
  429.                -foreground => $color_texto
  430.            );
  431.            $ventcinco->geometry("440x80+20+20");
  432.            $ventcinco->title("Rename");
  433.            $ventcinco->resizable( 0, 0 );
  434.  
  435.            $ventcinco->Label(
  436.                -text       => "Name : ",
  437.                -font       => "Impact",
  438.                -background => $color_fondo,
  439.                -foreground => $color_texto
  440.            )->place( -x => 20, -y => 20 );
  441.            my $unonow = $ventcinco->Entry(
  442.                -width      => 20,
  443.                -background => $color_fondo,
  444.                -foreground => $color_texto
  445.            )->place( -x => 74, -y => 26 );
  446.  
  447.            $ventcinco->Label(
  448.                -text       => "To : ",
  449.                -font       => "Impact",
  450.                -background => $color_fondo,
  451.                -foreground => $color_texto
  452.            )->place( -x => 210, -y => 20 );
  453.            my $dosnow = $ventcinco->Entry(
  454.                -background => $color_fondo,
  455.                -foreground => $color_texto
  456.            )->place( -x => 240, -y => 26 );
  457.  
  458.            $ventcinco->Button(
  459.                -width            => 6,
  460.                -text             => "Rename",
  461.                -command          => \&renamenowdos,
  462.                -background       => $color_fondo,
  463.                -foreground       => $color_texto,
  464.                -activebackground => $color_texto
  465.            )->place( -x => 372, -y => 26 );
  466.  
  467.            sub renamenowdos {
  468.  
  469.                if ( $socket->rename( $unonow->get, $dosnow->get ) ) {
  470.                    $mandos->Dialog(
  471.                        -title            => "Ok",
  472.                        -buttons          => ["OK"],
  473.                        -text             => "Ok",
  474.                        -background       => $color_fondo,
  475.                        -foreground       => $color_texto,
  476.                        -activebackground => $color_texto
  477.                    )->Show();
  478.                }
  479.                else {
  480.                    $mandos->Dialog(
  481.                        -title            => "Error",
  482.                        -buttons          => ["OK"],
  483.                        -text             => "Error",
  484.                        -background       => $color_fondo,
  485.                        -foreground       => $color_texto,
  486.                        -activebackground => $color_texto
  487.                    )->Show();
  488.                }
  489.            }
  490.        }
  491.  
  492.        sub updatenow {
  493.  
  494.            my $ventseis = MainWindow->new(
  495.                -background => $color_fondo,
  496.                -foreground => $color_texto
  497.            );
  498.            $ventseis->geometry("440x80+20+20");
  499.            $ventseis->title("Upload");
  500.            $ventseis->resizable( 0, 0 );
  501.  
  502.            $ventseis->Label(
  503.                -text       => "File : ",
  504.                -font       => "Impact",
  505.                -background => $color_fondo,
  506.                -foreground => $color_texto
  507.            )->place( -x => 20, -y => 20 );
  508.            my $filenow = $ventseis->Entry(
  509.                -width      => 40,
  510.                -background => $color_fondo,
  511.                -foreground => $color_texto
  512.            )->place( -x => 60, -y => 26 );
  513.  
  514.            $ventseis->Button(
  515.                -width            => 8,
  516.                -text             => "Browse",
  517.                -command          => \&bronow,
  518.                -background       => $color_fondo,
  519.                -foreground       => $color_texto,
  520.                -activebackground => $color_texto
  521.            )->place( -x => 310, -y => 26 );
  522.            $ventseis->Button(
  523.                -width            => 8,
  524.                -text             => "Upload",
  525.                -command          => \&updatenowdos,
  526.                -background       => $color_fondo,
  527.                -foreground       => $color_texto,
  528.                -activebackground => $color_texto
  529.            )->place( -x => 365, -y => 26 );
  530.  
  531.            sub bronow {
  532.                $browse = $ventseis->FileSelect( -directory => getcwd() );
  533.                my $file = $browse->Show;
  534.                $filenow->configure( -text => $file );
  535.            }
  536.  
  537.            sub updatenowdos {
  538.  
  539.                if ( $socket->put( $filenow->get ) ) {
  540.                    $mandos->Dialog(
  541.                        -title            => "File uploaded",
  542.                        -buttons          => ["OK"],
  543.                        -text             => "Ok",
  544.                        -background       => $color_fondo,
  545.                        -foreground       => $color_texto,
  546.                        -activebackground => $color_texto
  547.                    )->Show();
  548.                }
  549.                else {
  550.                    $mandos->Dialog(
  551.                        -title            => "Error",
  552.                        -buttons          => ["OK"],
  553.                        -text             => "Error",
  554.                        -background       => $color_fondo,
  555.                        -foreground       => $color_texto,
  556.                        -activebackground => $color_texto
  557.                    )->Show();
  558.                }
  559.            }
  560.        }
  561.  
  562.        sub downloadnow {
  563.  
  564.            my $ventsiete = MainWindow->new(
  565.                -background => $color_fondo,
  566.                -foreground => $color_texto
  567.            );
  568.            $ventsiete->geometry("270x80+20+20");
  569.            $ventsiete->title("Downloader");
  570.            $ventsiete->resizable( 0, 0 );
  571.  
  572.            $ventsiete->Label(
  573.                -text       => "File : ",
  574.                -font       => "Impact",
  575.                -background => $color_fondo,
  576.                -foreground => $color_texto
  577.            )->place( -x => 20, -y => 20 );
  578.            my $filenownow = $ventsiete->Entry(
  579.                -width      => 20,
  580.                -background => $color_fondo,
  581.                -foreground => $color_texto
  582.            )->place( -x => 59, -y => 26 );
  583.            $ventsiete->Button(
  584.                -width            => 8,
  585.                -text             => "Download",
  586.                -command          => \&downloadnowdos,
  587.                -background       => $color_fondo,
  588.                -foreground       => $color_texto,
  589.                -activebackground => $color_texto
  590.            )->place( -x => 190, -y => 25 );
  591.  
  592.            sub downloadnowdos {
  593.  
  594.                if ( $socket->get( $filenownow->get ) ) {
  595.                    $mandos->Dialog(
  596.                        -title            => "File downloaded",
  597.                        -buttons          => ["OK"],
  598.                        -text             => "Ok",
  599.                        -background       => $color_fondo,
  600.                        -foreground       => $color_texto,
  601.                        -activebackground => $color_texto
  602.                    )->Show();
  603.                }
  604.                else {
  605.                    $mandos->Dialog(
  606.                        -title            => "Error",
  607.                        -buttons          => ["OK"],
  608.                        -text             => "Error",
  609.                        -background       => $color_fondo,
  610.                        -foreground       => $color_texto,
  611.                        -activebackground => $color_texto
  612.                    )->Show();
  613.                }
  614.            }
  615.        }
  616.  
  617.    }
  618.    else {
  619.        $mandos->Dialog(
  620.            -title            => "Error",
  621.            -buttons          => ["OK"],
  622.            -text             => "Error",
  623.            -background       => $color_fondo,
  624.            -foreground       => $color_texto,
  625.            -activebackground => $color_texto
  626.        )->Show();
  627.    }
  628. }
  629.  
  630. #The End ?
  631.  
348  Programación / Scripting / [Perl] FTP Manager 0.2 en: 22 Abril 2012, 05:03 am
Nueva version de un cliente FTP que hice en Perl , en esta version se le arreglo varias cosas.

El codigo

Código
  1. #!usr/bin/perl
  2. #FTP Manager 0.2
  3. #Coded By Doddy H
  4.  
  5. use Net::FTP;
  6.  
  7. &head;
  8.  
  9. print "\n\n[FTP Server] : ";
  10. chomp( my $ftp = <stdin> );
  11. print "\n[User] : ";
  12. chomp( my $user = <stdin> );
  13. print "\n[Pass] : ";
  14. chomp( my $pass = <stdin> );
  15.  
  16. if ( my $socket = Net::FTP->new($ftp) ) {
  17.    if ( $socket->login( $user, $pass ) ) {
  18.  
  19.        print "\n\n[+] Enter of the server FTP\n";
  20.  
  21.      menu:
  22.  
  23.        print "\n\n>>";
  24.        chomp( my $cmd = <stdin> );
  25.        print "\n\n";
  26.  
  27.        if ( $cmd =~ /help/ ) {
  28.            print q(
  29. [+] Commands
  30.  
  31. [++] help : show information
  32. [++] cd : change directory <dir>
  33. [++] dir : list a directory
  34. [++] mkdir : create a directory <dir>
  35. [++] rmdir : delete a directory <dir>
  36. [++] pwd : directory  
  37. [++] del : delete a file <file>
  38. [++] rename : change name of the a file <file1> <file2>
  39. [++] size : size of the a file <file>
  40. [++] put : upload a file <file>
  41. [++] get : download a file <file>
  42. [++] cdup : change dir <dir>
  43. );
  44.        }
  45.  
  46.        if ( $cmd eq "dir" ) {
  47.            if ( my @files = $socket->dir() ) {
  48.  
  49.                my @files_found;
  50.                my @dirs_found;
  51.  
  52.                for my $fil (@files) {
  53.                    my @to = split( " ", $fil );
  54.                    my ( $dir, $file ) = @to[ 0, 8 ];
  55.                    if ( $dir =~ /^d/ ) {
  56.                        push( @dirs_found, $file );
  57.                    }
  58.                    else {
  59.                        push( @files_found, $file );
  60.                    }
  61.                }
  62.  
  63.                print "[++] Directory Found : " . int(@dirs_found) . "\n";
  64.                print "\n[+] Files Found : " . int(@files_found) . "\n\n";
  65.  
  66.                for my $dires (@dirs_found) {
  67.                    print "[++] : $dires\n";
  68.                }
  69.  
  70.                for my $filex (@files_found) {
  71.                    print "[+] : $filex\n";
  72.                }
  73.  
  74.            }
  75.            else {
  76.                print "[-] Error\n\n";
  77.            }
  78.        }
  79.  
  80.        if ( $cmd =~ /pwd/ig ) {
  81.            print "[+] Path : " . $socket->pwd() . "\n";
  82.        }
  83.  
  84.        if ( $cmd =~ /cd (.*)/ig ) {
  85.            if ( $socket->cwd($1) ) {
  86.                print "[+] Directory changed\n";
  87.            }
  88.            else {
  89.                print "[-] Error\n\n";
  90.            }
  91.        }
  92.  
  93.        if ( $cmd =~ /cdup/ig ) {
  94.            if ( my $dir = $socket->cdup() ) {
  95.                print "[+] Directory changed\n\n";
  96.            }
  97.            else {
  98.                print "[-] Error\n\n";
  99.            }
  100.        }
  101.  
  102.        if ( $cmd =~ /del (.*)/ig ) {
  103.            if ( $socket->delete($1) ) {
  104.                print "[+] File deleted\n";
  105.            }
  106.            else {
  107.                print "[-] Error\n\n";
  108.            }
  109.        }
  110.  
  111.        if ( $cmd =~ /rename (.*) (.*)/ig ) {
  112.            if ( $socket->rename( $1, $2 ) ) {
  113.                print "[+] File Updated\n";
  114.            }
  115.            else {
  116.                print "[-] Error\n\n";
  117.            }
  118.        }
  119.  
  120.        if ( $cmd =~ /mkdir (.*)/ig ) {
  121.            if ( $socket->mkdir($1) ) {
  122.                print "[+] Directory created\n";
  123.            }
  124.            else {
  125.                print "[-] Error\n\n";
  126.            }
  127.        }
  128.  
  129.        if ( $cmd =~ /rmdir (.*)/ig ) {
  130.            if ( $socket->rmdir($1) ) {
  131.                print "[+] Directory deleted\n";
  132.            }
  133.            else {
  134.                print "[-] Error\n\n";
  135.            }
  136.        }
  137.  
  138.        if ( $cmd =~ /size (.*)/ig ) {
  139.            print "[+] Size : " . $socket->size($1) . "\n\n";
  140.        }
  141.  
  142.        if ( $cmd =~ /exit/ig ) {
  143.            copyright();
  144.            exit(1);
  145.        }
  146.  
  147.        if ( $cmd =~ /get (.*)/ig ) {
  148.            print "[+] Downloading file\n\n";
  149.            if ( $socket->get($1) ) {
  150.                print "[+] Download completed";
  151.            }
  152.            else {
  153.                print "[-] Error\n\n";
  154.            }
  155.        }
  156.  
  157.        if ( $cmd =~ /put (.*)/ig ) {
  158.            print "[+] Uploading file\n\n";
  159.            if ( $socket->put($1) ) {
  160.                print "[+] Upload completed";
  161.            }
  162.            else {
  163.                print "[-] Error\n\n";
  164.            }
  165.        }
  166.  
  167.        goto menu;
  168.  
  169.    }
  170.    else {
  171.        print "\n\n[-] Failed the login\n\n";
  172.    }
  173.  
  174. }
  175. else {
  176.    print "\n\n[-] Error\n\n";
  177. }
  178.  
  179. sub head {
  180.    print "\n\n -- == FTP Manager 0.2 == --\n\n";
  181. }
  182.  
  183. sub copyright {
  184.    print "\n\n(C) Doddy Hackman 2012\n\n";
  185. }
  186.  
  187. # The End ?
  188.  

349  Programación / Scripting / [Perl Tk] Mysql Manager 0.6 en: 14 Abril 2012, 19:49 pm
Nueva version Tk de un Mysql manager que hice hace tiempo.

Código
  1. #!usr/bin/perl
  2. #Mysql Manager 0.6
  3. #Version Tk
  4. #Coded By Doddy H
  5. #Modules
  6. #ppm install http://www.bribes.org/perl/ppm/Scalar-List-Utils.ppd
  7. #ppm install http://www.bribes.org/perl/ppm/Storable.ppd
  8. #ppm install http://www.bribes.org/perl/ppm/DBI.ppd
  9. #ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd
  10.  
  11. use Tk;
  12. use Tk::ROText;
  13. use Tk::PNG;
  14. use DBI;
  15.  
  16. if ( $^O eq 'MSWin32' ) {
  17.    use Win32::Console;
  18.    Win32::Console::Free();
  19. }
  20.  
  21. my $color_fondo = "black";
  22. my $color_texto = "orange";
  23.  
  24. my $nave =
  25.  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  26.  
  27. $nave->title("Mysql Manager 0.6 || Coded By Doddy H");
  28. $nave->geometry("210x160+20+20");
  29. $nave->resizable( 0, 0 );
  30.  
  31. $nave->Label(
  32.    -text       => "Host : ",
  33.    -font       => "Impact1",
  34.    -background => $color_fondo,
  35.    -foreground => $color_texto
  36. )->place( -x => 10, -y => 10 );
  37. my $host = $nave->Entry(
  38.    -width      => 22,
  39.    -text       => "localhost",
  40.    -background => $color_fondo,
  41.    -foreground => $color_texto
  42. )->place( -x => 60, -y => 13 );
  43.  
  44. $nave->Label(
  45.    -text       => "User : ",
  46.    -font       => "Impact1",
  47.    -background => $color_fondo,
  48.    -foreground => $color_texto
  49. )->place( -x => 10, -y => 40 );
  50. my $user = $nave->Entry(
  51.    -width      => 22,
  52.    -text       => "root",
  53.    -background => $color_fondo,
  54.    -foreground => $color_texto
  55. )->place( -x => 60, -y => 43 );
  56.  
  57. $nave->Label(
  58.    -text       => "Pass : ",
  59.    -font       => "Impact1",
  60.    -background => $color_fondo,
  61.    -foreground => $color_texto
  62. )->place( -x => 10, -y => 70 );
  63. my $pass = $nave->Entry(
  64.    -width      => 22,
  65.    -background => $color_fondo,
  66.    -foreground => $color_texto
  67. )->place( -x => 60, -y => 73 );
  68.  
  69. $nave->Button(
  70.    -text             => "Connect",
  71.    -width            => 13,
  72.    -command          => \&now,
  73.    -background       => $color_fondo,
  74.    -foreground       => $color_texto,
  75.    -activebackground => "orange"
  76. )->place( -x => 60, -y => 120 );
  77.  
  78. MainLoop;
  79.  
  80. sub now {
  81.  
  82.    my $host = $host->get;
  83.    my $user = $user->get;
  84.    my $pass = $pass->get;
  85.  
  86.    $info = "dbi:mysql::" . $host . ":3306";
  87.  
  88.    if ( my $enter = DBI->connect( $info, $user, $pass, { PrintError => 0 } ) )
  89.    {
  90.  
  91.        $nave->destroy;
  92.  
  93.        my $man = MainWindow->new(
  94.            -background => $color_fondo,
  95.            -foreground => $color_texto
  96.        );
  97.        $man->title("Mysql Manager 0.6 || Coded By Doddy H");
  98.        $man->geometry("650x320+20+20");
  99.        $man->resizable( 0, 0 );
  100.  
  101.        $man->Label(
  102.            -text       => "Query : ",
  103.            -font       => "Impact1",
  104.            -background => $color_fondo,
  105.            -foreground => $color_texto
  106.        )->place( -x => 73, -y => 20 );
  107.        my $ac = $man->Entry(
  108.            -width      => 60,
  109.            -background => $color_fondo,
  110.            -foreground => $color_texto
  111.        )->place( -x => 135, -y => 23 );
  112.        $man->Button(
  113.            -width            => 8,
  114.            -text             => "Execute",
  115.            -command          => \&tes,
  116.            -background       => $color_fondo,
  117.            -foreground       => $color_texto,
  118.            -activebackground => "orange"
  119.        )->place( -x => 510, -y => 23 );
  120.        my $out = $man->Scrolled(
  121.            "ROText",
  122.            -width      => 74,
  123.            -height     => 15,
  124.            -background => $color_fondo,
  125.            -foreground => $color_texto
  126.        )->place( -x => 60, -y => 73 );
  127.  
  128.        $man->bind( "<Key-Return>" => sub { &tes } );
  129.  
  130.        sub tes {
  131.            my $ac = $ac->get;
  132.            $re = $enter->prepare($ac);
  133.            $re->execute();
  134.            my $total = $re->rows();
  135.  
  136.            my @columnas = @{ $re->{NAME} };
  137.  
  138.            if ( $total eq "-1" ) {
  139.                $out->insert( "end", "\n[-] Query Error\n" );
  140.                next;
  141.            }
  142.            else {
  143.                $out->insert( "end", "\n[+] Result of the query\n" );
  144.                if ( $total eq 0 ) {
  145.                    $out->insert( "end", "\n[+] Not rows returned\n\n" );
  146.                }
  147.                else {
  148.                    $out->insert( "end",
  149.                        "\n[+] Rows returned : " . $total . "\n\n" );
  150.                    for (@columnas) {
  151.                        $out->insert( "end", $_ . "\t" );
  152.                    }
  153.                    $out->insert( "end", "\n\n" );
  154.                    while ( @row = $re->fetchrow_array ) {
  155.                        for (@row) {
  156.                            $out->insert( "end", $_ . "\t" );
  157.                        }
  158.                        $out->insert( "end", "\n" );
  159.                    }
  160.                }
  161.            }
  162.        }
  163.    }
  164.    else {
  165.        $man->Dialog(
  166.            -title            => "Error",
  167.            -buttons          => ["OK"],
  168.            -text             => "Error",
  169.            -background       => $color_fondo,
  170.            -foreground       => $color_texto,
  171.            -activebackground => $color_texto
  172.        )->Show();
  173.    }
  174. }
  175.  
  176. # ¿ The End ?
  177.  
  178.  
350  Programación / Scripting / [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.  
Páginas: 1 ... 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 [35] 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ... 55
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines