Skip to content

Commit 70117c0

Browse files
committed
Version 1.0
0 parents  commit 70117c0

28 files changed

Lines changed: 1869 additions & 0 deletions

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/discord.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Java Process Inspector [JPI] 🖥️
2+
3+
This is a sophisticated tool designed for dynamically browsing, analyzing, and modifying a running Java process ⚡
4+
5+
## Basic information
6+
7+
It allows users to interact with the Java application's live state, inspect its code, and make changes in real-time, offering a powerful solution for everyone, who need deep insights and control over Java applications during execution.
8+
9+
The program has a basic GUI that is easy to use and does not take up much memory.
10+
11+
## Functions
12+
13+
#### 🔧 Dynamic Executor for Java Code:
14+
This feature allows you to force the program, to which JPI is attached, to execute specific lines of code written in the built-in code editor provided with JPI. It offers full access to use any classes and methods, enabling real-time manipulation and testing of the application’s behavior.
15+
16+
#### ✏️ Memory Editor:
17+
The Memory Editor is a powerful tool that enables you to search for specific values within the process's memory and dynamically modify them while the process is running. This function provides direct access to the internal state of the application, allowing precise and immediate adjustments.
18+
19+
#### 🔌 DLL Injector:
20+
A straightforward tool designed to inject DLL files into the process. This function simplifies the process of adding external libraries, enabling extended functionality or modifications to the running application.
21+
22+
#### 🔍 Loaded Class Checker:
23+
This feature allows you to inspect all the classes loaded by the process, decompile them, and view their source code. Additionally, it provides the capability to dump all loaded classes to a specified folder.
24+
25+
## How to inject JPI
26+
- To attach JPI to a java process, run Process Injector.exe
27+
- Find the pid of the process you are interested in (java/javaw)
28+
- Enter the pid of the process you want to attach JPI to (confirm with enter)
29+
- Enter the full path to the dll file "injector.dll" (confirm with enter) `Example: C:\\Users\\whitedev\\Files\\injector.dll`
30+
31+
## Project Suppot
32+
If you need help, join to our community:
33+
- Discord Server: https://discord.gg/KhExwvqZb5
34+
- WebSite: https://devsmarket.eu/
35+
36+
## Authors
37+
38+
- [@0WhiteDev](https://github.com/0WhiteDev)
39+
- [@DevsMarket](https://github.com/DEVS-MARKET)

cpp src/Natives/DLLInjector.cpp

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#include <windows.h>
2+
#include <tlhelp32.h>
3+
#include <iostream>
4+
#include <vector>
5+
#include <string>
6+
7+
#include <jni.h>
8+
9+
extern "C" {
10+
JNIEXPORT jboolean JNICALL Java_uk_whitedev_injector_DLLInjector_injectDLL(JNIEnv *env, jclass clazz, jlong pid, jstring dllPath);
11+
}
12+
13+
bool InjectDLL(DWORD processID, const std::string& dllPath) {
14+
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID);
15+
if (!hProcess) {
16+
std::cerr << "OpenProcess failed" << std::endl;
17+
return false;
18+
}
19+
20+
LPVOID pRemoteMemory = VirtualAllocEx(hProcess, NULL, dllPath.size() + 1, MEM_COMMIT, PAGE_READWRITE);
21+
if (!pRemoteMemory) {
22+
std::cerr << "VirtualAllocEx failed" << std::endl;
23+
CloseHandle(hProcess);
24+
return false;
25+
}
26+
27+
if (!WriteProcessMemory(hProcess, pRemoteMemory, dllPath.c_str(), dllPath.size() + 1, NULL)) {
28+
std::cerr << "WriteProcessMemory failed" << std::endl;
29+
VirtualFreeEx(hProcess, pRemoteMemory, 0, MEM_RELEASE);
30+
CloseHandle(hProcess);
31+
return false;
32+
}
33+
34+
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
35+
if (!hKernel32) {
36+
std::cerr << "GetModuleHandleA failed" << std::endl;
37+
VirtualFreeEx(hProcess, pRemoteMemory, 0, MEM_RELEASE);
38+
CloseHandle(hProcess);
39+
return false;
40+
}
41+
42+
LPVOID pLoadLibrary = (LPVOID)GetProcAddress(hKernel32, "LoadLibraryA");
43+
if (!pLoadLibrary) {
44+
std::cerr << "GetProcAddress failed" << std::endl;
45+
VirtualFreeEx(hProcess, pRemoteMemory, 0, MEM_RELEASE);
46+
CloseHandle(hProcess);
47+
return false;
48+
}
49+
50+
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pLoadLibrary, pRemoteMemory, 0, NULL);
51+
if (!hThread) {
52+
std::cerr << "CreateRemoteThread failed" << std::endl;
53+
VirtualFreeEx(hProcess, pRemoteMemory, 0, MEM_RELEASE);
54+
CloseHandle(hProcess);
55+
return false;
56+
}
57+
58+
WaitForSingleObject(hThread, INFINITE);
59+
60+
VirtualFreeEx(hProcess, pRemoteMemory, 0, MEM_RELEASE);
61+
CloseHandle(hThread);
62+
CloseHandle(hProcess);
63+
64+
return true;
65+
}
66+
67+
JNIEXPORT jboolean JNICALL Java_uk_whitedev_injector_DLLInjector_injectDLL(JNIEnv *env, jclass clazz, jlong pid, jstring dllPath) {
68+
const char *pathChars = env->GetStringUTFChars(dllPath, NULL);
69+
if (!pathChars) {
70+
std::cerr << "Failed to convert jstring to C string" << std::endl;
71+
return JNI_FALSE;
72+
}
73+
74+
std::string dllPathStr(pathChars);
75+
env->ReleaseStringUTFChars(dllPath, pathChars);
76+
77+
bool result = InjectDLL(static_cast<DWORD>(pid), dllPathStr);
78+
79+
return result ? JNI_TRUE : JNI_FALSE;
80+
}

0 commit comments

Comments
 (0)