-
Notifications
You must be signed in to change notification settings - Fork 2.1k
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 33: character maps to <undefined> #409
Copy link
Copy link
Open
Description
This issue I am getting when I run xsstrike with payload to scan url
PS D:\Tools\XSStrike-master> python .\xsstrike.py -u "https://example.com/?s=FUZZ" -f xss-payload.txt
XSStrike v3.1.5
Traceback (most recent call last):
File "D:\Tools\XSStrike-master\xsstrike.py", line 149, in <module>
payloadList = list(filter(None, reader(args_file)))
^^^^^^^^^^^^^^^^^
File "D:\Tools\XSStrike-master\core\utils.py", line 205, in reader
result = [line.rstrip(
^^^^^^^^^^^^^
File "D:\Tools\XSStrike-master\core\utils.py", line 205, in <listcomp>
result = [line.rstrip(
^^^^^^^^^^^^^
File "C:\Python311\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 0x9d in position 33: character maps to <undefined>Code from utils.py
def reader(path):
with open(path, 'r') as f:
result = [line.rstrip('\n').encode('utf-8').decode('utf-8') for line in f]
return resultThe issue lies in the encoding used when reading the file. Since you're encountering a UnicodeDecodeError, it should explicitly set the encoding when opening the file.
FIX
def reader(path):
with open(path, 'r', encoding='utf-8') as f:
result = [line.rstrip('\n').encode('utf-8').decode('utf-8') for line in f]
return resultThanks : )
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
