Hack Forums
[Java] Newbie needs help. Java virus - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Java] Newbie needs help. Java virus (/showthread.php?tid=5770965)



Newbie needs help. Java virus - N33D3DR3LI3F - Dec 18, 2017

Hey, I'm new to the java programming and I have been learning about viruses also. So i'm trying to make a virus in java, that will search for the main method of a class and if there is a main class then it would alter the data of the arrays and all the other data variables present in that main class. So any ideas, help is welcome. 

PS. I know its a stupid idea but help me out in it. Thanks.


RE: Newbie needs help. Java virus - Sogomn - Dec 19, 2017

Java reflections allow you to load classes at runtime so that might be a good starting point.
You won't be able to make proper malware with Java tho.


RE: Newbie needs help. Java virus - N33D3DR3LI3F - Dec 19, 2017

(Dec 19, 2017 07:46 AM)Sogomn Wrote:  Java reflections allow you to load classes at runtime so that might be a good starting point.
You won't be able to make proper malware with Java tho.

yeah because of the limitations of java, thanks btw


RE: Newbie needs help. Java virus - CheesyBread - Dec 19, 2017

(Dec 19, 2017 10:16 AM)N33D3DR3LI3F Wrote:  yeah because of the limitations of java, thanks btw

Well with the Java Native Interface you could get around those issues, but you would still have to dive into a little bit of C or C++ programming. Of course with the amount of native programming necessary, you might as well just write the whole damn thing in C++.


RE: Newbie needs help. Java virus - matt - Dec 20, 2017

You can use a bytecode manipulation API like ASM, BCEL, JavaAssist & ByteBuddy to edit method bodies at runtime.


RE: Newbie needs help. Java virus - matt - Dec 22, 2017

Update: you're not even needing to change method bodies so it could be done with reflection, use a ClassLoader to load the class and then create a new instance using reflection and then change the fields