{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/osquery/pulls/comments/81598983","pull_request_review_id":2567338,"id":81598983,"diff_hunk":"@@ -0,0 +1,46 @@\n+/*\n+*  Copyright (c) 2014-present, Facebook, Inc.\n+*  All rights reserved.\n+*\n+*  This source code is licensed under the BSD-style license found in the\n+*  LICENSE file in the root directory of this source tree. An additional grant\n+*  of patent rights can be found in the PATENTS file in the same directory.\n+*\n+*/\n+\n+#include \"osquery/core/conversions.h\"\n+#include \"osquery/core/windows/wmi.h\"\n+#include <osquery/tables.h>\n+\n+namespace osquery {\n+namespace tables {\n+\n+#define WMI_QUERY \"SELECT CAPTION,VERSION FROM Win32_OperatingSystem\"\n+\n+QueryData genOSVersion(QueryContext& context) {\n+  WmiRequest wmiRequest(WMI_QUERY);\n+  std::vector<WmiResultItem>& wmiResults = wmiRequest.results();\n+\n+  if (wmiResults.size() == 0) {\n+    return {};\n+  }\n+\n+  Row r;\n+  std::string version_string;\n+\n+  wmiResults[0].GetString(\"Caption\", r[\"name\"]);\n+  wmiResults[0].GetString(\"Version\", version_string);\n+  auto version = osquery::split(version_string, \".\");\n+\n+  switch (version.size()) {","path":"osquery/tables/system/windows/os_version.cpp","position":36,"original_position":35,"commit_id":"57429a400f92c547a6bbe55efe050d1536965cba","original_commit_id":"5c225d0a5e02c47089fd726d72dcda89cf0fab9a","user":{"login":"ExtremeGTX","id":6371120,"avatar_url":"https://avatars.githubusercontent.com/u/6371120?v=3","gravatar_id":"","url":"https://api.github.com/users/ExtremeGTX","html_url":"https://github.com/ExtremeGTX","followers_url":"https://api.github.com/users/ExtremeGTX/followers","following_url":"https://api.github.com/users/ExtremeGTX/following{/other_user}","gists_url":"https://api.github.com/users/ExtremeGTX/gists{/gist_id}","starred_url":"https://api.github.com/users/ExtremeGTX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExtremeGTX/subscriptions","organizations_url":"https://api.github.com/users/ExtremeGTX/orgs","repos_url":"https://api.github.com/users/ExtremeGTX/repos","events_url":"https://api.github.com/users/ExtremeGTX/events{/privacy}","received_events_url":"https://api.github.com/users/ExtremeGTX/received_events","type":"User","site_admin":false},"body":"I can't imagine a scenario where i will get empty version, but default case is always considered as good practice ","created_at":"2016-10-03T17:32:21Z","updated_at":"2016-10-03T17:32:21Z","html_url":"https://github.com/facebook/osquery/pull/2586#discussion_r81598983","pull_request_url":"https://api.github.com/repos/facebook/osquery/pulls/2586","_links":{"self":{"href":"https://api.github.com/repos/facebook/osquery/pulls/comments/81598983"},"html":{"href":"https://github.com/facebook/osquery/pull/2586#discussion_r81598983"},"pull_request":{"href":"https://api.github.com/repos/facebook/osquery/pulls/2586"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/osquery/pulls/2586","id":87649314,"html_url":"https://github.com/facebook/osquery/pull/2586","diff_url":"https://github.com/facebook/osquery/pull/2586.diff","patch_url":"https://github.com/facebook/osquery/pull/2586.patch","issue_url":"https://api.github.com/repos/facebook/osquery/issues/2586","number":2586,"state":"open","locked":false,"title":"Add virtual table os_version for windows","user":{"login":"ExtremeGTX","id":6371120,"avatar_url":"https://avatars.githubusercontent.com/u/6371120?v=3","gravatar_id":"","url":"https://api.github.com/users/ExtremeGTX","html_url":"https://github.com/ExtremeGTX","followers_url":"https://api.github.com/users/ExtremeGTX/followers","following_url":"https://api.github.com/users/ExtremeGTX/following{/other_user}","gists_url":"https://api.github.com/users/ExtremeGTX/gists{/gist_id}","starred_url":"https://api.github.com/users/ExtremeGTX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExtremeGTX/subscriptions","organizations_url":"https://api.github.com/users/ExtremeGTX/orgs","repos_url":"https://api.github.com/users/ExtremeGTX/repos","events_url":"https://api.github.com/users/ExtremeGTX/events{/privacy}","received_events_url":"https://api.github.com/users/ExtremeGTX/received_events","type":"User","site_admin":false},"body":"Add os_version virtual table for Windows \r\n","created_at":"2016-10-02T22:36:46Z","updated_at":"2016-10-03T17:32:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"65b816aaff5f1744a0034cdcce7c90382daf2300","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/osquery/pulls/2586/commits","review_comments_url":"https://api.github.com/repos/facebook/osquery/pulls/2586/comments","review_comment_url":"https://api.github.com/repos/facebook/osquery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/osquery/issues/2586/comments","statuses_url":"https://api.github.com/repos/facebook/osquery/statuses/57429a400f92c547a6bbe55efe050d1536965cba","head":{"label":"ExtremeGTX:master","ref":"master","sha":"57429a400f92c547a6bbe55efe050d1536965cba","user":{"login":"ExtremeGTX","id":6371120,"avatar_url":"https://avatars.githubusercontent.com/u/6371120?v=3","gravatar_id":"","url":"https://api.github.com/users/ExtremeGTX","html_url":"https://github.com/ExtremeGTX","followers_url":"https://api.github.com/users/ExtremeGTX/followers","following_url":"https://api.github.com/users/ExtremeGTX/following{/other_user}","gists_url":"https://api.github.com/users/ExtremeGTX/gists{/gist_id}","starred_url":"https://api.github.com/users/ExtremeGTX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExtremeGTX/subscriptions","organizations_url":"https://api.github.com/users/ExtremeGTX/orgs","repos_url":"https://api.github.com/users/ExtremeGTX/repos","events_url":"https://api.github.com/users/ExtremeGTX/events{/privacy}","received_events_url":"https://api.github.com/users/ExtremeGTX/received_events","type":"User","site_admin":false},"repo":{"id":69825757,"name":"osquery","full_name":"ExtremeGTX/osquery","owner":{"login":"ExtremeGTX","id":6371120,"avatar_url":"https://avatars.githubusercontent.com/u/6371120?v=3","gravatar_id":"","url":"https://api.github.com/users/ExtremeGTX","html_url":"https://github.com/ExtremeGTX","followers_url":"https://api.github.com/users/ExtremeGTX/followers","following_url":"https://api.github.com/users/ExtremeGTX/following{/other_user}","gists_url":"https://api.github.com/users/ExtremeGTX/gists{/gist_id}","starred_url":"https://api.github.com/users/ExtremeGTX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExtremeGTX/subscriptions","organizations_url":"https://api.github.com/users/ExtremeGTX/orgs","repos_url":"https://api.github.com/users/ExtremeGTX/repos","events_url":"https://api.github.com/users/ExtremeGTX/events{/privacy}","received_events_url":"https://api.github.com/users/ExtremeGTX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ExtremeGTX/osquery","description":"SQL powered operating system instrumentation, monitoring, and analytics.","fork":true,"url":"https://api.github.com/repos/ExtremeGTX/osquery","forks_url":"https://api.github.com/repos/ExtremeGTX/osquery/forks","keys_url":"https://api.github.com/repos/ExtremeGTX/osquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ExtremeGTX/osquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ExtremeGTX/osquery/teams","hooks_url":"https://api.github.com/repos/ExtremeGTX/osquery/hooks","issue_events_url":"https://api.github.com/repos/ExtremeGTX/osquery/issues/events{/number}","events_url":"https://api.github.com/repos/ExtremeGTX/osquery/events","assignees_url":"https://api.github.com/repos/ExtremeGTX/osquery/assignees{/user}","branches_url":"https://api.github.com/repos/ExtremeGTX/osquery/branches{/branch}","tags_url":"https://api.github.com/repos/ExtremeGTX/osquery/tags","blobs_url":"https://api.github.com/repos/ExtremeGTX/osquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ExtremeGTX/osquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ExtremeGTX/osquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/ExtremeGTX/osquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ExtremeGTX/osquery/statuses/{sha}","languages_url":"https://api.github.com/repos/ExtremeGTX/osquery/languages","stargazers_url":"https://api.github.com/repos/ExtremeGTX/osquery/stargazers","contributors_url":"https://api.github.com/repos/ExtremeGTX/osquery/contributors","subscribers_url":"https://api.github.com/repos/ExtremeGTX/osquery/subscribers","subscription_url":"https://api.github.com/repos/ExtremeGTX/osquery/subscription","commits_url":"https://api.github.com/repos/ExtremeGTX/osquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/ExtremeGTX/osquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/ExtremeGTX/osquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/ExtremeGTX/osquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/ExtremeGTX/osquery/contents/{+path}","compare_url":"https://api.github.com/repos/ExtremeGTX/osquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ExtremeGTX/osquery/merges","archive_url":"https://api.github.com/repos/ExtremeGTX/osquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ExtremeGTX/osquery/downloads","issues_url":"https://api.github.com/repos/ExtremeGTX/osquery/issues{/number}","pulls_url":"https://api.github.com/repos/ExtremeGTX/osquery/pulls{/number}","milestones_url":"https://api.github.com/repos/ExtremeGTX/osquery/milestones{/number}","notifications_url":"https://api.github.com/repos/ExtremeGTX/osquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ExtremeGTX/osquery/labels{/name}","releases_url":"https://api.github.com/repos/ExtremeGTX/osquery/releases{/id}","deployments_url":"https://api.github.com/repos/ExtremeGTX/osquery/deployments","created_at":"2016-10-02T22:28:36Z","updated_at":"2016-10-02T22:28:38Z","pushed_at":"2016-10-03T17:23:54Z","git_url":"git://github.com/ExtremeGTX/osquery.git","ssh_url":"git@github.com:ExtremeGTX/osquery.git","clone_url":"https://github.com/ExtremeGTX/osquery.git","svn_url":"https://github.com/ExtremeGTX/osquery","homepage":"https://osquery.io","size":9251,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"b69981584fb0dc305688251fb08f9dc1b6b88fba","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":22394357,"name":"osquery","full_name":"facebook/osquery","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/osquery","description":"SQL powered operating system instrumentation, monitoring, and analytics.","fork":false,"url":"https://api.github.com/repos/facebook/osquery","forks_url":"https://api.github.com/repos/facebook/osquery/forks","keys_url":"https://api.github.com/repos/facebook/osquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/osquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/osquery/teams","hooks_url":"https://api.github.com/repos/facebook/osquery/hooks","issue_events_url":"https://api.github.com/repos/facebook/osquery/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/osquery/events","assignees_url":"https://api.github.com/repos/facebook/osquery/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/osquery/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/osquery/tags","blobs_url":"https://api.github.com/repos/facebook/osquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/osquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/osquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/osquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/osquery/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/osquery/languages","stargazers_url":"https://api.github.com/repos/facebook/osquery/stargazers","contributors_url":"https://api.github.com/repos/facebook/osquery/contributors","subscribers_url":"https://api.github.com/repos/facebook/osquery/subscribers","subscription_url":"https://api.github.com/repos/facebook/osquery/subscription","commits_url":"https://api.github.com/repos/facebook/osquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/osquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/osquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/osquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/osquery/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/osquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/osquery/merges","archive_url":"https://api.github.com/repos/facebook/osquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/osquery/downloads","issues_url":"https://api.github.com/repos/facebook/osquery/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/osquery/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/osquery/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/osquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/osquery/labels{/name}","releases_url":"https://api.github.com/repos/facebook/osquery/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/osquery/deployments","created_at":"2014-07-29T20:27:33Z","updated_at":"2016-10-03T15:31:13Z","pushed_at":"2016-10-03T17:23:56Z","git_url":"git://github.com/facebook/osquery.git","ssh_url":"git@github.com:facebook/osquery.git","clone_url":"https://github.com/facebook/osquery.git","svn_url":"https://github.com/facebook/osquery","homepage":"https://osquery.io","size":13349,"stargazers_count":7134,"watchers_count":7134,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":798,"mirror_url":null,"open_issues_count":73,"forks":798,"open_issues":73,"watchers":7134,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/osquery/pulls/2586"},"html":{"href":"https://github.com/facebook/osquery/pull/2586"},"issue":{"href":"https://api.github.com/repos/facebook/osquery/issues/2586"},"comments":{"href":"https://api.github.com/repos/facebook/osquery/issues/2586/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/osquery/pulls/2586/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/osquery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/osquery/pulls/2586/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/osquery/statuses/57429a400f92c547a6bbe55efe050d1536965cba"}}}}
{"actor":{"display_login":"ExtremeGTX"}}