PyCript icon indicating copy to clipboard operation
PyCript copied to clipboard

JSON payload includes an extra space when using python scripts

Open Draoken opened this issue 1 year ago • 4 comments

Have you gone through the Documentation or Video Tutorial

  • Documentation - https://pycript.souravkalal.tech/
  • Video - https://youtu.be/J8KE5VR8yDk?si=yr4XqqwWh5ms7O6s
  • [Y/N] - Y

Describe the bug When you use the automatic encryption feature with Python along with the Request Type of parameter value, the resulting payload adds an additional space in the json body causing an error. It is between the key and the value (after the colon).

To Reproduce Steps to reproduce the behavior:

  1. Configure settings similar to screenshot below
  2. Use automatic encrypt function with a JSON request
  3. Observe the extra space in the resulting request in the Logger/Comparer tab of BurpSuite

Expected behavior An extra space should not be added, the payload should sit exactly in the same spot as before. This is not an issue with the encrypting script, as the resulting payload is exactly correct. Removing the space causes the request to successfully pass.

Screenshots image image

Desktop (please complete the following information):

  • PyCript Version .3

Draoken avatar Feb 21 '24 16:02 Draoken

Try changing the call to _nx( with _function('_nx, like this:

{{ function('_nx', 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', comments|length, 'comments title', 'timberscores')|format(function('number_format_i18n', comments|length), '<span>' ~ post.title ~ '</span>') }}

Kevinlearynet avatar Sep 28 '14 19:09 Kevinlearynet

I must have written that part while also adding those translation functions to timber... however it's an open issue, which you can follow here: https://github.com/jarednova/timber/pull/246

aMoniker avatar Sep 28 '14 19:09 aMoniker