Skip to content

Instantly share code, notes, and snippets.

@aroly
aroly / gist:a504a0f6018ca5844d7b9b12c6de24f8
Created October 31, 2021 07:59
Hackvertor - AMF tags
import string, struct
def encode(string, xml=False):
string = string.encode('utf-8')
if xml:
const = '\x0f' # AMF0 XML document
size = struct.pack("!L", len(string)) # Size on 4 bytes
else:
const = '' # AMF0 URI
size = struct.pack("!H", len(string)) # Size on 2 bytes