Is memory editing is possible using JAVA?
Hi i m a c++ programmer no shifting to JAVA.
is it possible to perform operations like following in java?
Quote:
WriteProcessMemory
GetThreadContext
SetThreadContext
VirtualAllocEx
CreateProcess
ResumeThread
or is there anything else i can do? like it would be good if i can add c++ code in java??
or anything else possible to perform these functions??
Re: Is memory editing is possible using JAVA?
I know it's possible to create a new process in Java, see: ProcessBuilder
It's possible to suspend/resume threads in Java (provided you're able to get a reference to them), but these features are technically deprecated. See: Java Thread Primitive Deprecation.
It's possible to call C code from Java using JNI (Java Native Interface) or JNA (Java Native Access). There are various tutorials online, including a few on this site.
Links:
Java Native Access/ Eclipse Indigo Swing GUI Editor
An Introduction to the Java Native Interface
Re: Is memory editing is possible using JAVA?
Why would you need to use primitive Thread operations? I think any time where that crosses your mind, you need to rethink your logic a bit.
Secondly, you can do some specific memory management using java.nio, for example:
ByteBuffer.allocate
ByteBuffer.allocateDirect
Re: Is memory editing is possible using JAVA?
basically i want this to inject any program in to a running memory.... :)
Re: Is memory editing is possible using JAVA?
Quote:
Originally Posted by
fredsilvester93
basically i want this to inject any program in to a running memory.... :)
No, it's harder to write a virus in Java (which is, good or bad, what it sounds like you're trying to do).
Java maintains a virtual machine in a single operating system process. This VM is somewhat like a true O/S virtual machine in that it takes care of memory allocation, running processes (threads), and security. One part of that security is that you can't just write to anywhere in the Java VM nor can you write to just anywhere in the O/S memory. The Java process runs as a particular O/S user - it would be a very poorly done system for Java to run as a root or administrative user.
Remember also that Java is meant to be O/S independent. WriteProcessMemory is a Windows specific call and would not port well to Unix based O/S's nor to MVS on a mainframe. What you're trying to do is very O/S dependent and Java is not likely to be the best tool.
Re: Is memory editing is possible using JAVA?
Quote:
Originally Posted by
fredsilvester93
basically i want this to inject any program in to a running memory.... :)
Now that sounds malicious...I wouldn't expect much help in the matter unless you prove otherwise.
Re: Is memory editing is possible using JAVA?
No basically it is not malicious. I was trying to make an antivirus program, that searches in the middle of the thread and in the specified regions for viruses. because crypters inject it inside a rundll32,kernel32 process etc which antivirus thinks it is unharmful kernel process :)
My intentions are good otherwise i should have posted this in some hacking etc forum.... :D
Hope u will help me now
Re: Is memory editing is possible using JAVA?
Quote:
Originally Posted by
fredsilvester93
No basically it is not malicious. I was trying to make an antivirus program, that searches in the middle of the thread and in the specified regions for viruses. because crypters inject it inside a rundll32,kernel32 process etc which antivirus thinks it is unharmful kernel process :)
My intentions are good otherwise i should have posted this in some hacking etc forum.... :D
Hope u will help me now
Well, I don't think Java is the best language for that, but as I see the problem there is one option. Call C++ by Java.
Java Tip 17: Integrating Java with C++ - JavaWorld