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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[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.  



En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] Manager
Scripting
BigBear 0 1,516 Último mensaje 9 Octubre 2011, 17:50 pm
por BigBear
[Perl] FTP Manager
Scripting
BigBear 0 1,542 Último mensaje 14 Octubre 2011, 15:25 pm
por BigBear
[Perl] USB Manager 0.2
Scripting
BigBear 0 1,539 Último mensaje 3 Diciembre 2011, 16:34 pm
por BigBear
[Perl] Manager 0.3
Scripting
BigBear 0 1,463 Último mensaje 19 Enero 2012, 20:35 pm
por BigBear
[Perl Tk] FTP Manager 0.2
Scripting
BigBear 0 1,521 Último mensaje 22 Abril 2012, 05:03 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines