Yelp/osxcollector

ImportError: No module named Foundation

PAULABAILEN opened this issue · 8 comments

ImportError: No module named Foundation

Yes.. all that "no pip, brew, ... " needed, is kind of (very) misleading. Once you install this, you'll need to install xattr also (pip install xattr)

In regards to the error tho, pip install pyobjc and pyobjc-core

Hi @PAULABAILEN, you should not need to install pip nor xattr to run it.
With the default Python installation on Mac OS X (Python 2.7.10) it should work without any modifications.

@PAULABAILEN if you are still experiencing the issue with non-Apple Python installation, try Python version located at /usr/bin/python2.7 in your system:

$ sudo /usr/bin/python2.7 osxcollector.py

BTW, you should check that it points to the default location for Mac OS X, using ls -l:

$ ls -l /usr/bin/python2.7
lrwxr-xr-x  1 root  wheel  75 Apr 13 13:44 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

Right. This seems to be an issue with the version installed via. brew - using the default OS X install, works ok.

Hi @PAULABAILEN,
regarding the error you see:

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'osxcollector.py': [Errno 2] No such file or directory

please make sure you are running the command in the directory where osxcollector.py file is.
So if you are in the root of the cloned GitHub project, the file is in the osxcollector directory and your invocation should look like:

$ sudo /usr/bin/python2.7 osxcollector/osxcollector.py

Alternatively, just cd to the osxcollector directory and then run the command:

cd osxcollector
$ sudo /usr/bin/python2.7 osxcollector.py

I hope that helps!

Hi @PAULABAILEN,
I think your last error actually prooves that OSXCollector works on your machine:

JAIMEs-MacBook-Pro% sudo /usr/bin/python2.7 osxcollector.py
Password:
[ERROR] Unable to parse plist: [The data couldn’t be read because it isn’t
in the correct format.]. plist_path[/Applications/Adobe After Effects
CS5/Plug-ins/Effects/Foundry/KeylightPro.plugin/Contents/Info.plist] -
{'osxcollector_incident_id': 'osxcollect-2016_05_26-16_03_34',
'osxcollector_subsection': 'applications', 'osxcollector_section':
'applications'}

This error won't prevent it from finishing. The only point here is that it won't collect information about a particular file (/Applications/Adobe After Effects CS5/Plug-ins/Effects/Foundry/KeylightPro.plugin/Contents/Info.plist). This message should actually have been turned into a warning rather than error, as it does not prevent the whole output to be collected.

Hello,

I'm getting a lot of errors after running the file:

[ERROR] Unable to parse plist: [The data couldn’t be read because it isn’t in the correct format.]. plist_path[/Applications/Adobe After Effects CS5/Plug-ins/Effects/Foundry/KeylightPro.plugin/Contents/Info.plist] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_subsection': 'applications', 'osxcollector_section': 'applications'}
[ERROR] <type 'exceptions.UnicodeDecodeError'> [('osxcollector.py', 811, 'log_dict', 'cls.output_file.write(dumps(record))'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py', 243, 'dumps', 'return _default_encoder.encode(obj)'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py', 207, 'encode', 'chunks = self.iterencode(o, _one_shot=True)'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py', 270, 'iterencode', 'return _iterencode(o, 0)')] - {'osxcollector_table_name': u'server_addresses', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Google/Chrome/Default/Web Data', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'web_data', 'osxcollector_section': 'chrome'}
[ERROR] failed _log_sqlite_table Could not decode to UTF-8 column 'id' with text '?Ⴢt?' <class 'sqlite3.OperationalError'> [('osxcollector.py', 1308, '_log_sqlite_table', "cursor.execute('SELECT * from {0}'.format(table_name))")] - {'osxcollector_table_name': u'server_addresses', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Google/Chrome/Default/Web Data', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'web_data', 'osxcollector_section': 'chrome'}
[ERROR] <type 'exceptions.UnicodeDecodeError'> [('osxcollector.py', 811, 'log_dict', 'cls.output_file.write(dumps(record))'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/init.py', 243, 'dumps', 'return _default_encoder.encode(obj)'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py', 207, 'encode', 'chunks = self.iterencode(o, _one_shot=True)'), ('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py', 270, 'iterencode', 'return _iterencode(o, 0)')] - {'osxcollector_table_name': u'server_address_metadata', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Google/Chrome/Default/Web Data', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'web_data', 'osxcollector_section': 'chrome'}
[ERROR] failed _log_sqlite_table Could not decode to UTF-8 column 'id' with text '?Ⴢt?' <class 'sqlite3.OperationalError'> [('osxcollector.py', 1308, '_log_sqlite_table', "cursor.execute('SELECT * from {0}'.format(table_name))")] - {'osxcollector_table_name': u'server_address_metadata', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Google/Chrome/Default/Web Data', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'web_data', 'osxcollector_section': 'chrome'}
[ERROR] failed _log_sqlite_table near "1": syntax error <class 'sqlite3.OperationalError'> [('osxcollector.py', 1308, '_log_sqlite_table', "cursor.execute('SELECT * from {0}'.format(table_name))")] - {'osxcollector_table_name': u'1', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Firefox/Profiles/6oyn5a5a.default-1460806269425/places.sqlite', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'history', 'osxcollector_section': 'firefox'}
[ERROR] failed _log_sqlite_table database disk image is malformed <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1309, '_log_sqlite_table', 'rows = cursor.fetchall()')] - {'osxcollector_table_name': u'moz_historyvisits', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Firefox/Profiles/q0i9iudp-1.default-1388257208645/places.sqlite', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'history', 'osxcollector_section': 'firefox'}
[ERROR] failed _log_sqlite_table near "1": syntax error <class 'sqlite3.OperationalError'> [('osxcollector.py', 1308, '_log_sqlite_table', "cursor.execute('SELECT * from {0}'.format(table_name))")] - {'osxcollector_table_name': u'1', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Firefox/Profiles/q0i9iudp-1.default-1388257208645/places.sqlite', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'history', 'osxcollector_section': 'firefox'}
[ERROR] failed _log_sqlite_table database disk image is malformed <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1309, '_log_sqlite_table', 'rows = cursor.fetchall()')] - {'osxcollector_table_name': u'moz_historyvisits', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Firefox/Profiles/zqowk87w.default-1461982128860/places.sqlite', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'history', 'osxcollector_section': 'firefox'}
[ERROR] failed _log_sqlite_table near "1": syntax error <class 'sqlite3.OperationalError'> [('osxcollector.py', 1308, '_log_sqlite_table', "cursor.execute('SELECT * from {0}'.format(table_name))")] - {'osxcollector_table_name': u'1', 'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Application Support/Firefox/Profiles/zqowk87w.default-1461982128860/places.sqlite', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'history', 'osxcollector_section': 'firefox'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_c.betrad.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_cdn.cxense.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_pushmobile.abs-cbn.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_www.pshsa.ca_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_www.sportinglife.ca_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/http_www.workopolis.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_abinbev.taleo.net_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_cfl.dropboxstatic.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_decoding.wordpress.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_icfi.taleo.net_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_jobs.bce.ca_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_jobs.hatch.com_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_manulife.taleo.net_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/https_pcl.taleo.net_0.localstorage-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
[ERROR] failed _log_sqlite_db file is encrypted or is not a database <class 'sqlite3.DatabaseError'> [('osxcollector.py', 1349, '_log_sqlite_db', 'self._raw_log_sqlite_db(sqlite_db_path)'), ('osxcollector.py', 1328, '_raw_log_sqlite_db', 'cursor.execute('SELECT * from sqlite_master WHERE type = "table"')')] - {'osxcollector_incident_id': 'osxcollect-2017_01_16-01_24_17', 'osxcollector_db_path': '/Users/jimmypaula/Library/Safari/LocalStorage/StorageTracker.db-shm', 'osxcollector_username': 'jimmypaula', 'osxcollector_subsection': 'localstorage', 'osxcollector_section': 'safari'}
Wrote 2849097 lines.
Output in osxcollect-2017_01_16-01_24_17.tar.gz