-
Notifications
You must be signed in to change notification settings - Fork 67
Description
I got this issue after running $ python thetimemachine.py target.com --backups
PReparing the time machine portal for voyager....
Traceback (most recent call last):
File "C:\Users\Muhammad\Desktop\SecTools\TheTimeMachine\thetimemachine.py", line 92, in
main()
~~~~^^
File "C:\Users\Muhammad\Desktop\SecTools\TheTimeMachine\thetimemachine.py", line 51, in main
urls = [line.strip() for line in f]
^
File "C:\Users\Muhammad\AppData\Local\Programs\Python\Python313\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 3631: character maps to undefined...
This is because UnicodeDecodeError: 'charmap' codec can't decode byte 0x90, is a common problem in Python when dealing with text files. It happens when the program tries to read a file with an encoding (like cp1252, the default on some Windows systems) but encounters a character that doesn't exist in that encoding. In my case, the file target.com_URLs.txt contains a byte (0x90) that the cp1252 codec doesn't recognize.
The solution is to specify a text encoding format, I edited the script on my local machine and it worked afterwards.
modifying the code with open(urls_file) as f: urls = [line.strip() for line in f]
in line 50 with with open(urls_file, encoding='utf-8') as f: urls = [line.strip() for line in f]
fixed the issue for me. Just incase anyone else faces a similar issue. Or it may be because of my python version, anycase, just thought to drop this here.