0 Replies - 691 Views - Last Post: 07 March 2015 - 09:54 AM

#1 exoje  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-March 15

ftp connection

Posted 07 March 2015 - 09:54 AM

Hi,im a beginner in perl. i made a small script to connect to a ftp server but i think i made a mistake.. when i try to send a command to the ftp via my script i receive error 500 from the ftp (unknown cmd), i tried many things but i always get the same msg.

:
#!/usr/bin/perl -w
use strict;
use Net::FTP;

my $server = shift || die "[!] No server given...\n";
my $port = shift || die "[!] No port given...\n";
my $user = shift;
my $pass = shift;

my $ftp = Net::FTP->new(
        Host    => $server,
        Port    => $port,
        Debug   => 0 ) || die "[!] Can not establish connection...\n";

if ($ftp) {
        print "[-] Connected !\n";
        print "[-] Logging in...\n";
        $ftp->login($user,$pass) || die "[!] Can not login...\n", $ftp->message;
        print "[-] Logged in as $user !\n";
        ##$ftp->ls() || die "[!] Command not recognized...\n";
        while (<STDIN>) {
                      print $ftp $_;
                      print scalar <$ftp>;
        }
        
        die "[!] Disconnected...\n", $ftp->message;
}

else {
        print "[!] Unable to connect to $server ...\n";
        }
    



Is This A Good Question/Topic? 0
  • +

Page 1 of 1