__init__.py 文件源码

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

项目:NIST 作者: mdedonno1337 项目源码 文件源码
def get_jar( self, idc = -1 ):
        """
            Get the content of all files present in the JAR file stored in the
            field 9.184. The returned dictionnary contains the as follow::

                {
                    'file name': 'file content',
                    ...
                }

            The content of the files are not parsed, but returned as string value.

            :param idc: IDC value.
            :type idc: int

            :return: Content of all files stored in the JAR file.
            :rtype: dict
        """
        idc = self.checkIDC( 9, idc )

        data = self.get_field( "9.184", idc )
        if data != None:
            data = base64.decodestring( data )

            buffer = StringIO()
            buffer.write( data )

            ret = defaultdict()

            with zipfile.ZipFile( buffer, "r" ) as zip:
                for f in zip.namelist():
                    name, _ = os.path.splitext( f )

                    with zip.open( f, "r" ) as fp:
                        ret[ name ] = fp.read()

            return dict( ret )

        else:
            return None

    ############################################################################
    # 
    #    User defined fields
    # 
    ############################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号