Skip to content

Commit ac4b48c

Browse files
authored
Merge pull request #624 from bytedance/fix-jattach-notfound
Fix jattach notfound
2 parents 42f16f9 + caa63bf commit ac4b48c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

rasp/jvm/JVMAgent/src/main/java/com/security/smithloader/SmithAgent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ public String call() throws Exception {
244244
SmithAgentLogger.logger.warning(proberPath + " loading fail!");
245245
}
246246
else {
247-
System.setProperty("smith.rasp", probeVersion+"-"+checksumStr);
248247
System.setProperty("smith.status", "attach");
248+
System.setProperty("smith.rasp", probeVersion+"-"+checksumStr);
249+
249250
System.setProperty("rasp.probe", "smith");
250251
}
251252
}

rasp/librasp/src/jvm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use log::*;
44
use regex::Regex;
55
use std::process::Command;
66
use std::fs;
7-
7+
use std::thread;
8+
use std::time::Duration;
89
use crate::async_command::run_async_process;
910
use crate::process::ProcessInfo;
1011
use crate::runtime::{ProbeCopy, ProbeState, ProbeStateInspect};
@@ -71,7 +72,7 @@ pub fn java_attach(pid: i32) -> Result<bool> {
7172
if err.len() != 0 {
7273
info!("{}", &err);
7374
}
74-
//thread::sleep(Duration::from_millis(100));
75+
std::thread::sleep(Duration::from_millis(500));
7576
match check_result(pid, "attach") {
7677
Ok(_) => {
7778
return Ok(true);

rasp/librasp/src/manager.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,9 @@ impl RASPManager {
352352
diff_ns = value;
353353
if diff_ns {
354354
let to = format!("{}{}",root_dir.clone(), settings::RASP_JAVA_AGENT_BIN());
355+
self.copy_file_from_to_dest(settings::RASP_JAVA_JATTACH_BIN(), root_dir.clone());
355356
self.copy_file_from_to_dest(settings::RASP_JAVA_AGENT_BIN(), root_dir.clone());
356-
info!("copy from SmithAgent.jar to {}", to.clone());
357+
info!("copy from jattach/SmithAgent.jar to {}", to.clone());
357358
}
358359
}
359360
Err(e) => {

0 commit comments

Comments
 (0)