示例#1
0
文件: rtip.py 项目: br1n0/GlobaLeaks
def db_delete_itip(store, itip):
    for ifile in itip.internalfiles:
        abspath = os.path.join(GLSettings.submission_path, ifile.file_path)

        if os.path.isfile(abspath):
            log.debug("Marking internalfile %s for secure deletion" % abspath)
            secure_file_delete = SecureFileDelete()
            secure_file_delete.filepath = abspath
            store.add(secure_file_delete)

        rfiles = store.find(ReceiverFile, ReceiverFile.internalfile_id == ifile.id)
        for rfile in rfiles:
            # The following code must be bypassed if rfile.file_path == ifile.filepath,
            # this mean that is referenced the plaintext file instead having E2E.
            if rfile.file_path == ifile.file_path:
                continue

            abspath = os.path.join(GLSettings.submission_path, rfile.file_path)

            if os.path.isfile(abspath):
                log.debug("Marking receiverfile %s for secure deletion" % abspath)
                secure_file_delete = SecureFileDelete()
                secure_file_delete.filepath = abspath
                store.add(secure_file_delete)

        log.debug("Removing InternalTip %s" % itip.id)

    store.remove(itip)

    if store.find(InternalTip, InternalTip.questionnaire_hash == itip.questionnaire_hash).count() == 0:
        store.find(ArchivedSchema, ArchivedSchema.hash == itip.questionnaire_hash).remove()
示例#2
0
 def create_two_files_and_mark_them_for_deletion(self, store):
     for i in range(0, 2):
         to_delete = os.path.join(GLSettings.submission_path, 'to_delete' + str(i))
         with open(to_delete, 'w+b') as f:
             f.write("0123456789" * 10000)
         secure_file_delete = SecureFileDelete()
         secure_file_delete.filepath = to_delete
         store.add(secure_file_delete)
示例#3
0
def db_mark_file_for_secure_deletion(store, relpath):
    abspath = os.path.join(GLSettings.submission_path, relpath)
    if os.path.isfile(abspath):
        secure_file_delete = SecureFileDelete()
        secure_file_delete.filepath = abspath
        store.add(secure_file_delete)
    else:
        log.err("Tried to permanently delete a non existent file: %s" % abspath)
示例#4
0
def db_mark_file_for_secure_deletion(store, relpath):
    abspath = os.path.join(GLSettings.submission_path, relpath)
    if os.path.isfile(abspath):
        secure_file_delete = SecureFileDelete()
        secure_file_delete.filepath = abspath
        store.add(secure_file_delete)
    else:
        log.err("Tried to permanently delete a non existent file: %s" % abspath)
示例#5
0
文件: rtip.py 项目: nyimbi/GlobaLeaks
def db_delete_itip(store, itip):
    for ifile in itip.internalfiles:
        abspath = os.path.join(GLSettings.submission_path, ifile.file_path)

        if os.path.isfile(abspath):
            log.debug("Marking internalfile %s for secure deletion" % abspath)
            secure_file_delete = SecureFileDelete()
            secure_file_delete.filepath = abspath
            store.add(secure_file_delete)

        rfiles = store.find(ReceiverFile,
                            ReceiverFile.internalfile_id == ifile.id)
        for rfile in rfiles:
            # The following code must be bypassed if rfile.file_path == ifile.filepath,
            # this mean that is referenced the plaintext file instead having E2E.
            if rfile.file_path == ifile.file_path:
                continue

            abspath = os.path.join(GLSettings.submission_path, rfile.file_path)

            if os.path.isfile(abspath):
                log.debug("Marking receiverfile %s for secure deletion" %
                          abspath)
                secure_file_delete = SecureFileDelete()
                secure_file_delete.filepath = abspath
                store.add(secure_file_delete)

        log.debug("Removing InternalTip %s" % itip.id)

    store.remove(itip)

    if store.find(InternalTip, InternalTip.questionnaire_hash ==
                  itip.questionnaire_hash).count() == 0:
        store.find(ArchivedSchema,
                   ArchivedSchema.hash == itip.questionnaire_hash).remove()
示例#6
0
def db_mark_file_for_secure_deletion(store, relpath):
    abspath = os.path.join(GLSettings.submission_path, relpath)
    if os.path.isfile(abspath):
        secure_file_delete = SecureFileDelete()
        secure_file_delete.filepath = abspath
        store.add(secure_file_delete)
示例#7
0
def db_mark_file_for_secure_deletion(store, relpath):
    abspath = os.path.join(GLSettings.submission_path, relpath)
    if os.path.isfile(abspath):
        secure_file_delete = SecureFileDelete()
        secure_file_delete.filepath = abspath
        store.add(secure_file_delete)