hii.. my qustion is how to make keylogger in java.. actually i make program using keyevent but when i unselect the window ..in that situation it not capture key.. help plz
Most People say it is not possible to make KeyLogger in Java because it is very difficult in Java.. You can easily make it on c/c++ or other languages.. but here is an way you can make Keylogger..
1. implement KeyListener in a class 2. add the methods: keyTyped(KeyEvent e), keyPressed(KeyEvent e), KeyReleased(KeyEvent e), Display(KeyEvent e, String status) here is the code: public class KeyLogger implements KeyListener {
/** Handle the key typed event from the text field. */ public void keyTyped(KeyEvent e) { displayInfo(e, "KEY TYPED: "); } /** Handle the key-pressed event from the text field. */ public void keyPressed(KeyEvent e) { displayInfo(e, "KEY PRESSED: "); } /** Handle the key-released event from the text field. */ public void keyReleased(KeyEvent e) { display(e, "KEY RELEASED: "); }
private void display(KeyEvent e, String keyStatus){
//You should only rely on the key char if the event //is a key typed event. int id = e.getID(); String keyString; if (id == KeyEvent.KEY_TYPED) { char c = e.getKeyChar(); keyString = "key character = '" + c + "'"; } else { int keyCode = e.getKeyCode(); keyString = "key code = " + keyCode+ " ("+ KeyEvent.getKeyText(keyCode)+ ")"; }//end of if System.out.println(keyString); }//end of display
add that into a program and change the println to a write-to-file, or have it send to you through a networked program.
hii.. my qustion is how to make keylogger in java.. actually i make program using keyevent but
ReplyDeletewhen i unselect the window ..in that situation it not capture key.. help plz
Most People say it is not possible to make KeyLogger in Java because it is very difficult in Java.. You can easily make it on c/c++ or other languages.. but here is an way you can make Keylogger..
Delete1. implement KeyListener in a class
2. add the methods: keyTyped(KeyEvent e), keyPressed(KeyEvent e), KeyReleased(KeyEvent e), Display(KeyEvent e, String status)
here is the code:
public class KeyLogger implements KeyListener {
/** Handle the key typed event from the text field. */
public void keyTyped(KeyEvent e) {
displayInfo(e, "KEY TYPED: ");
}
/** Handle the key-pressed event from the text field. */
public void keyPressed(KeyEvent e) {
displayInfo(e, "KEY PRESSED: ");
}
/** Handle the key-released event from the text field. */
public void keyReleased(KeyEvent e) {
display(e, "KEY RELEASED: ");
}
private void display(KeyEvent e, String keyStatus){
//You should only rely on the key char if the event
//is a key typed event.
int id = e.getID();
String keyString;
if (id == KeyEvent.KEY_TYPED) {
char c = e.getKeyChar();
keyString = "key character = '" + c + "'";
} else {
int keyCode = e.getKeyCode();
keyString = "key code = " + keyCode+ " ("+ KeyEvent.getKeyText(keyCode)+ ")";
}//end of if
System.out.println(keyString);
}//end of display
add that into a program and change the println to a write-to-file, or have it send to you through a networked program.
how to make the class Student contains
ReplyDeletetwo array instance variables