Google

Friday, June 19, 2009

Reverse RAT



Web Browser Source Code:

public FrWebBrowser() {
initComponents();
try{
tpOutput.setPage("http://www.google.com.my");
}catch(Exception e){

}
}

Modify the constructor as shown above. You should have a
JTextPane called tpOutput.


Desktop Capture Source Code:



private void btnCaptureActionPerformed(java.awt.event.ActionEvent evt) {
String userHome = System.getProperty("user.home") + "\\";
captureScreen(userHome + "desktop.jpg");
}

public void captureScreen(String fileName){
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
try{
BufferedImage image = new Robot().createScreenCapture(new Rectangle(screenSize));
ImageIO.write(image, "jpg", new File(fileName));
//ImageIO.write(image, "png", new File(fileName));
}catch(Exception e){
JOptionPane.showMessageDialog(null, "captureScreen: " + e.toString());
}
}



FTP Source code :
Modify the sendFile ( ) method to upload desktop.jpg:


private void sendFile() {
String ftpHost = "*************"; //get this from me
String ftpUserName = "student";
String ftpPassword = "********"; //get this from me
String ftpRemoteDirectory = "public_html";
String userHome = System.getProperty("user.home") + "\\";
String fileToTransmit = userHome + "desktop.jpg";

FTPClient ftp = new FTPClient();
try{
ftp.connect(ftpHost);
ftp.login(ftpUserName, ftpPassword);
ftp.changeWorkingDirectory(ftpRemoteDirectory);

File f = new File(fileToTransmit);
ftp.setFileType(FTP.BINARY_FILE_TYPE);

ftp.storeFile(f.getName(),new FileInputStream(f));

ftp.disconnect();

}catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}

}



For FTP, you should have a button event handler that calls
sendFile( ) above.


Now, go back to your Web Browser form and modify the constructor:

public FrWebBrowser() {
initComponents();
try{
tpOutput.setPage("********"); //get this from me
}catch(Exception e){

}
}

To test the program, one person will run the FTP and click Capture Desktop
followed by Send File.

Another person will run Web Browser to see the first person's desktop.
You can also test it alone, just click Capture Desktop, Send File, then Open the Web
Browser.