Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore build directory
build/
*.egg-info/
2 changes: 1 addition & 1 deletion repeatfs/provenance/io_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get(cls, descriptor, management, pid=None):
""" Get IO for a descriptor and pid """
with management.lock:
if descriptor not in cls._lookup:
return
return {} if pid is None else None

if not pid:
return cls._lookup[descriptor]
Expand Down
7 changes: 6 additions & 1 deletion repeatfs/provenance/process_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def update(cls, pid, management, ignore_pipes=None):
if pid in cls._lookup:
# Update entry
process_record = cls._lookup[pid]
process_record._update(ignore_pipes)
process_record._update(ignore_pipes=ignore_pipes)
else:
# Create and register new entry
process_record = ProcessRecord(pid, management, ignore_pipes)
Expand Down Expand Up @@ -184,6 +184,11 @@ def _update(self, force=False, ignore_pipes=None):
# Record executable
try:
self.exe = os.readlink("/proc/{0}/exe".format(self.pid)) if self.pid > 1 else ""
# re-direction to the real path
if self.exe is not None and self.exe!="":
path=FileEntry.get_paths(self.exe, self.management.core.root, self.management.core.mount)
if path is not None and path['abs_real'] is not None:
self.exe=path['abs_real']
try:
self.md5 = self.management._calculate_hash(self.exe)
except (PermissionError, FileNotFoundError):
Expand Down
10 changes: 10 additions & 0 deletions repeatfs/provenance/replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,16 @@ def get_session_chains(self, filter_expanded):

# Update remaining
expand_remain.discard(parent_id)

unexpandable = {
pid for pid in expand_remain
if not any(
tuple(str(p[k]) for k in ["phost", "parent_start", "parent_pid"]) == pid
for p in self.provenance["process"].values()
)
}
session_children.update(unexpandable)
expand_remain -= unexpandable

# Build chains for all session children
for process_id in session_children:
Expand Down