-
Notifications
You must be signed in to change notification settings - Fork 242
adds binaries in path to collection #158
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -881,6 +881,8 @@ def __enter__(self): | |
def __exit__(self, type, value, traceback): | ||
del Logger.Extra.extras[self.key] | ||
|
||
PATH_ENVIRONMENT_NAME = "PATH" | ||
|
||
|
||
class Collector(object): | ||
|
||
|
@@ -913,6 +915,7 @@ def collect(self, section_list=None): | |
('safari', self._collect_safari), | ||
('accounts', self._collect_accounts), | ||
('mail', self._collect_mail), | ||
('executables', self._collect_binary_names_in_path) | ||
('full_hash', self._collect_full_hash) | ||
] | ||
|
||
|
@@ -1205,6 +1208,22 @@ def _collect_system_info(self): | |
} | ||
Logger.log_dict(record) | ||
|
||
def _collect_binary_names_in_path(self): | ||
"""Collect the names of executable binaries in the PATH environment""" | ||
exe_files = [] | ||
|
||
def is_exe(fpath): | ||
return os.path.isfile(fpath) and os.path.exists(fpath) and os.access(fpath, os.X_OK) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
|
||
if PATH_ENVIRONMENT_NAME in os.environ: | ||
for bin_dir in os.environ[PATH_ENVIRONMENT_NAME].split(":"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super small nit and probably unnecessary since OS X uses colon as path separator by default, but maybe using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense @leeren, I'll update it. |
||
for root_dir, dirs, files in os.walk(bin_dir): | ||
for the_file in files: | ||
file_path = os.path.join(root_dir, the_file) | ||
if is_exe(file_path): | ||
exe_files.append(file_path) | ||
Logger.log_dict({"executable_files": exe_files}) | ||
|
||
def _collect_startup(self): | ||
"""Log the different LauchAgents and LaunchDaemons""" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a missing
,
at the end of this line?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ I missed this copy pasting between different checkouts