nullfree.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:shellgen 作者: MarioVilas 项目源码 文件源码
def encode_8(bytes, key, terminator):
        """
        Encode the bytecode with the given 8-bit XOR key.

        :type  bytes: str
        :param bytes: Bytecode to encode.

        :type  key: str
        :param key: 8-bit XOR key.

        :type  terminator: str
        :param terminator: 8-bit terminator.

        :rtype:  str
        :return: Encoded bytecode.
        """
        if not bytes.endswith(terminator):
            bytes += terminator
        fmt = "B" * len(bytes)
        unpack = struct.unpack
        pad = unpack("B", key) * len(bytes)
        bytes = unpack(fmt, bytes)
        bytes = [ bytes[i] ^ pad[i] for i in xrange(len(bytes)) ]
        return struct.pack(fmt, *bytes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号