嘗試做一個 envchain 的仿品 (3)

ruby-dbus 去戳 D-Bus,可以順利解出 KWallet 的…binary 資料?

require 'dbus'
require 'pp'
session_bus = DBus.session_bus
kwalletd_service = session_bus["org.kde.kwalletd5"]
kwalletd_object = kwalletd_service.object "/modules/kwalletd5"
kwalletd_interface = kwalletd_object["org.kde.KWallet"]
handle ="kdewallet", 0, "Ruby D-Bus Client").first
pp kwalletd_interface
pp kwalletd_interface.folderList(handle, "Ruby D-Bus Client")
pp kwalletd_interface.entryList(handle, "Network Management", "Ruby D-Bus Client")
pp kwalletd_interface.readMap(handle, "Network Management", "{????????-????-????-????-????????????};802-11-wireless-security", "Ruby D-Bus Client").first

翻了一下網上資料才知道是這個原因:[Bug 256155 – KWallet’s readMap is not friendly to non-C++ applications],昏倒,這同時解釋了為什麼 kwallet-query 這專用工具可以解出 human readable 的密碼,而泛用工具不行。

以上只是想要瞭解 KWallet 的操作,為之後的 coding 鋪路,實務上應該還有路可繞。為了泛用性,最多就是不要用 map 而已。

CC BY-SA 4.0 This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *