Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.awt.event.*;
- public class Keylogger
- implements KeyListener
- {
- private static PrintWriter fileOut; // File to write the log to
- public static int createLogFile()
- {
- try
- {
- // Create file if there isn't already one name "keylogger.log"
- fileOut = new PrintWriter(new BufferedWriter(new FileWriter("keylogger.log")));
- }
- catch (IOException e)
- {
- }
- return 0;
- }
- public static String Message = "";
- public static int writeToFile(String s)
- {
- //this.s = Message;
- // Write string "s" to the file
- fileOut.print(s);
- //this line is read but it still fails to write the string to a text document wtf mang
- System.out.println(s);
- return 0;
- }
- public void keyPressed(KeyEvent e)
- {
- }
- public void keyTyped(KeyEvent e)
- {
- }
- public void keyReleased(KeyEvent e)
- {
- }
- @SuppressWarnings("static-access")
- public static void main(String[] args)
- {
- System.out.println("WHY DOES THIS SHIT NO WORK MANG?");
- Keylogger k = new Keylogger(); // instantiate new keylogger
- k.createLogFile(); // create logfile
- k.writeToFile("Worked"); // write this text to the logfile
- }
- }
Add Comment
Please, Sign In to add comment