Skip to content
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

Add FileVersionRaw Column to File Table for Windows #5737

Closed
matthewjurczyk opened this issue Aug 29, 2019 · 5 comments
Closed

Add FileVersionRaw Column to File Table for Windows #5737

matthewjurczyk opened this issue Aug 29, 2019 · 5 comments
Labels
easy feature good-first-issue Well defined easy issue. Good for the beginning contribution. Windows

Comments

@matthewjurczyk
Copy link

matthewjurczyk commented Aug 29, 2019

Feature request

What new feature do you want?

Add FileVersionRaw Column to File Table for Windows

How is this new feature useful?

Having the ProductVersionRaw is a big help already! Some Files use FileVersionRaw instead of Product.

I could query a executable for its FileVersion and track it overtime for auto updates

How can this be implemented?

Add FileVersionRaw to the files table, should be a simple addition since productversionraw is already in 4.0

@alessandrogario alessandrogario added easy feature good-first-issue Well defined easy issue. Good for the beginning contribution. table Windows labels Aug 29, 2019
@nasehim7
Copy link
Contributor

Hey @alessandrogario I would be interested in working on this

@alessandrogario
Copy link
Member

Hey @alessandrogario I would be interested in working on this

Go for it! Thanks for helping us out! 😄

@nasehim7
Copy link
Contributor

nasehim7 commented Sep 6, 2019

@alessandrogario from what I can see from the code the addition seems to be made in the following files:

osquery/osquery/tables/utility/file.cpp
osquery/osquery/filesystem/fileops.h
osquery/osquery/filesystem/fileops.h

The problem is in the fileops.h file, we have the blueprint of windowsGetFileVersion() method which gets the product version of the entity. A similar function needs to be implemented for getting the file version as well. We would be needing a new method because the current implementation of windowsGetFileVersion() takes rVersion parameter which is a reference to product_version of the windows stat file. Editing the same function(ex: instead of passing the rVersion we could pass the stat file) is going to put some changes in the other files as well like for example:

osquery⁩/osquery⁩/⁨tables⁩/system⁩/windows/ie_extensions.cpp calls the same function in the code

Also I feel it would be more meaningful to name the function as windowsGetProductVersion() then. I need your inputs on this as you might be having some better ways to do this?

@alessandrogario
Copy link
Member

Hello @nasehim7!

in order not to duplicate the logic inside the function, you could also just add a new parameter to it while also refactoring the names a little:

Status windowsGetVersionSomething(const std::string& path,
                                  std::string& product_version,
                                  std::string& file_version) {
}

Another approach could be to extract the logic in a function defined in an anonymous namespace inside the implementation file.

Thanks for looking into this! 😄

@nasehim7
Copy link
Contributor

nasehim7 commented Sep 7, 2019

Thanks @alessandrogario for your inputs. I have raised a PR for the same :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy feature good-first-issue Well defined easy issue. Good for the beginning contribution. Windows
Projects
None yet
Development

No branches or pull requests

3 participants