#!usr/bin/python
#FTP Manager 0.2 (C) Doddy Hackman 20111
from ftplib import FTP
import sys
def head():
print "\n -- == FTP Manger == --\n\n"
def copyright():
print "\n\n(C) Doddy Hackman 2011\n"
sys.exit(1)
def show():
print "\nSintax : "+sys.argv[0]+" <host> <user> <pass>\n"
def menu():
print "\n"
print "1 : dir"
print "2 : cwd"
print "3 : chdir"
print "4 : delete dir"
print "5 : delete file"
print "6 : rename file"
print "7 : make directory"
print "8 : size"
print "9 : abort\n\n"
op = input("[Option] : ")
return op
def enter(host,user,password):
print "[+] Connecting to ",host,"\n"
enter = FTP(host,user,password)
print "\n[+] Enter in the system\n"
def menu2():
op = menu()
if op == 1:
try:
lista = enter.dir()
for a in lista:
print a
menu2()
except:
menu2()
elif op == 2:
try:
print "\n\n[+] Path : "+enter.pwd()+"\n\n"
menu2()
except:
menu2()
elif op == 3:
try:
dir = raw_input("\n\n[Directory] : ")
enter.cwd(dir)
print "\n\n[+] Directory Changed\n\n"
menu2()
except:
menu2()
elif op == 4:
try:
dir = raw_input("\n\n[Directory] : ")
enter.rmd(dir)
print "\n\n[+] Directory Deleted\n\n"
menu2()
except:
menu2()
elif op == 5:
try:
file = raw_input("\n\n[File] : ")
enter.delete(file)
print "\n\n[+] File Deleted\n\n"
menu2()
except:
menu2()
elif op == 6:
try:
oldfile = raw_input("\n\n[Name] : ")
newfile = raw_input("\n[New Name] : ")
enter.rename(oldfile,newfile)
print "\n\n[+] Name Changed\n\n"
menu2()
except:
menu2()
elif op == 7:
try:
dir = raw_input("\n\n[New Directory] : ")
enter.mkd(dir)
print "\n\n[+] Directory Created\n\n"
menu2()
except:
menu2()
elif op == 8:
try:
file = raw_input("\n\n[File] : ")
peso = enter.size(file)
print "\n\n[+] ",peso," KB \n\n"
menu2()
except:
menu2()
elif op == 9:
enter.quit()
copyright()
else:
menu2()
menu2()
head()
if len(sys.argv) != 4:
show()
else:
enter(sys.argv[1],sys.argv[2],sys.argv[3])
copyright()
Hola , aca les traigo un simple cliente FTP.