Skip to content

Possible bug in office2john #4043

@magnumripper

Description

@magnumripper

I got this from a user. I'm not sure if it's a bug or just a Python version thing? If it's the latter we may need a try/catch.

Whilst trying to use office2john to extract a password hash from an old ("2005") excel file, office2john kept crashing with the error:

=> python3 office2john.py organiser.xls
Traceback (most recent call last):
File "office2john.py", line 2603, in process_file
if accdb_magic in data and accdb_xml_start in data:
TypeError: a bytes-like object is required, not 'str'
organiser.xls : OLE check failed, a bytes-like object is required, not 'str'

I corrected the error by amending these lines:

        accdb_xml_start = "'<?xml version="1.0"'
        accdb_xml_trailer =  '</encryption>')

to

        accdb_magic = bytes("Standard ACE DB",'utf-8')
        accdb_xml_start = bytes('<?xml version="1.0"', 'utf-8')
        accdb_xml_trailer = bytes( '</encryption>', 'utf-8')

and the script now runs and produces the required output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions