util.py 文件源码

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

项目:shellgen 作者: MarioVilas 项目源码 文件源码
def _load_bytecode_from_dump(input):

    # Read the data.
    data = input.read()

    # If it's an hexadecimal dump, decode and return it.
    if _re_is_hexa.match(data):
        hexstr  = ''.join(_re_get_hexa.findall(data))
        hexdump = [ int(hexstr[i:i+2], 16) for i in xrange(0, len(hexstr), 2) ]
        return struct.pack('B' * len(hexdump), *hexdump)

    # If it's base64 encoded data, decode and return it.
    if _re_is_b64.match(data):
        return data.decode('base64')

    # Assume it's a raw binary dump and return it unchanged.
    return data

#-----------------------------------------------------------------------------#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号