-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up Desktop and Temporary Files #747
Conversation
f0ecded
to
f53466c
Compare
4fa0631
to
81ee509
Compare
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.
This is great work @emtuls!
We need a single wrapper function (called something like VM-Clean-Up
) that executes the 4 steps (the 4 functions you have created) as we may need to call this function manually often. I would keep the functions that have more logic, but I would get rid of the ones that just execute just one command and just call the command directly.
I like to be able to provide items to ignore for deletion (as you are doing) and I think we should have the ignore arguments in the wrapper function as well.
[nitpick] Do not include the issue number in the commit message header and limit the header to 50 (commit message good practice). In this case the commit number is referring the wrong issue (because it is from another repo). In general I like to add the whole GitHub url as you can also use from outside GitHub. As an example, I would write:
common.vm: Add clean up helper function
Add helper function than cleans up space including deleting desktop files and
temporary files.
Resolves https://github.com/mandiant/flare-vm/issues/517
31df720
to
c6e9494
Compare
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.
This looks great! We need to discuss what to do with the linter complain that seems to not improve the code and then we are ready to go 😃
# Ensure that "PS_Transcripts", "Desktop\Tools", and "fakenet_logs" folders are not to be deleted. | ||
$defaultExcludedFolders = @("PS_Transcripts", ${Env:TOOL_LIST_DIR}, "fakenet_logs") | ||
$excludeFolders = $excludeFolders + $defaultExcludedFolders | ||
$excludeFiles = $excludeFiles # required for lint.ps1 to pass |
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.
why is this exactly needed? What does the linter complain about?
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.
The linter says that the $excludeFiles
variable isn't used, even though it is being used in the if statement
. I think this might be a bug in how they are parsing things.
It said the same for $excludeFolders
as well, but now that we add + $defaultExcludedFolders
, this is a little less obvious that I was doing the same thing for that variable as well.
c6e9494
to
7e40a15
Compare
Add helper function than cleans up space including deleting desktop files and temporary files. Resolves mandiant/flare-vm#517
7e40a15
to
6319162
Compare
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.
Thanks for all the work @emtuls!!!
We originally decided to prevent that `PS_Transcripts` is deleted in: mandiant#747 But after installing FLARE-VM I would like to delete the files generated by the installation in the `PS_Transcripts` directory. Remove the protection, allowing to delete this folder. It is still possible to keep it using the `excludedFolders` function argument.
This resolves mandiant/flare-vm#517 by adding each command to a separate function. These functions will need to be called from somewhere in order for them to work.
The desktop function is run against both the Current User and 'Public' desktops due to some cases where desktop icons showing on Current User desktop that are only located in Public/Desktop.