Modules Progress

1. Completed Geolocate API Module
2. Started User Search Modules
3. Laid ground work for Computer Modules
This commit is contained in:
brotoskyj
2025-01-29 21:49:47 +00:00
parent 584be272dd
commit 768ad21449
5 changed files with 82 additions and 31 deletions
+17 -31
View File
@@ -1,43 +1,29 @@
slint::slint!();
slint::include_modules!();
use reqwest;
use serde_json::Value;
use slint::ToSharedString;
pub mod utils;
fn main() {
let app: MainWindow = MainWindow::new().unwrap();
let othertoolmodulecallbacks = app.global::<OtherToolCallbacks>();
let usermodulecallbacks: UserModuleCallbacks<'_> = app.global::<UserModuleCallbacks>();
usermodulecallbacks.on_searchUser({
move || {
utils::usermodules::username_search();
}
});
let computermodulecallbacks: ComputerModuleCallbacks<'_> =
app.global::<ComputerModuleCallbacks>();
let othertoolmodulecallbacks: OtherToolCallbacks<'_> = app.global::<OtherToolCallbacks>();
othertoolmodulecallbacks.on_killCherwell({
move || {
utils::othertoolmodules::kill_cherwell();
}
});
othertoolmodulecallbacks.on_ipapi({
let app_weak = app.as_weak();
move || {
let app = app_weak.unwrap();
let mut url = String::from("http://ip-api.com/json/");
url.push_str(&app.global::<OtherToolCallbacks>().get_ipaddressbar());
let resp: String = reqwest::blocking::get(url)
.unwrap()
.text()
.ok()
.unwrap()
.into();
let apitest = geolocateapi(&resp);
let isp = apitest["isp"].to_shared_string();
let country = apitest["country"].to_shared_string();
let region = apitest["regionName"].to_shared_string();
let city = apitest["city"].to_shared_string();
app.global::<OtherToolCallbacks>()
.set_isp(slint::SharedString::from(isp));
app.global::<OtherToolCallbacks>()
.set_country(slint::SharedString::from(country));
app.global::<OtherToolCallbacks>()
.set_state(slint::SharedString::from(region));
app.global::<OtherToolCallbacks>()
.set_city(slint::SharedString::from(city));
let app: MainWindow = app_weak.unwrap();
utils::othertoolmodules::ip_gelocate_api(app);
}
});
app.run().unwrap();
}
fn geolocateapi(data: &String) -> Value {
let parsed: Value = serde_json::from_str(data).unwrap();
return (parsed).clone();
}
+3
View File
@@ -0,0 +1,3 @@
pub mod othertoolmodules;
pub mod computermodules;
pub mod usermodules;
+23
View File
@@ -0,0 +1,23 @@
pub fn computer_file_explorer() {
println!("Test");
}
pub fn current_logged_on_user() {
println!("Test");
}
pub fn laps_password_viewer() {
println!("Test");
}
pub fn remote_to_computer() {
println!("Test");
}
pub fn reboot_with_remote() {
println!("Test");
}
pub fn sccm_log_parse() {
println!("Test");
}
+32
View File
@@ -0,0 +1,32 @@
use crate::{MainWindow, OtherToolCallbacks};
use reqwest;
use serde_json::Value;
use slint::{ComponentHandle, ToSharedString};
pub fn kill_cherwell() {
println!("Test");
}
pub fn ip_gelocate_api(app: MainWindow) {
let mut url: String = String::from("http://ip-api.com/json/");
url.push_str(&app.global::<OtherToolCallbacks>().get_ipaddressbar());
let resp: String = reqwest::blocking::get(url)
.unwrap()
.text()
.ok()
.unwrap()
.into();
let parsed: Value = serde_json::from_str(&resp).unwrap();
let isp: slint::SharedString = parsed["isp"].to_shared_string();
let country: slint::SharedString = parsed["country"].to_shared_string();
let region: slint::SharedString = parsed["regionName"].to_shared_string();
let city: slint::SharedString = parsed["city"].to_shared_string();
app.global::<OtherToolCallbacks>()
.set_isp(slint::SharedString::from(isp));
app.global::<OtherToolCallbacks>()
.set_country(slint::SharedString::from(country));
app.global::<OtherToolCallbacks>()
.set_state(slint::SharedString::from(region));
app.global::<OtherToolCallbacks>()
.set_city(slint::SharedString::from(city));
}
+7
View File
@@ -0,0 +1,7 @@
pub fn username_search() {
println!("Test");
}
pub fn lastname_search() {
println!("Test");
}