Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 3798: character maps to <undefined> #347

Open
4 tasks done
windowshopr opened this issue May 22, 2022 · 1 comment

Comments

@windowshopr
Copy link

Describe the bug
Trying to use XSStrike on Windows 10, Python 3.7.9 and the DVWA XSS (DOM) page. I stored this payload list into a payloads.txt file, then when I run this command:

python xsstrike.py -u http://172.16.1.82:8008/dvwa/vulnerabilities/xss_d/ --data Default --file payloads.txt

...I get this traceback error:

PS Z:\Python_Projects\...\XSStrike> python xsstrike.py -u http://172.16.1.82:8008/dvwa/vulnerabilities/xss_d/ --data Default --file payloads.txt     

        XSStrike v3.1.5

Traceback (most recent call last):
  File "xsstrike.py", line 149, in <module>
    payloadList = list(filter(None, reader(args_file)))
  File "Z:\Python_Projects\...\XSStrike\core\utils.py", line 206, in reader
    '\n').encode('utf-8').decode('utf-8') for line in f]
  File "Z:\Python_Projects\...\XSStrike\core\utils.py", line 205, in <listcomp>
    result = [line.rstrip(
  File "C:\Users\...\AppData\Roaming\Python\Python37\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 3798: character maps to <undefined>

To Reproduce
To reproduce, setup the DVWA on a local server, download the above payloads list into a payloads.txt file, and run the same command while the DVWA server is running.

Screenshots

Potential cause or fix

Environment:
Described at the beginning.

Some Questions

  • I am using the latest version of XSStrike.
  • I installed the dependecies using pip3 instead of pip
  • I have read the documentation before submitting this issue.
  • I have checked the other issues to see if someone reported this before.
    (There are similar issues, but not this one, nor was there any answers for it).

Other comments
None.

@GebMirFreiheit
Copy link

It seems python on windows uses cp1252 as default encoding when opening file, but saved file has utf8 encoding, that's why UnicodeDecodeError raises. Maybe it will be better to restrict utf8 files only, and open file as open(path, 'r', encoding='utf8') in reader function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants