I'm currently trying to code my first burp extension in python and I have an error when it comes to managing bytes array which I get from the response. I used a, probably, outdated tutorial which use this line of code : body = response[response_data.getBodyOffset():].tostring()
but in the last python version this method is deprecated.
I tried to replace it with the new one tobytes()
but when compiling into burp I keep having the same error AttributeError: 'array.array' object has no attribute 'tobytes'
. I tried it in another program just to test it and it work perfectly so I'm wondering what could be the cause of this. Can it comes from Jython not compatible with this new method ? In this case shouldn't be the error another one from the tostring() ?
What do you think about it ? Should I just try to downgrade my python version to make tostring() work ?
Thanks in advance for your help !
PS: I'm using the last stable python (3.10.10) and Jython (2.7.3) version,
Jython 2.7.3
implements Python 2.7
in Java, so you can't call methods that don't exist in that version of Python. This is why the documentation link from jython.org takes you to the Python 2.7 documentation.
I'm not sure why you're running the code in python 3.10
if the burp plugin only supports jython. Unless you're referring to a java .toBytes()
method, in which case this answer might help you.