RemoveNullBytes

Removes null bytes from string.

python · Filters And Transformers

Details

IDRemoveNullBytes
Languagepython
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.10404775
Tagsgeneral transformer

README

Removes null bytes from string.

Script Data


Name Description
Script Type python3
Tags general, transformer

Inputs


Argument Name Description
value The string value to remove null bytes

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401


def removenullbytes(value):
    if isinstance(value, str):
        result = value.replace("\x00", "")
    else:
        return "error"
    return result


def main():
    value = demisto.args()["value"]
    result = removenullbytes(value)
    if result == "error":
        return_error("This transformer applies only to string")
    return_results(result)


if __name__ == "__builtin__" or __name__ == "builtins":
    main()