mirror of
https://github.com/002Hub/IPass.git
synced 2025-04-19 22:01:21 +02:00
update library
This commit is contained in:
parent
f3c0b89bdf
commit
3a80459b1c
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -193,20 +193,19 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ip_lib"
|
name = "ip_lib"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"brotli",
|
"brotli",
|
||||||
"hex",
|
"hex",
|
||||||
"home",
|
"home",
|
||||||
"rand",
|
"rand",
|
||||||
"rpassword",
|
|
||||||
"sha2",
|
"sha2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipass"
|
name = "ipass"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ip_lib",
|
"ip_lib",
|
||||||
"rpassword",
|
"rpassword",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ipass"
|
name = "ipass"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
2
library
2
library
@ -1 +1 @@
|
|||||||
Subproject commit 380ae204378be877fffb7ee7f9167748defc2156
|
Subproject commit d2c9adefdc4a7096ff7047f830807245291407fa
|
15
src/main.rs
15
src/main.rs
@ -56,6 +56,11 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ask_for_pw() -> String {
|
||||||
|
let output = rpassword::prompt_password("Please enter the master password: ").unwrap();
|
||||||
|
return output.replace("\n", "").replace("\r","");
|
||||||
|
}
|
||||||
|
|
||||||
fn version_help(version: &str) {
|
fn version_help(version: &str) {
|
||||||
let mut data = version.split(".");
|
let mut data = version.split(".");
|
||||||
print!("Major {} ", data.next().unwrap());
|
print!("Major {} ", data.next().unwrap());
|
||||||
@ -176,7 +181,7 @@ fn add(args: &Vec<String>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
println!("Adding password for {}",args[2]);
|
println!("Adding password for {}",args[2]);
|
||||||
let succeeded: bool = ip_lib::create_entry(&args[2], pw);
|
let succeeded: bool = ip_lib::create_entry(&args[2], pw, ask_for_pw());
|
||||||
if !succeeded {
|
if !succeeded {
|
||||||
println!("You already have an entry with that name! Did you mean to use \"edit\"?");
|
println!("You already have an entry with that name! Did you mean to use \"edit\"?");
|
||||||
return;
|
return;
|
||||||
@ -194,7 +199,7 @@ fn get(args: &Vec<String>) {
|
|||||||
let filepath = &(ip_lib::get_ipass_folder()+name+".ipass");
|
let filepath = &(ip_lib::get_ipass_folder()+name+".ipass");
|
||||||
if std::path::Path::new(filepath).exists() {
|
if std::path::Path::new(filepath).exists() {
|
||||||
println!("Getting entry");
|
println!("Getting entry");
|
||||||
let entry: String = ip_lib::get_entry(name);
|
let entry: String = ip_lib::get_entry(name, ask_for_pw());
|
||||||
let mut data = entry.split(";");
|
let mut data = entry.split(";");
|
||||||
println!("Username: '{}' Password: '{}'",data.next().unwrap(),data.next().unwrap());
|
println!("Username: '{}' Password: '{}'",data.next().unwrap(),data.next().unwrap());
|
||||||
} else {
|
} else {
|
||||||
@ -218,7 +223,7 @@ fn changepw(args: &Vec<String>) {
|
|||||||
output = args[3].clone();
|
output = args[3].clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_lib::edit_password(&args[2], output);
|
ip_lib::edit_password(&args[2], output, ask_for_pw());
|
||||||
|
|
||||||
println!("Changed Password of {}!", args[2]);
|
println!("Changed Password of {}!", args[2]);
|
||||||
} else {
|
} else {
|
||||||
@ -241,7 +246,7 @@ fn changeuser(args: &Vec<String>) {
|
|||||||
output = args[3].clone();
|
output = args[3].clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_lib::edit_username(&args[2], output);
|
ip_lib::edit_username(&args[2], output, ask_for_pw());
|
||||||
|
|
||||||
println!("Changed Username of {}!", args[2]);
|
println!("Changed Username of {}!", args[2]);
|
||||||
} else {
|
} else {
|
||||||
@ -257,7 +262,7 @@ fn rename(args: &Vec<String>) {
|
|||||||
}
|
}
|
||||||
let filepath = &(ip_lib::get_ipass_folder()+&args[2]+".ipass");
|
let filepath = &(ip_lib::get_ipass_folder()+&args[2]+".ipass");
|
||||||
if std::path::Path::new(filepath).exists() {
|
if std::path::Path::new(filepath).exists() {
|
||||||
ip_lib::rename(&args[2],&args[3]);
|
ip_lib::rename(&args[2],&args[3], ask_for_pw());
|
||||||
println!("Renamed {} to {}", args[2], args[3]);
|
println!("Renamed {} to {}", args[2], args[3]);
|
||||||
} else {
|
} else {
|
||||||
println!("No such file");
|
println!("No such file");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user