Add docstrings

This commit is contained in:
Andrew Case
2020-03-12 19:47:15 +00:00
committed by ikelos
parent 7b21e83b07
commit 722700d2dc
2 changed files with 24 additions and 0 deletions
+15
View File
@@ -219,6 +219,21 @@ class MacUtilities(object):
context: interfaces.context.ContextInterface,
task: interfaces.objects.ObjectInterface):
"""Creates a generator for the file descriptors of a process
Args:
symbol_table_name: The name of the symbol table associated with the process
context:
task: The process structure to enumerate file descriptors from
Return:
A 3 element tuple is yielded for each file descriptor:
1) The file's object
2) The path referenced by the descriptor.
The path is either empty, the full path of the file in the file system, or the formatted name for sockets, pipes, etc.
3) The file descriptor number
"""
try:
num_fds = task.p_fd.fd_lastfile
except exceptions.InvalidAddressException:
@@ -36,6 +36,15 @@ class Netstat(plugins.PluginInterface):
filter_func: Callable[[int], bool] = lambda _: False) -> \
Iterable[interfaces.objects.ObjectInterface]:
"""
Returns the open socket descriptors of a process
Return values:
A tuple of 3 elements:
1) The name of the process that opened the socket
2) The process ID of the processed that opened the socket
3) The address of the associated socket structure
"""
for task in tasks.Tasks.list_tasks(context,
layer_name,
darwin_symbols,