コード例 #1
0
ファイル: sendFile.py プロジェクト: rtm9zc/OneDir
 def __init__(self, path, controller):
     """ """
     print 'in FileIOClientFactory class'
     self.path = path
     if ".enc" not in path:
         fileCrypto.encrypt_file('somekey', self.path)
         self.path = self.path+ ".enc"
     self.controller = controller
コード例 #2
0
ファイル: serverConnections.py プロジェクト: rtm9zc/OneDir
 def send_file(self, filePath, address):
     port = self.send_port
     if ".enc" not in filePath:
             fileCrypto.encrypt_file('somekey', filePath)
             filePath = filePath+ ".enc"
     controller = type('test',(object,),{'cancel':False, 'total_sent':0,'completed':Deferred()})
     f = FileIOClientFactory(filePath, controller)
     reactor.connectTCP(address, port, f)
     return controller.completed
コード例 #3
0
ファイル: watchDir.py プロジェクト: alexa816/OneDir
 def on_modified(self, event):
     source = event.src_path
     if source.find(".enc") != -1:
         return
     elif source.find(".goutputstream") == -1 and source[len(source)-1] != '~':
         print("File modified! (" + source + " at time: " +
         time.strftime("%Y-%m-%d %H:%M:%S")+ ")")
         if not event.is_directory:
             print 'calling modified method'
             if ".enc" not in source:
                 fileCrypto.encrypt_file('somekey', source)
                 source = source + ".enc"
             self.machine.modified(source)
コード例 #4
0
ファイル: watchDir.py プロジェクト: alexa816/OneDir
 def on_created(self, event):
     #Called on making new file
     #Should send file over to server
     source = event.src_path
     if source.find(".enc") != -1:
         return
     elif source.find(".goutputstream") == -1 and source[len(source)-1] != '~':
         print("File created! (" + source + " at time: " +
         time.strftime("%Y-%m-%d %H:%M:%S")+ ")")
         if not event.is_directory:
             if ".enc" not in source:
                 fileCrypto.encrypt_file('somekey', source)
                 source = source + ".enc"
             self.machine.created(source)
コード例 #5
0
ファイル: new_server.py プロジェクト: alexa816/OneDir
 def send_file(self, filePath, address):
     # send to server (aka on my laptop)
     #transmitOne(filePath,'137.54.51.83',self.send_port)
     #transmitOne(filePath,port=self.send_port,address='localhost')
     #transmitOne(filePath, 'localhost',self.send_port)
     port = self.send_port
     if "MOV;" in filePath:
         moveMessage.sendFile(filePath, address, port)
     else:
         if ".enc" not in filePath:
             fileCrypto.encrypt_file('somekey', filePath)
             filePath = filePath+ ".enc"
         controller = type('test',(object,),{'cancel':False, 'total_sent':0,'completed':Deferred()})
         f = FileIOClientFactory(filePath, controller)
         reactor.connectTCP(address, port, f)
         os.remove(filePath)
         return controller.completed
コード例 #6
0
ファイル: new_client.py プロジェクト: rtm9zc/OneDir
 def __init__(self, path, controller):
     self.path = path
     if ".enc" not in path:
         fileCrypto.encrypt_file('somekey', self.path)
         self.path = self.path+ ".enc"
     self.controller = controller