Esempio n. 1
0
 def deletefile(self, fileName):
     if fileName != "":
         print "Delete file " + fileName
         self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
         FTP_Client.Connect().deleteFileInDirectory('DELE ' + fileName)
     else:
         print "No file selected"
Esempio n. 2
0
 def removedirectory(self, fileName):
     if fileName != "":
         print "Remove directory " + fileName
         self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
         FTP_Client.Connect().removeDirectory('RMD ' + self.currentPath)
     else:
         print "No file selected"
Esempio n. 3
0
 def currentDirectory(self):
     self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
     self.FileTransferSocket = FTP_Client.Connect().makeDataConnection(
         self.MethodinUse)
     Reply1, ListOfDirFiles, Reply2 = FTP_Client.Connect().getList(
         'LIST ' + self.currentPath, self.FileTransferSocket)
     return ListofDirFiles, Reply2
Esempio n. 4
0
 def previous(self):
     print "Previous directory"
     self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
     FTP_Client.Connect().changeToParentDirectory('CDUP')
     self.currentPath[1:self.currentPath.rindex('/') - 1]
     reply = FTP_Client.Connect().changeWorkingDirectory('CWD ' +
                                                         self.currentPath)
     return reply
Esempio n. 5
0
 def makedirectory(self, fileName):
     if fileName != "":
         print "Make directory " + fileName
         self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
         FTP_Client.Connect().makeDirectory('MKD ' + self.currentPath +
                                            fileName)
     else:
         print "No file selected"
Esempio n. 6
0
 def next(self, fileName):
     if fileName != "":
         print "Next directory " + fileName
         self.currentPath = FTP_Client.Connect().printWorkingDir('PWD')
         reply = FTP_Client.Connect().changeWorkingDirectory(
             'CWD ' + self.currentPath + '/' + fileName)
         return reply
     else:
         print "No file selected"
Esempio n. 7
0
 def servertoclient(self, fileName):
     #fileName = " NAME"
     if fileName != "":
         print "Transfer: Server to client " + fileName
         self.FileTransferSocket = FTP_Client.Connect().makeDataConnection(
             self.MethodinUse)
         FTP_Client.Connect().Retrieve('RETR ' + fileName, self.TypeList,
                                       self.FileTransferSocket)
     else:
         print "No file selected"
Esempio n. 8
0
 def servertoclient(self, fileName):
     if fileName != "":
         print "Transfer: Server to client " + fileName
         self.FileTransferSocket = FTP_Client.Connect().makeDataConnection(
             self.MethodinUse)
         Reply, IncomingData, ElapsedTime = FTP_Client.Connect().Retrieve(
             'RETR ' + fileName, self.TypeList, self.FileTransferSocket)
         return Reply, IncomingData, ElapsedTime
     else:
         print "No file selected"
Esempio n. 9
0
 def clienttoserver(self, fileName):
     if fileName != "":
         print "Transfer: Client to server " + fileName
         self.FileTransferSocket = FTP_Client.Connect().makeDataConnection(
             self.MethodinUse)
         Reply, IncomingData, ElapsedTime = FTP_Client.Connect().Store(
             'STOR ' + fileName, self.TypeList, self.FileTransferSocket)
         return Reply, IncomingData, ElapsedTime
     else:
         print "No file selected"
Esempio n. 10
0
 def clienttoserver(self, fileName):
     #fileName = " NAME"
     if fileName != "":
         print "Transfer: Client to server " + fileName
         self.FileTransferSocket = FTP_Client.Connect().makeDataConnection(
             self.MethodinUse)
         FTP_Client.Connect().Store('STOR ' + fileName, self.TypeList,
                                    self.FileTransferSocket)
     else:
         print "No file selected"
Esempio n. 11
0
 def blockset(self):
     self.ModeinUse = 'B'
     FTP_Client.Connect().changeMode('MODE B', self.ModeList)
     self.ModeList[0] = False
     self.ModeList[1] = False
     self.ModeList[2] = True
     print "Block mode set"
Esempio n. 12
0
 def streamset(self):
     self.ModeinUse = 'S'
     FTP_Client.Connect().changeMode('MODE S', self.ModeList)
     self.ModeList[1] = False
     self.ModeList[2] = False
     self.ModeList[0] = True
     print "Stream mode set"
Esempio n. 13
0
 def ibset(self):
     self.TypeinUse = 'I'
     FTP_Client.Connect().changeType('TYPE I', self.TypeList)
     self.TypeList[1] = False
     self.TypeList[0] = False
     self.TypeList[2] = True
     print "Image/ Binary type set"
Esempio n. 14
0
 def edcbicset(self):
     self.TypeinUse = 'E'
     FTP_Client.Connect().changeType('TYPE E', self.TypeList)
     self.TypeList[2] = False
     self.TypeList[0] = False
     self.TypeList[1] = True
     print "EDCBIC type set"
Esempio n. 15
0
 def asciiset(self):
     self.TypeinUse = 'A'
     FTP_Client.Connect().changeType('TYPE A', self.TypeList)
     self.TypeList[2] = False
     self.TypeList[1] = False
     self.TypeList[0] = True
     print "ASCII type set"
Esempio n. 16
0
 def compressionset(self):
     self.ModeinUse = 'C'
     FTP_Client.Connect().changeMode('MODE C', self.ModeList)
     self.ModeList[2] = False
     self.ModeList[0] = False
     self.ModeList[1] = True
     print "Compression mode set"
Esempio n. 17
0
 def isValidUser(self, Username, Password, Host, Port):
     loginStatus = ''
     if Username != '':
         loginStatus = FTP_Client.Connect().Login(Username, Password, Host,
                                                  Port)
     else:
         loginStatus = 'Invalid Entry'
     return loginStatus
Esempio n. 18
0
 def __init__(self):
     self.MethodinUse = 'PORT'
     self.TypeinUse = 'A'
     self.ModeinUse = 'S'
     self.dataHost = '192.168.1.44'
     self.dataPort = '7000'
     self.TypeList = [True, False, False]
     self.ModeList = [True, False, False]
     self.Server = FTP_Client.Connect()
Esempio n. 19
0
 def parentdirectory(self):
     print "Parent directory"
     reply = FTP_Client.Connect().changeToParentDirectory('CDUP')
     return reply
Esempio n. 20
0
 def nooperation(self):
     FTP_Client.Connect().NoOperation('NOOP')
     print "NOOP"
Esempio n. 21
0
 def parentdirectory(self):
     print "Parent directory"
     FTP_Client.Connect().changeToParentDirectory('CDUP')
Esempio n. 22
0
 def nooperation(self):
     reply = FTP_Client.Connect().NoOperation('NOOP')
     print "NOOP"
     return reply
Esempio n. 23
0
 def disconnectServer(self):
     FTP_Client.Connect().quitService('QUIT')