-
Notifications
You must be signed in to change notification settings - Fork 243
Conversation
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.
Would be good to add some unit tests for this new functionality :)
osxcollector/osxcollector.py
Outdated
@@ -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) |
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
osxcollector/osxcollector.py
Outdated
return os.path.isfile(fpath) and os.path.exists(fpath) and os.access(fpath, os.X_OK) | ||
|
||
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 comment
The 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 os.pathsep
for more readability?
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.
makes sense @leeren, I'll update it.
osxcollector/osxcollector.py
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
os.path.isfile
always implies os.path.exists
, so the latter seems redundant. You could also have a directory mislabelled as an executable which would probably further encourage just using os.path.isfile
and os.access
alone.
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.
ditto
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.
Looks good to me besides missing comma on line 918
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.
Ship it!
This change adds binaries in the PATH environment variable to the collection