コード例 #1
0
def process_xls(filepath):
    """ find dde links in excel ole file """

    result = []
    for stream in xls_parser.XlsFile(filepath).get_streams():
        if not isinstance(stream, xls_parser.WorkbookStream):
            continue
        for record in stream.iter_records():
            if not isinstance(record, xls_parser.XlsRecordSupBook):
                continue
            if record.support_link_type in (
                    xls_parser.XlsRecordSupBook.LINK_TYPE_OLE_DDE,
                    xls_parser.XlsRecordSupBook.LINK_TYPE_EXTERNAL):
                result.append(record.virt_path.replace(u'\u0003', u' '))
    return u'\n'.join(result)
コード例 #2
0
ファイル: msodde.py プロジェクト: TheVivisector/oletools
def process_xls(filepath):
    """find dde links in excel ole file"""

    result = []
    xls_file = None
    try:
        xls_file = xls_parser.XlsFile(filepath)
        for stream in xls_file.iter_streams():
            if not isinstance(stream, xls_parser.WorkbookStream):
                continue
            for record in stream.iter_records():
                if not isinstance(record, xls_parser.XlsRecordSupBook):
                    continue
                if record.support_link_type in (xls_parser.XlsRecordSupBook.LINK_TYPE_OLE_DDE, xls_parser.XlsRecordSupBook.LINK_TYPE_EXTERNAL):
                    result.append(record.virt_path.replace(u"\u0003", u" "))
        return u"\n".join(result)
    finally:
        if xls_file is not None:
            xls_file.close()