[Perl] FTP Manager

Hoy eh terminado este simple cliente FTP el codigo es el siguiente


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!usr/bin/perl
#FTP Manager
#(C) Doddy Hackman 2010
 
use Net::FTP;
 
&head;
 
print "\n\n[FTP Server] : ";
chomp (my $ftp = <stdin>);
print "[User] : ";
chomp (my $user = <stdin>);
print "[Pass] : ";
chomp (my $pass = <stdin>);
 
 
if (my $socket = Net::FTP->new($ftp)) {
if ($socket->login($user,$pass)) {
 
print "\n<ul class="bbc_list"><li type="square"> Enter of the server FTP\n\n";[/li][/list]
 
menu:
 
print "\n\n>>";
chomp (my $cmd = <stdin>);
print "\n\n";
 
if ($cmd=~/help/) {
print q(
 
help : show information
cd : change directory <dir>
dir : list a directory 
mdkdir : create a directory <dir>
rmdir : delete a directory <dir>
pwd : directory  
del : delete a file <file>
rename : change name of the a file <file1> <file2>
size : size of the a file <file>
put : upload a file <file>
get : download a file <file>
cdup : change dir <dir>
 
 
);
}
 
if ($cmd=~/dir/ig) {
if (my @files = $socket->dir()) {
for(@files) {
print "</li><li type="square"> ".$_."\n";[/li][/list]
}
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/pwd/ig) {
print "</li><li type="square"> Path : ".$socket->pwd()."\n";[/li][/list]
}
 
if ($cmd=~/cd (.*)/ig) {
if ($socket->cwd($1)) {
print "</li><li type="square"> Directory changed\n";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/cdup/ig) {
if (my $dir = $socket->cdup()) {
print "\n\n</li><li type="square"> Directory changed\n\n";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/del (.*)/ig) {
if ($socket->delete($1)) {
print "</li><li type="square"> File deleted\n";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/rename (.*) (.*)/ig) {
if ($socket->rename($1,$2)) {
print "</li><li type="square"> File Updated\n";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/mkdir (.*)/ig) {
if ($socket->mkdir($1)) {
print "\n\n</li><li type="square"> Directory created\n";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/rmdir (.*)/ig) {
if ($socket->rmdir($1)) {
print "\n\n</li><li type="square"> Directory deleted\n"; [/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/exit/ig) {
copyright();
exit(1);
}
 
if ($cmd=~/get (.*) (.*)/ig) {
print "\n\n</li><li type="square"> Downloading file\n\n";[/li][/list]
if ($socket->get($1,$2)) {
print "</li><li type="square"> Download completed";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
if ($cmd=~/put (.*) (.*)/ig) {
print "\n\n</li><li type="square"> Uploading file\n\n";[/li][/list]
if ($socket->put($1,$2)) {
print "</li><li type="square"> Upload completed";[/li][/list]
} else {
print "\n\n[-] Error\n\n";
}
}
 
goto menu;
 
} else {
print "\n\n[-] Failed the login\n\n";
}
 
} else {
print "\n\n[-] Error\n\n";
}
 
sub head {
print "\n\n -- == FTP Manager == --\n\n";
}
 
sub copyright {
print "\n\n(C) Doddy Hackman 2010\n\n";
}
 
 
# ¿ The End ? 
 

0 comentarios: sobre [Perl] FTP Manager

Publicar un comentario para [Perl] FTP Manager

:a   :b   :c   :d   :e   :f   :g   :h   :i   :j   :k   :l   :m   :n   :o   :p   :q   :r   :s   :t

Calculando Tiempo
Alienspace Theme © Copyright 2017 By Proxor
Mi Ping en TotalPing.com FeedBurner FeedBurner FeedBurner FeedBurner FeedBurner