Skip to content

Instantly share code, notes, and snippets.

@ChoiSG
Last active September 28, 2023 10:28
Show Gist options
  • Save ChoiSG/9806b5c4fe35aa24c42de87d3012d650 to your computer and use it in GitHub Desktop.
Save ChoiSG/9806b5c4fe35aa24c42de87d3012d650 to your computer and use it in GitHub Desktop.
Simple python script to convert shellcode to UUID String
"""
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