mirror of
https://gitlab.gnome.org/World/Authenticator.git
synced 2025-03-04 08:44:40 +01:00
tools: Add a debug tool to read sandbox keyring
This commit is contained in:
parent
1d0085e445
commit
7d2b958082
3 changed files with 1504 additions and 0 deletions
1455
tools/keyring-fetcher/Cargo.lock
generated
Normal file
1455
tools/keyring-fetcher/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
10
tools/keyring-fetcher/Cargo.toml
Normal file
10
tools/keyring-fetcher/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "keyring-fetch"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
oo7 = {version = "0.1.0-alpha.5", features = ["tracing", "unstable", "async-std"]}
|
||||||
|
async-std = "1.11.0"
|
39
tools/keyring-fetcher/src/main.rs
Normal file
39
tools/keyring-fetcher/src/main.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
use std::{collections::HashMap, path::PathBuf};
|
||||||
|
|
||||||
|
#[async_std::main]
|
||||||
|
async fn main() -> oo7::Result<()> {
|
||||||
|
let home = std::env::var("HOME").unwrap();
|
||||||
|
let keyring_path = [
|
||||||
|
&home,
|
||||||
|
".var/app/com.belmoussaoui.Authenticator/data/keyrings/default.keyring",
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.collect::<PathBuf>();
|
||||||
|
|
||||||
|
let host_keyring = oo7::dbus::Service::new(oo7::dbus::Algorithm::Encrypted).await?;
|
||||||
|
let collection = host_keyring
|
||||||
|
.with_alias("login")
|
||||||
|
.await?
|
||||||
|
.expect("'login' collection not found");
|
||||||
|
|
||||||
|
let items = collection
|
||||||
|
.search_items(HashMap::from([(
|
||||||
|
"app_id",
|
||||||
|
"com.belmoussaoui.Authenticator",
|
||||||
|
)]))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let secret = items[0].secret().await?;
|
||||||
|
let keyring = oo7::portal::Keyring::load(keyring_path, &secret)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let keyring_items = keyring.items().await?;
|
||||||
|
for item in keyring_items.iter() {
|
||||||
|
let attributes = item.attributes();
|
||||||
|
let secret = item.secret();
|
||||||
|
println!("Found a secret: \nAttributes: {:#?}\nSecret: {:#?}", attributes, String::from_utf8_lossy(&secret));
|
||||||
|
println!("################################################");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue