예제 #1
0
def filter_write(process, file_descriptor, byte_count):
    if process.is_tracked_descriptor(file_descriptor):
        path = process.descriptor_path(file_descriptor)
        return "%s %s to %s" % (T.red("write"), T.bold(
            "%d bytes" % byte_count), T.underline(path)), byte_count
    else:
        return None, None
예제 #2
0
def format_write(file_descriptor, byte_count):
    if file_descriptor in file_descriptors:
        path = file_descriptors[file_descriptor]
        return "%s %s to %s" % (T.red("write"), T.bold(
            "%d bytes" % byte_count), T.underline(path))
    else:
        return None
예제 #3
0
def format_open(path, flags):
    path = abspath(path)
    if path in allowed_files:
        return None
    elif (flags & O_CREAT) and not exists(path):
        return "%s %s" % (T.cyan("create file"), T.underline(path))
    elif (flags & O_TRUNC) and exists(path):
        return "%s %s" % (T.red("truncate file"), T.underline(path))
    else:
        return None
예제 #4
0
def format_open(path, flags):
    path = abspath(path)
    if path in allowed_files:
        return None
    elif (flags & O_CREAT) and not exists(path):
        return "%s %s" % (T.cyan("create file"), T.underline(path))
    elif (flags & O_TRUNC) and exists(path):
        return "%s %s" % (T.red("truncate file"), T.underline(path))
    else:
        return None
예제 #5
0
def filter_open(process, path, flags):
    if path in allowed_files:
        return None, None
    if (flags & O_CREAT) and not exists(path):
        operation = "%s %s" % (T.cyan("create file"), T.underline(path))
    elif (flags & O_TRUNC) and exists(path):
        operation = "%s %s" % (T.red("truncate file"), T.underline(path))
    else:
        operation = None
    if (flags & O_WRONLY) or (flags & O_RDWR) or (flags & O_APPEND) or (operation is not None):
        # File might be written to later, so we need to track the file descriptor
        return_value = process.register_path(path)
    else:
        return_value = None
    return operation, return_value
예제 #6
0
파일: delete.py 프로젝트: teo-binary/maybe
def filter_delete(path):
    return "%s %s" % (T.red("delete"), T.underline(path)), 0
예제 #7
0
def format_write(file_descriptor, byte_count):
    if file_descriptor in file_descriptors:
        path = file_descriptors[file_descriptor]
        return "%s %s to %s" % (T.red("write"), T.bold("%d bytes" % byte_count), T.underline(path))
    else:
        return None
예제 #8
0
def filter_write(process, file_descriptor, byte_count):
    if process.is_tracked_descriptor(file_descriptor):
        path = process.descriptor_path(file_descriptor)
        return "%s %s to %s" % (T.red("write"), T.bold("%d bytes" % byte_count), T.underline(path)), byte_count
    else:
        return None, None
예제 #9
0
파일: delete.py 프로젝트: liuchuan98/maybe
def filter_delete(path):
    return "%s %s" % (T.red("delete"), T.underline(path)), 0
예제 #10
0
파일: delete.py 프로젝트: restanrm/maybe
def format_delete(path):
    return "%s %s" % (T.red("delete"), T.underline(path))
예제 #11
0
def format_delete(path):
    return "%s %s" % (T.red("delete"), T.underline(abspath(path)))