Guest User

Untitled

a guest
May 26th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import java.io.*;
  2. import java.awt.event.*;
  3.  
  4. public class Keylogger
  5.  
  6. implements KeyListener
  7. {
  8.  
  9. private static PrintWriter fileOut; // File to write the log to
  10.  
  11. public static int createLogFile()
  12. {
  13. try
  14. {
  15. // Create file if there isn't already one name "keylogger.log"
  16. fileOut = new PrintWriter(new BufferedWriter(new FileWriter("keylogger.log")));
  17. }
  18. catch (IOException e)
  19. {
  20. }
  21. return 0;
  22. }
  23.  
  24. public static String Message = "";
  25.  
  26. public static int writeToFile(String s)
  27. {
  28. //this.s = Message;
  29. // Write string "s" to the file
  30. fileOut.print(s);
  31. //this line is read but it still fails to write the string to a text document wtf mang
  32. System.out.println(s);
  33. return 0;
  34. }
  35.  
  36. public void keyPressed(KeyEvent e)
  37. {
  38.  
  39. }
  40.  
  41. public void keyTyped(KeyEvent e)
  42. {
  43.  
  44. }
  45.  
  46. public void keyReleased(KeyEvent e)
  47. {
  48.  
  49. }
  50.  
  51. @SuppressWarnings("static-access")
  52. public static void main(String[] args)
  53. {
  54. System.out.println("WHY DOES THIS SHIT NO WORK MANG?");
  55. Keylogger k = new Keylogger(); // instantiate new keylogger
  56. k.createLogFile(); // create logfile
  57. k.writeToFile("Worked"); // write this text to the logfile
  58. }
  59.  
  60. }
Add Comment
Please, Sign In to add comment