Last active
September 28, 2023 10:28
-
-
Save ChoiSG/9806b5c4fe35aa24c42de87d3012d650 to your computer and use it in GitHub Desktop.
Simple python script to convert shellcode to UUID String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Created for : https://blog.sunggwanchoi.com/eng-uuid-shellcode-execution/ | |
Repo: https://github.com/ChoiSG/UuidShellcodeExec | |
""" | |
import uuid | |
def convertToUUID(shellcode): | |
# If shellcode is not in multiples of 16, then add some nullbytes at the end | |
if len(shellcode) % 16 != 0: | |
print("[-] Shellcode's length not multiplies of 16 bytes") | |
print("[-] Adding nullbytes at the end of shellcode, this might break your shellcode.") | |
print("\n[*] Modified shellcode length: ", len(shellcode)+(16-(len(shellcode)%16))) | |
addNullbyte = b"\x00" * (16-(len(shellcode)%16)) | |
shellcode += addNullbyte | |
uuids = [] | |
for i in range(0, len(shellcode), 16): | |
uuidString = str(uuid.UUID(bytes_le=shellcode[i:i+16])) | |
uuids.append('"'+uuidString+'"') | |
return uuids | |
def main(): | |
# Copy/Paste the MessageBox payload here | |
uuids = convertToUUID(buf) | |
print(*uuids, sep=",\n") | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment