epinna / tplmap

Server-Side Template Injection and Code Injection Detection and Exploitation Tool
GNU General Public License v3.0
3.75k stars 670 forks source link

Problem installing in kali #113

Open JPwnage opened 1 year ago

JPwnage commented 1 year ago

I tried to install in burp first and when that failed, I decided just to install and use the cli version instead but got many errors:

`(root㉿kali)-[~/tplmap] └─# pip install -r requirements.txt
Collecting PyYAML==5.1.2 Downloading PyYAML-5.1.2.tar.gz (265 kB) ━━━━━━━━━━━━━━━━━━━━ 265.0/265.0 kB 9.4 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting certifi==2018.10.15 Downloading certifi-2018.10.15-py2.py3-none-any.whl (146 kB) ━━━━━━━━━━━━━━━━━━━ 146.3/146.3 kB 25.3 MB/s eta 0:00:00 Requirement already satisfied: chardet==3.0.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 3)) (3.0.4) Requirement already satisfied: idna==2.8 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 4)) (2.8) Collecting requests==2.22.0 Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━ 58.0/58.0 kB 10.5 MB/s eta 0:00:00 Collecting urllib3==1.24.1 Downloading urllib3-1.24.1-py2.py3-none-any.whl (118 kB) ━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 18.9 MB/s eta 0:00:00 Collecting wsgiref==0.1.2 Downloading wsgiref-0.1.2.zip (37 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [9 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-lctvd9e0/wsgiref_d7010dd76a9d41859824def11078dadd/setup.py", line 5, in import ez_setup File "/tmp/pip-install-lctvd9e0/wsgiref_d7010dd76a9d41859824def11078dadd/ez_setup/init.py", line 170 print "Setuptools version",version,"or greater has been installed." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details. `

AbrahamCain commented 1 year ago

Hello @JPwnage, I'm also getting these install errors in Kali. I wonder if setup.py was originally written in Python 2 as Python 2 didn't require print statements to use parenthesis, but Python 3 does and the error that you and I are getting is saying that the print statement is missing parenthesis. I was seeing the issue attempting to install on a box with Python 3.11.1 installed.

AbrahamCain commented 1 year ago

image https://pypi.org/project/wsgiref/

I wonder if this would be a problem too? It looks like wsgiref 0.1.2 is only compatible with python 3.6 or less. Although, I think python 3.11 has a wsgiref utility built-in per the following python3 documentation:

https://docs.python.org/3/library/wsgiref.html#module-wsgiref

JPwnage commented 1 year ago

Hi the reason why we are encountering problems is because the is python 2 and kali has python 3 and the code isn't compatible with python 3.

Solution is to setup a python 2.7 environment


cd tplmap
virtualenv -p python2 venv

source venv/bin/activate
JPwnage commented 1 year ago

I tried to install in burp first and when that failed, I decided just to install and use the cli version instead but got many errors:

`(root㉿kali)-[~/tplmap] └─# pip install -r requirements.txt Collecting PyYAML==5.1.2 Downloading PyYAML-5.1.2.tar.gz (265 kB) ━━━━━━━━━━━━━━━━━━━━ 265.0/265.0 kB 9.4 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Collecting certifi==2018.10.15 Downloading certifi-2018.10.15-py2.py3-none-any.whl (146 kB) ━━━━━━━━━━━━━━━━━━━ 146.3/146.3 kB 25.3 MB/s eta 0:00:00 Requirement already satisfied: chardet==3.0.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 3)) (3.0.4) Requirement already satisfied: idna==2.8 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 4)) (2.8) Collecting requests==2.22.0 Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━ 58.0/58.0 kB 10.5 MB/s eta 0:00:00 Collecting urllib3==1.24.1 Downloading urllib3-1.24.1-py2.py3-none-any.whl (118 kB) ━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 18.9 MB/s eta 0:00:00 Collecting wsgiref==0.1.2 Downloading wsgiref-0.1.2.zip (37 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [9 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-lctvd9e0/wsgiref_d7010dd76a9d41859824def11078dadd/setup.py", line 5, in import ez_setup File "/tmp/pip-install-lctvd9e0/wsgiref_d7010dd76a9d41859824def11078dadd/ez_setup/init.py", line 170 print "Setuptools version",version,"or greater has been installed." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details. `

run these commands

git clone https://github.com/epinna/tplmap.git
cd tplmap
pip install virtualenv
virtualenv -p python2 venv
source venv/bin/activate
pip install -r requirements.txt
./tplmap.py -u 'http://<TARGET IP>:<PORT>' -d name=john
JPwnage commented 1 year ago

Hi the reason why we are encountering problems is because the is python 2 and kali has python 3 and the code isn't compatible with python 3.

Solution is to setup a python 2.7 environment


cd tplmap 

virtualenv -p python2 venv

source venv/bin/activate

After that use these commands to start your environment after install.

I actually put it in a script and for easy setup

AbrahamCain commented 1 year ago

Hi JPwnage. Thanks for giving me a lesson in Python2 virtual environments :D

masalepri98 commented 1 year ago

I get the following when trying to run the virtualenv piece: Exception: Wheel for wheel for Python 2.7 is unavailable. apt install python2-wheel-whl apt can't locate the python2-wheel-whl app, and Googling isn't getting me anywhere.

qNwNp commented 1 year ago

I get the following when trying to run the virtualenv piece:我在尝试运行virtualenv时得到以下结果: Exception: Wheel for wheel for Python 2.7 is unavailable. apt install python2-wheel-whl apt can't locate the python2-wheel-whl app, and Googling isn't getting me anywhere.apt找不到python 2-wheel-whl应用程序,谷歌搜索也没有找到任何地方。

I fixed some problems, maybe this helps you. https://github.com/qNwNp/tplmap