Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Small FTP Client with GUI

by Perforin (Novice)
on Jul 26, 2007 at 22:41 UTC ( [id://629018]=sourcecode: print w/replies, xml ) Need Help??
Category: FTP stuff
Author/Contact Info Perforin Just mail me: perforin@warezmail.net
Description: Thats my little GUI FTP Client, with some Options like upload and download files.
Hi everybody! I´m new here and so Istart to share some of my Codes like this one. I called it FTP Master, but in real its just a simple and small FTP Client with 5 Options.The lanquage is German but its easy to navigate ;)
#!/usr/local/bin/perl
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ # # # # # # 
# ...:: FTP Master ::...
#
# Codet by Perforin
#
# Codet for dark-codez.org
#
# Join the dark side of coding!
#
# A small Perl FTP Client with GUI using Tk and Net::FTP.
#
# FTP Master can:
#
# -delete files
# -upload files
# -download files
# -print working directory
# -Directory-Listing 
#
#
# Bugs? Feedback? Mail me! 
#
# broken-error@hotmail.com  OR  perforin@warezmail.net
#
## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ # # # # # # # 

use Tk;
use Net::FTP;

my $mw = new MainWindow;
my $mb = $mw->Frame(-relief => 'ridge', -bd => 5);
my $m_file = $mb->Menubutton(-text      => "Befehle",
                          -underline => 1);
my $m_Credits = $mb->Menubutton(-text      => "Credits",
                          -underline => 1);
my $m_Exit = $mb->Menubutton(-text      => "Exit",
                          -underline => 1);
$mb    ->pack(-side => "top",
                 -fill => "x",
                 );
$m_file->pack(-side => "left");
$m_Credits->pack(-side => "left");
$m_Exit->pack(-side => "left");
$m_file->command(-label   => "ls",
                 -command => [\&ls],
                );
$m_file->command(-label   => "pwd",
                 -command => [\&pwd],
                );
$m_Credits->command(-label   => "Credits",
                 -command => [\&Credits],
                );
$m_Exit->command(-label   => "Exit",
                 -command => [\&exitus],
                );
my $top = $mw->Frame(-background => 'Black')->pack('-side' => 'top');
$top->Photo('logo', -file => "LOGO.gif");
$top->Label('-image' => 'logo')->pack();
$mw->title ("FTP Master");
my $label1 = $mw->Label (-text=>"----====[Login]====----" ,
                 -height=>5,
                 -width=>40,
                 );
my $label666 = $mw->Label (-text=>"\n----===============----\n",
                 -height=>3,
                 -width=>40,
                 );
my $label777 = $mw->Label (-text=>"\n",
                 -height=>1,
                 -width=>40,
                 );
my $label888 = $mw->Label (-text=>"\n",
                 -height=>1,
                 -width=>40,
                 );
my $label3 = $mw->Label (-text=>"Benutzer:");
my $entry3 = $mw->Entry (-width=>20);
my $label4 = $mw->Label (-text=>"Passwort:");
my $entry4 = $mw->Entry (-show=>'*', -width=>20);
my $label5 = $mw->Label (-text=>"Adresse:");
my $entry5 = $mw->Entry (-width=>20);
my $button1= $mw->Button(-text=>"[LoGiN]",
                 -background=>"red",
                 -command=>[\&login],
                 );
my $label6 = $mw->Label (-text=>"Uploaden:");
my $entry6 = $mw->Entry (-width=>20);
my $label7 = $mw->Label (-text=>"Downloaden:");
my $entry7 = $mw->Entry (-width=>20);
my $label8 = $mw->Label (-text=>"Datei löschen:");
my $entry8 = $mw->Entry (-width=>20);
my $button2= $mw->Button(-text=>"Uploaden",
                 -height=>2,
                 -width=>11,
                 -command=>[\&upload],
                 );
my $button3= $mw->Button(-text=>"Downloaden",
                 -height=>2,
                 -width=>11,
                 -command=>[\&download],
                 );
my $button4= $mw->Button(-text=>"Löschen",
                 -height=>2,
                 -width=>11,
                 -command=>[\&del],
                 );
$label1->pack (-side=>"top",-anchor=>'n');
$label3->pack (-side=>"top",-anchor=>'n');
$entry3->pack (-side=>"top",-anchor=>'n');
$label4->pack (-side=>"top",-anchor=>'n');
$entry4->pack (-side=>"top",-anchor=>'n');
$label5->pack (-side=>"top",-anchor=>'n');
$entry5->pack (-side=>"top",-anchor=>'n');
$label777->pack (-side=>"top",-anchor=>'n');
$button1->pack(-side=>"top",-anchor=>'n');
$label666->pack (-side=>"top",-anchor=>'n');
$label6->pack (-side=>"top",-anchor=>'n');
$entry6->pack (-side=>"top",-anchor=>'n');
$label7->pack (-side=>"top",-anchor=>'n');
$entry7->pack (-side=>"top",-anchor=>'n');
$label7->pack (-side=>"top",-anchor=>'n');
$entry7->pack (-side=>"top",-anchor=>'n');
$label8->pack (-side=>"top",-anchor=>'n');
$entry8->pack (-side=>"top",-anchor=>'n');
$label888->pack (-side=>"top",-anchor=>'n');
$button2->pack(-side=>"left",-anchor=>'s');
$button3->pack(-side=>"right",-anchor=>'s');
$button4->pack(-side=>"bottom",-anchor=>'s');


  sub login {
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
   $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messageBo
+x (-message=>"Down??!");
   $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"User 
+oder Passwort falsch!");;
   $ftp->quit;
   $mw->messageBox (-message=>"Login erfolgreich!");
  }  
     sub upload {
   my $upload = $entry6->get;
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
   $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messageBo
+x (-message=>"Down??!");
   $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"User 
+oder Passwort falsch!");
      if ($upload =~ /.txt|.log|.html|.php/)    { 
        $ftp->type(A);
    } else { 
        $ftp->type(I);
    }
   $ftp->put($upload);
   $ftp->quit;
   $mw->messageBox (-message=>"Erfolgreich upgeloadet!");
   }
     sub download {
   my $download = $entry7->get;
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
   $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messageBo
+x (-message=>"Down??!");
   $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"User 
+oder Passwort falsch!");
   if ($downlaod =~ /.txt|.log|.html|.php/)    { 
        $ftp->type(A);
    } else { 
        $ftp->type(I);
    }
   $ftp->get($download) || die $mw->messageBox (-message=>"Datei nicht
+ gefunden??!");
   $ftp->quit;
   $mw->messageBox (-message=>"Erfolgreich gedownloadet!");
   }
     sub ls {
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
       $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messa
+geBox (-message=>"Down??!");
       $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"U
+ser oder Passwort falsch!");
       @files = $ftp->ls();
     $mw->messageBox (-message=>"@files");
     $ftp->quit;
}
     sub pwd {
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
       $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messa
+geBox (-message=>"Down??!");
       $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"U
+ser oder Passwort falsch!");
     $show=$ftp->pwd();
     $mw->messageBox (-message=>"Aktuelles Verzeichnis des FTP-Servers
+: $show");
     $ftp->quit;
}
     sub del {
   my $user = $entry3->get;
   my $pw = $entry4->get;
   my $location = $entry5->get;
   my $dele = $entry8->get;
   chomp($dele);
       $ftp = Net::FTP->new("$location", Debug => 0) || die $mw->messa
+geBox (-message=>"Down??!");
       $ftp->login("$user","$pw") || die $mw->messageBox (-message=>"U
+ser oder Passwort falsch!");
       $ftp->delete($dele) || die $mw->messageBox (-message=>"Konnte n
+icht gelöscht werden!");
       $ftp->quit;
       $mw->messageBox (-message=>"Datei gelöscht!");
}
     sub Credits {
     $mw->messageBox (-message=>"----===============----\n\nFTP Master
+\nby\nPerforin\n\nWatch these sites!\n\nwww.perforins-software.dl.am\
+n\nwww.dark-codez.org\n\nJoin the dark side of coding!\n");
}
     sub exitus {
     exit();
}
MainLoop;
Replies are listed 'Best First'.
Re: Small FTP Client with GUI
by runrig (Abbot) on Jul 27, 2007 at 08:22 UTC
    Have you seen Tk-RemoteFileSelect? It is not a complete client, but it would make for a good component of one.
Re: Small FTP Client with GUI
by zentara (Archbishop) on Jul 27, 2007 at 11:51 UTC
    I would consider making your Logo.gif a base64encoded entity, so the program would be more standalone.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      THX for your feedback!
      I installed the TK-RemoteFileSelect and I´ll try it out :D
      The thing is I have to code my Perl for Windows, so i can´t install TK::PNG :(
      Thank you guys for the Tips :)




      Chef: What the hell are you supposed to be anyway?
      Mephesto: That's not important right now.
      Chef: No! What the hell is this little thing supposed to be? It doesn't look like anything.
      The Mayor: Chef, the turkeys!
        i can´t install TK::PNG

        You don't need Tk::PNG to encode a gif file. A gif file will work just fine in the script I showed, since gif support is built directly into Tk. Tk::PNG and Tk::JPEG should have come with ActiveStatePerl.

        The only reason I used a png, was I had the script handy.


        I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://629018]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 12:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found