Split Program.cs to separate focused files #16
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why these changes?:
Similarly to the refactoring in Rubeus and Watson (https://github.com/rasta-mouse/Watson), the 6927 line
program.cs
class is a bit of a monster here too.This is a nightmare to try to read and understand, and will be a problem to maintain and add to going forward.
What's changed - in brief:
probe
class in\Probes\
ToFile
- that allows outputting the results to a fileBefore: Completed All Safety Checks in 41 seconds
Now: Completed All Safety Checks in 18 seconds
PR 14 (Fix issues with parsing of Service binary paths #14) (and fixed a null reference exception)
PR 15 (Add ListAppLockerSettings() #15)
What hasn't changed:
Comments
While working on the code I noticed that
all
wasn't running all the available checks - as the help text implied - this version will run all the available checks ifall
is selected <- is this correct? If not theProbePresets\AllPreset.cs
can simply be changed and the original lines uncommitted.The probes are in the
Probes
folder and the Presets ( full \ all \ user \ system ) are in theProbePresets
FolderThe new version produces a lot more output - due to better coping with exceptions.
Testing
I've tested the changes on 2 machines by piping the output from the original version and new versions, and Diffing the output. As far as I can see the functionality between the 2 versions is unchanged except for newline differences and the extra output as noted above.
How to add new probes?
Every probe/check class needs to implement
IProbe
and have aProbeName
property to identify the check.The program will automatically add the probe to the available probes and call it if required. (Just need to add the name & info to the
Info.cs
class)