目錄

工具介紹-osquery

介紹

osquery 是由 facebook 開發的開源工具,可以運用在 Security、Compliance、Aduit方面,相較於其他工具,osquery 提供了一致的查詢方式與一致的結果呈現。從工具名稱就可看出,主打像取得db資料一樣的取得os資訊。在進行操作前可以先瞭解osquery所提供的schema

除了安裝版外,也提供免安裝版。

osqueryi 使用

安裝好後使用osqueryi指令進入進行操作interface。

取得檔案 hash value

以下以hash schema來示範。對hash schema查詢時,必需使用where來指定檔案,或資料夾。使用資料夾時會回傳資料夾內所有檔案hash值。

osqueryi "SELECT \* FROM hash WHERE path = 'path/to/file' "

上面指令可以列出檔案的hash值,並把所有欄位列出。

osqueryi "SELECT \* FROM hash WHERE directory = 'path/to/directory' "

上面指令可以列出路徑中所有檔案的hash值,並把所有欄位列出。

取得排程資訊

利用 scheduled_tasks 可以取得 Windows 上的排程資料

可以參考以下指令將 state 是 readyrunning 的 task 把 nameaction 列出來。

 c:\>osqueryi "select name, action from scheduled_tasks where state in ('ready','running')" 

輸出結果參考

+---------------------------+------------------------------------------------------------------+
| name                      | action                                                           |
+---------------------------+------------------------------------------------------------------+
| Adobe Acrobat Update Task |  C:\Program Files (x86)\Common Files\Adobe\ARM\1.0\AdobeARM.exe  |
+---------------------------+------------------------------------------------------------------+ 

參考資料