Beispiel #1
0
 def __init__(self, lastState, workingDir, zipStorageDir, passwd):
     self.lastState = zipStorageLocalState(lastState)
     self.zipContentState = {}
     self.workingDir = workingDir + '/zipfiles'
     self.decryptionWorkingDir = workingDir + '/decrypted'
     self.zipStorageDir = zipStorageDir
     self.passwd = passwd
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
     
     misc.ensureDir(self.workingDir)
     misc.ensureDir(self.decryptionWorkingDir)
     
     
     ########################################
     #Internal used vars
     ########################################
     #The current zipfile object
     self.curArchive = None
     #Not necessary init as it will be inited with self.curArchive
     #The current archived size
     self.curArchivedSize = 0
     
     #The info of files in the current zip file
     self.zippedFileInfo = {}
     
     #The info of the whole storage
     self.zipStorageState = None
 def __init__(self, fileListTubeName = gFileListTubeName, passwd = "123", workingDir = gWorkingDir):
     '''
     Constructor
     '''
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
     self.collectionInDbForMonitoringPath = {}
     self.workingDir = workingDir
     self.dbInst = objectDatabase()
     super(zippedCollectionListHandler, self).__init__(fileListTubeName)
Beispiel #3
0
 def __init__(self, taskId, appUuid, collectionId, workingDir, passwd, targetCollection):
     processorBase.cacheCollectionProcessorBase.__init__(self, taskId, appUuid, collectionId)
     #This dir stores zip files which were decrypted
     self.workingDir = workingDir
     self.decryptionWorkingDir = workingDir + '/decrypted'
     misc.ensureDir(self.decryptionWorkingDir)
     self.logCollectionId = self.appConfigObj["logCollectionId"]
     self.logCollection = collectionDatabase.collectionOnMongoDbBase(self.logCollectionId, self.db.getCollectionDb())
     self.targetCollection = targetCollection
     self.passwd = passwd
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
Beispiel #4
0
 def __init__(self, storage, zipCollectionRoot = gZipCollectionRoot, passwd = "123", fileListTubeName = gFileListTubeName):
     '''
     Constructor
     '''
     self.storage = storage
     self.zipCollectionRoot = zipCollectionRoot
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
     self.curStorageSize = 0
     #self.addedList = []
     #self.fileListTubeName = fileListTubeName
     self.monitoringList = []
     super(fileListHandler, self).__init__(fileListTubeName)
Beispiel #5
0
 def __init__(self, rootDir, workingDir, passwd, collectionId, mongoDbInst):
     collectionDatabase.collectionOnMongoDbBase.__init__(self, collectionId, mongoDbInst):
     self.rootDir = transform.transformDirToInternal(rootDir)
     
     ########################################
     #Internal used vars
     ########################################
     #The current zipfile object
     self.curArchive = None
     
     #Not necessary init as it will be inited with self.curArchive
     #The current archived size
     self.curArchivedSize = 0
     
     #The info of files in the current zip file
     self.zippedFileInfo = {}
     
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
     self.workingDir = workingDir
Beispiel #6
0
    def __init__(self, taskName):
        #print taskName
        taskInterface.localTaskBase.__init__(self, taskName)
        parser = OptionParser()

        parser.add_option("-s", "--sourceDir", action="store",help="copy from which directory")
        parser.add_option("-p", "--encryptionPass", action="store",help="encryption password")
        parser.add_option("-t", "--targetDir", action="store", help="target directory")
        parser.add_option("-c", "--configPath", action="store", help="path for the config file")
        parser.add_option("-w", "--workingPath", action="store", help="path for temp file")
        (options, args) = parser.parse_args()
        self.options = options
        self.configPath = options.configPath
        self.config = configDict.configFileDict(options.configPath, {'timestamp':{}})
        misc.ensureDir(options.targetDir)
        self.objList = dirTreeGenerator(self.options.sourceDir)
        self.tmpStorageRoot = transform.transformDirToInternal(options.workingPath)
        misc.ensureDir(self.tmpStorageRoot)
        misc.ensureDir(self.options.targetDir)
        self.encCopier = encryptionStorageBase.arc4DecSimpleCopier(options.encryptionPass)
        #self.createNewZip()
        self.curArchive = None
Beispiel #7
0
 def __init__(self, taskId, appUuid, rootDir, workingDir, passwd, encZipStorageCollectionId, folderStorageCollectionId):
     self.rootDir = transform.transformDirToInternal(rootDir)
     processorBase.cacheCollectionProcessorBase.__init__(self, taskId, appUuid, self.rootDir)
     ########################################
     #Internal used vars
     ########################################
     #The current zipfile object
     self.curArchive = None
     #Not necessary init as it will be inited with self.curArchive
     #The current archived size
     self.curArchivedSize = 0
     self.logCollectionId = encZipStorageCollectionId
     self.logCollection = collectionDatabase.collectionOnMongoDbBase(self.logCollectionId, self.db.getCollectionDb())
     self.folderStorageCollectionId = folderStorageCollectionId
     self.folderStorageCollection = collectionDatabase.collectionOnMongoDbBase(self.folderStorageCollectionId, self.db.getCollectionDb())
     
     #The info of files in the current zip file
     self.zippedFileInfo = {}
     
     #The info of the whole storage
     self.zipStorageState = None
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
     self.workingDir = workingDir
Beispiel #8
0
 def __init__(self, collectionId, logCollectionId, workingDir, passwd, dbInst):
     '''
     collectionId is the id of a collection contains all enc zip files
     logCollectionId is the id of a collection contains all extracted info
     '''
     self.objDb = dbInst
     self.collectionDbInst = dbInst.getCollectionDb()
     #This dir stores zip files which were decrypted
     self.workingDir = workingDir
     self.decryptionWorkingDir = workingDir + '/decrypted'
     misc.ensureDir(self.decryptionWorkingDir)
     #This is the folder collection that contains all encrypted zip files
     self.collectionId = collectionId
     ncl(collectionId)
     self.collection = folderRecursiveEnumCollection.folderRecursiveEnumCollection(self.collectionId, dbInst)
     
     #This is the log collection which stores all extracted info, these info may 
     #be extracted every time the folder is scaned, but it'll be better to store them for future use
     self.logCollectionId = logCollectionId
     self.logCollection = collectionDatabase.collectionOnMongoDbBase(self.logCollectionId, self.collectionDbInst)
     
     self.passwd = passwd
     self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
     self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
Beispiel #9
0
    def __init__(self, lastState, workingDir, zipStorageDir, passwd):
        self.lastState = folderStorage.folderStorageState(lastState)
        #self.selfState = folderStorage.folderStorageState({})
        self.zipContentState = {}
        self.workingDir = workingDir + '/zipfiles'
        self.decryptionWorkingDir = workingDir + '/decrypted'
        self.zipStorageDir = zipStorageDir
        self.passwd = passwd
        self.encCopier = encryptionStorageBase.arc4EncSimpleCopier(passwd)
        self.decCopier = encryptionStorageBase.arc4DecSimpleCopier(passwd)
        
        misc.ensureDir(self.workingDir)
        misc.ensureDir(self.decryptionWorkingDir)
        
        
        ########################################
        #Internal used vars
        ########################################
        self.curArchive = None
        #Not necessary init as it will be inited with self.curArchive
        self.curArchivedSize = 0
        self.zippedFileInfo = {}

        self.zipStorageState = None