-
Notifications
You must be signed in to change notification settings - Fork 520
pebmasquerade plugin #1825
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
base: develop
Are you sure you want to change the base?
pebmasquerade plugin #1825
Conversation
added _UNICODE_STRING length checks.
|
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.
A number of little issues around this one, it feels like a lot of string manipulation that don't necessarily feel robust. I'll give it another look once you've addressed the comments though...
] | ||
|
||
@staticmethod | ||
def _get_cmdline_image(cmdline: str) -> Union[str, PureWindowsPath]: |
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 wouldn't we just return a string in all instances? By returning a path we're making people potentially test whether it's a path object or not? When would we return a string?
return "" | ||
|
||
# Regex to extract first .exe ending string (handles quotes, paths, no quotes) | ||
match = re.search(r'(?i)(["\']?)([^"\']*?\.exe)\1(?=\s|$)', cmdline) |
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 feels brittle and impenetrable. This will also prevent executables like pat o'malley.exe
which I believe would be a legitimate path. Let's not code all this complexity into a regex, but clarify exactly the process we're going through to find the first parameter (which would return the same results whether it ended in .exe or not, so splitting it into two cases seems pointless?).
return "" | ||
|
||
@staticmethod | ||
def _are_paths_equal(device_path: str, drive_path: str) -> Tuple[bool, str, str]: |
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.
Given the return values, this feels like it's doing too much? Either people will use the two additional results (and carrying out their own equality test is trivial) or they only care about the equality and unpacking a tuple to get to it is a bit pointless. Consider rethinking what this is trying to achieve...
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 function is not that trivial because it checks if a windows device path (i.e \Device\HardDIsk03\path) equals to its drive path (i.e C:\path), and both of the new paths are returned as well because they are then used for the note, maybe I should change the function name & description? also you are saying it is better if I simply returned the results and have the caller check if its equal? thats possible too but then _are_paths_equal need to be changed as well to something like _normalize_paths
eprocess_seaudit_imagefilename, | ||
peb_imagefilepath, | ||
peb_cmdline_path_render, | ||
"[" + ", ".join(notes) + "]" if notes else "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.
This doesn't allow programs consuming the results to parse the data easily. Rather than designing the output for human consumption, each boolean should be returned as a field and the UI allowed to display the results as it sees fit.
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.
@ikelos you mean, every type of note should be a different column? then its a bit hard to supply the values because its not boolean... what I meant to achieve is to create a list as str that can easily be parsed by python and such. but I guess its not the best approach
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.
Well, if they're strings that need to be strings, then I guess use them, but the point is putting them in a list rather than each having its own column will make it much harder for other automated systems to make use of the output. Ideally any that could be represented as a boolean should be to make the columns as thin as possible (for humans to read).
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 dont see how it can be each in its own column, but the 'OK' Note with json renderer and a tool like jq like I previewed my test, makes it quite easy to go through results, I dont think it can be converted to human readable grid as long as there are notes... I can remove the notes and then people need to check themselves if names, length etc are not equal but thats also a pain
Hello, trying my way around os internals & memory :P