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)
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)
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)
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
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
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)
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
from optparse import OptionParser import localLibSys import desktopApp.lib.archiver.encryptionStorageBase as encryptionStorageBase import desktopApp.lib.archiver.archiveStorageBase as archiveStorageBase import desktopApp.lib.archiver.archiverV2 as archiver import wwjufsdatabase.libs.utils.misc as misc if __name__ == "__main__": 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") (options, args) = parser.parse_args() ar = archiver.archiverInterface() src = archiveStorageBase.folder(options.sourceDir) misc.ensureDir(options.targetDir) s = encryptionStorageBase.encryptionStorageBase(options.sourceDir, options.targetDir, stateStoragePath = options.configPath, encCopier = encryptionStorageBase.arc4EncSimpleCopier(options.encryptionPass)) ar.archive(src, s) s.saveState()