smicallef / spiderfoot

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
http://www.spiderfoot.net
MIT License
13.28k stars 2.29k forks source link

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 10466: character maps to <undefined> #1722

Closed lojokun closed 2 years ago

lojokun commented 2 years ago

The very first scan I ran worked just fine, but then this happened. I couldn't run anymore scans. I eventually found the problem, which was that you forgot to open the cacheFile with encoding. Here's the fix in sflib, cacheGet method:

if cache_stat.st_mtime > time.time() - timeoutHrs * 3600 or timeoutHrs == 0:
            with open(cacheFile, "r", encoding='utf-8') as fp:
                return fp.read()
smicallef commented 2 years ago

Issue addressed in PR #1723