Skip to content

Commit

Permalink
Synapsploit v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DollarNoob committed Oct 23, 2024
1 parent 7f31af0 commit 9099a78
Show file tree
Hide file tree
Showing 8 changed files with 3,815 additions and 81 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synapsploit",
"version": "1.2.1",
"version": "1.3.0",
"description": "",
"type": "module",
"scripts": {
Expand Down
30 changes: 29 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "synapsploit"
version = "1.2.1"
version = "1.3.0"
description = "Synapse UI for MacSploit"
authors = ["DollarNoob"]
edition = "2021"
Expand All @@ -11,12 +11,13 @@ edition = "2021"
tauri-build = { version = "1", features = [] }

[dependencies]
tauri = { version = "1", features = [ "path-all", "fs-read-dir", "fs-read-file", "fs-write-file", "dialog-save", "dialog-open", "window-set-always-on-top", "system-tray", "window-unminimize", "window-close", "window-unmaximize", "window-maximize", "window-show", "window-hide", "window-minimize", "window-start-dragging", "shell-open"] }
tauri = { version = "1", features = [ "window-set-fullscreen", "fs-read-dir", "fs-read-file", "fs-write-file", "dialog-save", "dialog-open", "window-set-always-on-top", "system-tray", "window-unminimize", "window-close", "window-unmaximize", "window-maximize", "window-show", "window-hide", "window-minimize", "window-start-dragging", "shell-open"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
rfd = "0.14.1"
tauri-plugin-context-menu = "0.8.0"
toml = "0.8.16"
directories = "5.0.1"

[features]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/commands/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn open_options(handle: AppHandle) -> Result<(), String> {
.decorations(false)
.resizable(false)
.title("Synapse X - Options")
.inner_size(271.0, 335.0)
.inner_size(271.0, 230.0)
.center()
.accept_first_mouse(true)
.build()
Expand Down
231 changes: 194 additions & 37 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ mod msapi;
mod commands;

use std::env;
use std::cmp::{min, max};
use std::sync::Mutex;
use std::fs;
use tauri::{AppHandle, CustomMenuItem, Manager, PhysicalPosition, Position, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem};
use std::fs::create_dir;
use std::process::Command;
use directories::UserDirs;
use tauri::{AboutMetadata, CustomMenuItem, Manager, Menu, MenuItem, Submenu, WindowMenuEvent};
use commands::config;
use commands::macsploit;
use commands::window;
Expand All @@ -25,58 +27,213 @@ pub struct Config {
pub scan_port: bool
}

fn on_system_tray_event(handle: &AppHandle, event: SystemTrayEvent) {
match event {
SystemTrayEvent::LeftClick { .. } => {
let window = handle.get_window("main").unwrap();
match window.is_visible() {
Ok(true) => {
window.set_focus().expect("Failed to set focus");
fn on_menu_event(event: WindowMenuEvent) {
match event.menu_item_id() {
"open_autoexecute" => {
if let Some(user_dirs) = UserDirs::new() {
let document_dir = user_dirs.document_dir().expect("Documents directory does not exist");
let autoexec_dir = document_dir.join("Macsploit Automatic Execution");
if !autoexec_dir.exists() {
create_dir(&autoexec_dir).expect("Could not create automatic execution folder");
}
Ok(false) => {}
Err(_) => {}

// MacOS only
Command::new("open")
.args([autoexec_dir.to_str().unwrap()])
.spawn()
.unwrap();
}
}
"open_workspace" => {
if let Some(user_dirs) = UserDirs::new() {
let document_dir = user_dirs.document_dir().expect("Documents directory does not exist");
let workspace_dir = document_dir.join("Macsploit Workspace");
if !workspace_dir.exists() {
create_dir(&workspace_dir).expect("Could not create workspace folder");
}

if let Some(monitor) = window.current_monitor().ok().flatten() {
let monitor_size = monitor.size();
let window_size = window.inner_size().expect("Failed to get window size");
let window_position = window.outer_position().expect("Failed to get window position");
// MacOS only
Command::new("open")
.args([workspace_dir.to_str().unwrap()])
.spawn()
.unwrap();
}
}
"open_scripts" => {
let folder_dir = event.window().app_handle().path_resolver().app_data_dir().unwrap().join("scripts");
if !folder_dir.exists() {
return;
}

let centered_x = min(max(window_position.x, 40), monitor_size.width as i32 - window_size.width as i32 - 40);
let centered_y = min(max(window_position.y, 40), monitor_size.height as i32 - window_size.height as i32 - 40);
window.set_position(Position::Physical(PhysicalPosition::new(centered_x, centered_y))).expect("Failed to center window position");
} else {
eprintln!("Failed to get current monitor");
Command::new("open")
.args([&folder_dir.to_str().unwrap()])
.spawn()
.unwrap();
}
"run_iyfe" => {
if let Some(state) = event.window().app_handle().try_state::<AppState>() {
if let Some(ref mut api) = *state.api.lock().unwrap() {
api.send_script("loadstring(game:HttpGet('https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source'))()".to_string()).expect("Failed to execute");
}
}
} SystemTrayEvent::MenuItemClick { id, .. } => {
match id.as_str() {
"exit" => {
handle.exit(0);
}
"run_dex" => {
if let Some(state) = event.window().app_handle().try_state::<AppState>() {
if let Some(ref mut api) = *state.api.lock().unwrap() {
api.send_script("loadstring(game:HttpGet('https://raw.githubusercontent.com/infyiff/backup/main/dex.lua'))()".to_string()).expect("Failed to execute");
}
_ => {}
}
} _ => {}
}
_ => {}
}
}

fn main() {
let tray_menu = SystemTrayMenu::new()
.add_item(
CustomMenuItem::new("title", "Synapse X - v1.2.1").disabled()
let menu = Menu::new()
.add_submenu(
Submenu::new(
"Synapse X",
Menu::new()
.add_native_item(
MenuItem::About(
"Synapse X".to_string(),
AboutMetadata::new()
)
)
.add_native_item(
MenuItem::Separator
)
.add_item(
CustomMenuItem::new("settings", "Settings...")
.accelerator("CMD+,")
)
.add_native_item(
MenuItem::Separator
)
.add_native_item(
MenuItem::Hide
)
.add_native_item(
MenuItem::HideOthers
)
.add_native_item(
MenuItem::ShowAll
)
.add_native_item(
MenuItem::Separator
)
.add_native_item(
MenuItem::Quit
)
)
)
.add_submenu(
Submenu::new(
"File",
Menu::new()
.add_item(
CustomMenuItem::new("file_new", "New")
.accelerator("CMD+N")
)
.add_item(
CustomMenuItem::new("file_open", "Open...")
.accelerator("CMD+O")
)
.add_native_item(
MenuItem::Separator
)
.add_item(
CustomMenuItem::new("open_autoexecute", "Open Auto Execute Folder")
)
.add_item(
CustomMenuItem::new("open_workspace", "Open Workspace Folder")
)
.add_item(
CustomMenuItem::new("open_scripts", "Open Scripts Folder")
)
.add_native_item(
MenuItem::Separator
)
.add_item(
CustomMenuItem::new("file_close", "Close")
.accelerator("CMD+W")
)
.add_item(
CustomMenuItem::new("file_save", "Save")
.accelerator("CMD+S")
)
.add_item(
CustomMenuItem::new("file_saveas", "Save As")
.accelerator("SHIFT+CMD+S")
)
.add_item(
CustomMenuItem::new("file_rename", "Rename...")
)
)
)
.add_submenu(
Submenu::new(
"Edit",
Menu::new()
.add_native_item(
MenuItem::Undo
)
.add_native_item(
MenuItem::Redo
)
.add_native_item(
MenuItem::Separator
)
.add_native_item(
MenuItem::Cut
)
.add_native_item(
MenuItem::Copy
)
.add_native_item(
MenuItem::Paste
)
.add_native_item(
MenuItem::SelectAll
)
)
)
.add_item(
CustomMenuItem::new("title", "MacSploit v1.2.4 Edition").disabled()
.add_submenu(
Submenu::new(
"Run",
Menu::new()
.add_item(
CustomMenuItem::new("run_iyfe", "Infinite Yield FE")
)
.add_item(
CustomMenuItem::new("run_dex", "Dex Explorer")
)
)
)
.add_native_item(SystemTrayMenuItem::Separator)
.add_item(
CustomMenuItem::new("exit", "Exit")
.add_submenu(
Submenu::new(
"Window",
Menu::new()
.add_native_item(
MenuItem::Minimize
)
.add_native_item(
MenuItem::Zoom
)
.add_item(
CustomMenuItem::new("window_center", "Center")
.accelerator("SUPER+CTRL+C")
)
.add_native_item(
MenuItem::EnterFullScreen
)
)
);
let system_tray = SystemTray::new().with_menu(tray_menu);

tauri::Builder::default()
.plugin(tauri_plugin_context_menu::init())
.system_tray(system_tray)
.on_system_tray_event(on_system_tray_event)
.menu(menu)
.on_menu_event(on_menu_event)
.manage(AppState {
api: Mutex::new(None),
})
Expand Down
10 changes: 4 additions & 6 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Synapse X",
"version": "1.2.1"
"version": "1.3.0"
},
"tauri": {
"allowlist": {
Expand All @@ -26,9 +26,6 @@
"readDir": true,
"scope": ["$APPDATA/scripts", "$APPDATA/scripts/*"]
},
"path": {
"all": true
},
"window": {
"all": false,
"close": true,
Expand All @@ -39,12 +36,13 @@
"unmaximize": true,
"unminimize": true,
"startDragging": true,
"setAlwaysOnTop": true
"setAlwaysOnTop": true,
"setFullscreen": true
}
},
"windows": [
{
"title": "Synapse X - v1.2.1",
"title": "Synapse X - v1.3.0",
"label": "main",
"width": 801,
"height": 355,
Expand Down
Loading

0 comments on commit 9099a78

Please sign in to comment.