in nightMARE/src/nightmare/malware/remcos/configuration.py [0:0]
def unpack_c2(packed_c2: bytes) -> list[dict[str, typing.Any]]:
"""
Unpacks the packed_c2 bytes and returns a list of dictionaries containing the C2 information.
:param packed_c2: The packed C2 bytes to be unpacked.
:return: A list of dictionaries, where each dictionary represents a C2.
"""
results = list()
for c2 in (x for x in packed_c2.split(C2_SEPARATOR) if x):
host, port, tls = c2.split(b":")
results.append(
{"host": host.decode("utf-8"), "port": int(port), "tls": bool(int(tls))}
)
return results