we can inspect 3rd party website cookies (yikes, but also wow)

This commit is contained in:
Brandon Thomas committed 2025-04-07 01:21:19 -04:00
1 parent 320af54e14
commit 2ca80ed9dc
6 files changed
+65 -4

No files matched your search

+1 -1
View File
@@ -51,7 +51,7 @@ serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
tauri = { version = "2.4.1", features = [] }
tauri = { version = "2.4.1", features = ["unstable"] }
tauri-plugin-log = "2.3.1"
tempdir = "0.3.7"
tempfile = "3.18.0"
@@ -6,6 +6,7 @@ use image::codecs::png::{CompressionType, FilterType, PngEncoder};
use image::{DynamicImage, ImageReader};
use std::io::Cursor;
use log::{error, info};
use tauri::{AppHandle, Manager};
use openai_sora_client::credentials::SoraCredentials;
use openai_sora_client::image_gen::common::{ImageSize, NumImages};
use openai_sora_client::image_gen::sora_image_gen_remix::{sora_image_gen_remix, SoraImageGenRemixRequest};
@@ -13,9 +14,27 @@ use openai_sora_client::upload::upload_media_from_bytes::sora_media_upload_from_
use openai_sora_client::upload::upload_media_from_file::SoraMediaUploadRequest;
#[tauri::command]
pub async fn image_generation_command(image: &str, prompt: &str) -> Result<String, String> {
pub async fn image_generation_command(
image: &str,
prompt: &str,
app: AppHandle,
) -> Result<String, String> {
info!("image_generation_command called; processing image...");
for (w, webview) in app.webviews() {
info!("sending webview: {}", w);
//let result = webview.eval("window.location.replace('https://google.com');"); // works
//let result = webview.eval("document.body.innerHTML = 'hello'"); // works
let result = webview.eval("document.body.innerHTML = document.cookie");
if let Err(err) = result {
error!("Error with webview: {:?}", err)
}
}
if true {
return Ok("true".to_string());
}
let bytes = BASE64_STANDARD.decode(image)
.map_err(|err| format!("Base64 decode error: {}", err))?;
+4 -2
View File
@@ -1,12 +1,14 @@
pub mod commands;
pub mod events;
pub mod state;
pub mod threads;
pub mod transfer;
pub mod utils;
pub mod commands;
use crate::commands::flip_image::flip_image;
use crate::commands::image_generation_command::image_generation_command;
use crate::state::app_config::AppConfig;
use crate::threads::login_thread::login_thread;
use tauri_plugin_log::Target;
use tauri_plugin_log::TargetKind;
@@ -47,7 +49,7 @@ pub fn run() {
//}
let app = app.handle().clone();
//tauri::async_runtime::spawn(downloader_thread(app_data_root2, app));
tauri::async_runtime::spawn(login_thread(app));
Ok(())
})
@@ -0,0 +1,38 @@
use log::{error, info};
use tauri::{AppHandle, Manager, Webview};
use errors::AnyhowResult;
pub async fn login_thread(app: AppHandle) -> ! {
loop {
for (w, webview) in app.webviews() {
info!("Sending webview {}", w);
if let Err(err) = random_behavior(&webview) {
error!("Error in webview : {:?}", err);
}
}
tokio::time::sleep(std::time::Duration::from_millis(5_000)).await;
}
}
pub fn random_behavior(webview: &Webview) -> AnyhowResult<()> {
let rand = rand::random_range(0..5u8);
match rand {
0..3 => {
redirect_google(&webview)?;
}
_ => {
write_cookies_to_body(&webview)?;
}
}
Ok(())
}
pub fn redirect_google(webview: &Webview) -> AnyhowResult<()> {
webview.eval("window.location.replace('https://google.com');")?;
Ok(())
}
pub fn write_cookies_to_body(webview: &Webview) -> AnyhowResult<()> {
webview.eval("document.body.innerHTML = document.cookie")?;
Ok(())
}
@@ -0,0 +1 @@
pub mod login_thread;
+1
View File
@@ -339,6 +339,7 @@ export class Engine {
});
uiEvents.toolbarMain.SAVE.onClick(async (/*event*/) => {
document.location.href = "https://auth.openai.com/log-in";
console.log('save clicked');
await this.realTimeDrawEngine.saveOutput();
});