DELETE: all code

This commit is contained in:
xiaozhou233 committed 2026-08-15 10:23:15 +08:00
1 parent 56b6ab7e98
commit fe64308942
134 files changed
-41980

No files matched your search

-61
View File
@@ -1,61 +0,0 @@
#include <services.hpp>
#include <jni_impl.hpp>
namespace JuiceAgent::services::Bytecode {
void capture_bytecodes(const EventClassFileLoadHook& e) {
/* =========================
* 1. Capture original bytes
* ========================= */
std::lock_guard<std::mutex> lock(classDataMutex);
if (classToCapture.contains(e.name)) {
if (!classFileDataMap.contains(e.name)) {
ClassFileData data;
data.classname = e.name;
data.bytecode.assign(e.classbytes, e.classbytes + e.class_data_len);
// Experimental: class/classloader/protection_domain references (to be used in future features, e.g. dynamic patching)
data.clazz = e.class_being_redefined;
data.classloader = e.loader;
data.protection_domain = e.protection_domain;
classFileDataMap[e.name] = std::move(data);
classToCapture.erase(e.name);
PLOGI << "Captured class: " << e.name << " (length: " << e.class_data_len << ")";
}
}
}
void patch_bytecodes(const EventClassFileLoadHook& e) {
/* =========================
* 2. Apply patches
* ========================= */
if (pendingRetransform.contains(e.name)) {
auto& bytes = pendingRetransform[e.name];
unsigned char* new_buf = nullptr;
e.jvmti_env->Allocate(bytes.size(), &new_buf);
memcpy(new_buf, bytes.data(), bytes.size());
*e.new_class_data_len = (jint)bytes.size();
*e.new_classbytes = new_buf;
pendingRetransform.erase(e.name);
PLOGI << "Retransformed: " << e.name << " (new length: " << bytes.size() << ")";
}
}
void init() {
agent.get_eventbus().subscribe<EventClassFileLoadHook>(capture_bytecodes);
agent.get_eventbus().subscribe<EventClassFileLoadHook>(patch_bytecodes);
}
void start() {
}
}