YDHCUI/CNVD-2020-10487-Tomcat-Ajp-lfi

does it used with python2 ?

prohk opened this issue · 2 comments

prohk commented

,firstly , I got mistakes in makefile() , then I change bufsize args to buffering , then line get errors,:print("".join([d.data for d in data]))
Error: sequence item 0: expected str instance, bytes found
can you give me some suggestions?
thks

yes, it only supports python2, to use python3 , you make the following changes:

  1. self.socket.makefile("rb", bufsize=0) -->change self.socket.makefile("rb", buffering=0)
  2. print("".join([d.data for d in data])) -->print("".join([d.data.decode() for d in data]))

After implementing the aforementioned changes, I am still getting the error.

Traceback (most recent call last):
File "AJPGhostcat.py", line 295, in
t = Tomcat(args.target, args.port)
File "AJPGhostcat.py", line 262, in init
self.stream = self.socket.makefile("rb", buffering=0)
TypeError: makefile() got an unexpected keyword argument 'buffering'

Kindly suggest what more can be done.