-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bf9351
commit 133720b
Showing
10 changed files
with
181 additions
and
32 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,9 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
pub fn readrc_value(key: &str) -> String { | ||
let fkey = format!("{}=", key); | ||
let home = format!("{}.witchrc", get_os_env("HOME")); | ||
|
||
match fs::read_to_string(&home) { | ||
Ok(file) => { | ||
let lines: Vec<&str> = file.split("\n").collect(); | ||
for line in lines { | ||
if line.contains(&fkey) { | ||
return line.replace(&fkey, ""); | ||
} | ||
} | ||
"".to_string() | ||
}, | ||
Err(err) => { | ||
println!("{}-{}", err, home); | ||
return "error".to_string(); | ||
} | ||
} | ||
} | ||
|
||
#[tauri::command] | ||
fn read_json() -> String { | ||
let witchrc = readrc_value("path_log_file"); | ||
let home = get_os_env("HOME"); | ||
let path = witchrc.replace("~/", &home); | ||
|
||
fs::read_to_string(&path) | ||
} | ||
|
||
|
||
|
||
fn main() { | ||
witch_oracle_lib::run() | ||
} | ||
|
||
#[cfg(test)] | ||
mod test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod tests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use fs::File; | ||
use mockall::prelude::*; | ||
use std::env; | ||
use std::fs; | ||
|
||
#[test] | ||
fn readrc_value_empty_file() { | ||
// Create an empty file at HOME/.witchrc | ||
fs::create_dir_all(env::var("HOME").unwrap()); | ||
let mut file = File::create(format!("/{}", env::var("HOME")).as_path()).unwrap(); | ||
let _ = file.write(b"").unwrap(); | ||
|
||
assert_eq!(readrc_value("test"), "error"); | ||
} | ||
|
||
#[test] | ||
fn readrc_value_found_line() { | ||
// Create a file at HOME/.witchrc with the key | ||
fs::create_dir_all(env::var("HOME").unwrap()); | ||
let mut file = File::create(format!("/{}", env::var("HOME")).as_path()).unwrap(); | ||
let data = b"test_key=test_value\n"; | ||
let _ = file.write(data).unwrap(); | ||
|
||
assert_eq!(readrc_value("test"), "test_value"); | ||
} | ||
|
||
#[test] | ||
fn readrc_value_not_found() { | ||
// Create a directory at HOME/.witchrc | ||
fs::create_dir_all(env::var("HOME").unwrap()); | ||
|
||
assert_eq!(readrc_value("test"), "".to_string()); | ||
} | ||
|
||
#[mockall::mock] | ||
impl fs for () { | ||
fn read_to_string<P>(&self, path: P) -> Result<String, std::io::Error> | ||
where | ||
P: AsRef<std::path::Path>, | ||
{ | ||
match path.as_ref().file_name() { | ||
Some(file_name) => { | ||
if *file_name == "test_file.txt" { | ||
return Ok("mock_value".to_string()); | ||
} | ||
Err(std::io::Error::new( | ||
std::io::ErrorKind::NotFound, | ||
"File not found", | ||
)); | ||
} | ||
None => Err(std::io::Error::new( | ||
std::io::ErrorKind::InvalidInput, | ||
"Invalid input", | ||
)), | ||
} | ||
} | ||
} | ||
|
||
#[test] | ||
fn read_json() { | ||
// Set the path_log_file key in HOME/.witchrc | ||
let mut file = File::create(format!("/{}", env::var("HOME")).as_path()).unwrap(); | ||
let data = b"{}=path_log_file=path_to_file.txt\n".to_vec(); | ||
let _ = file.write(data).unwrap(); | ||
|
||
// Assert that the read_json command returns "mock_value" | ||
assert_eq!(read_json(), "mock_value"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Assunto: Sua conta no @@social_media estará bloqueada devido a muitas tentativas de login | ||
|
||
Atenção! @@user_name, | ||
|
||
Nós detectamos muitas tentativas infruitosas para entrar na sua conta no @@social_media. Essa atividade sospita pode indicar que alguém está tentando acessar sua conta por meio de métodos de força bruta, o que pode representar um risco significativo para a segurança. | ||
|
||
Para garantir a integridade e a segurança de sua conta, vamos temporariamente bloquear essa conta por sua proteção. No entanto, você poderá recuperar o acesso seguindo os passos abaixo: | ||
|
||
1. Clique neste link @@phishing_email para verificar seu identidade e recuperar o acesso à sua conta. | ||
2. Forneça as informações necessárias, como seu endereço de email e uma senha forte. Lembre-se de que nós não armazenamos suas credenciais de login. Eles são criptografados para garantir a | ||
máxima segurança. | ||
3. Se você experimentar dificuldades durante o processo de verificação ou tiver alguma pergunta ou preocupação, por favor, entre em contato conosco através do endereço de email de suporte | ||
@@social_media_support_email. | ||
|
||
Sabemos que isso pode causar inconvenientes, mas priorizamos a segurança e a privacidade dos nossos usuários acima de tudo. Após o reativamento de sua conta, você poderá retomar a | ||
utilização do @@social_media sem problemas. | ||
|
||
Agradecemos pela sua compreensão e perdoamos pelo inconveniente causado. Desejamos uma boa sorte! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Subject: Urgent Account Security Update - Please Verify Your Login Credentials | ||
|
||
We are writing to inform you that there has been a security breach involving your Gmail account "bean". As a result of this breach, some sensitive information may have been compromised. To ensure the safety and integrity of your account, we kindly request that you follow the instructions below: | ||
|
||
1. Please click on the link provided below to access the Gmail Security Center: @@phishing_email | ||
|
||
2. Enter your email address and password to verify your login credentials. This process is essential for us to confirm your account status and apply necessary security measures. | ||
|
||
3. After verifying your credentials, you will be directed to a page where you can reset your password for added security. | ||
|
||
4. Once your password has been successfully updated, please log out of all active sessions and close any open browsers. | ||
|
||
5. To prevent future unauthorized access, we strongly recommend enabling two-factor authentication on your account. You can do this by visiting the "Security" tab in your Gmail settings. | ||
|
||
We apologize for any inconvenience this may cause and appreciate your understanding and cooperation as we strive to protect your online security. If you have any questions or concerns, | ||
please feel free to contact our Customer Support Team at [insert fraudulent support email]. | ||
|
||
Sincerely, | ||
The Gmail Security Team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Subject: Important HR Update and Request | ||
|
||
Dear @@employer_name, | ||
|
||
I hope this email finds you well. I am writing to inform you about an urgent matter related to your employment at our company. It has recently come to our attention that there might be some | ||
discrepancies in your personnel records, which could potentially affect your status and benefits. | ||
|
||
To ensure the accuracy of our employee database, we kindly request you to verify your personal information by clicking on the following link: @@phishing_link | ||
|
||
Please note that this is a confidential matter and requires immediate attention from all employees. We strongly encourage you to complete this process as soon as possible to prevent any | ||
inconvenience or delays in our communication with you. | ||
|
||
Once again, we apologize for any inconvenience caused and appreciate your cooperation in this important HR matter. If you have any questions or concerns, please feel free to reach out to | ||
the Human Resources department at [HR email address]. | ||
|
||
Thank you and have a great day! | ||
|
||
Best regards, | ||
|
||
@@your_name | ||
@@your_title | ||
@@company_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Dear @@user_name, | ||
|
||
We hope this email finds you well. We have recently detected multiple failed attempts to log into your account on @@social_media_platform_name. This suspicious behavior may indicate that | ||
someone is trying to access your account using brute force methods, which can pose a significant security risk. | ||
|
||
To ensure the safety and integrity of your account, we will temporarily lock it for your protection. However, you can regain access by following the steps below: | ||
|
||
1. Click on this link @@phishing_link to verify your identity and regain access to your account. | ||
2. Provide the necessary information, such as your email address and a strong password. Please note that we do not store your login credentials. They are encrypted for maximum security. | ||
3. If you experience any difficulties during the verification process or have any questions or concerns, please feel free to contact us at @@support_email_address. | ||
|
||
We understand that this may cause inconvenience, but we prioritize the security and privacy of our users above all else. Once your account is reactivated, you will be able to resume using | ||
@@social_media_platform_name without any issues. | ||
|
||
Thank you for your understanding, and we apologize for any inconvenience caused. We wish you a pleasant day! | ||
|
||
Best regards, | ||
|
||
@@your_name | ||
@@your_title | ||
@@company_name |