This is a quick note to get tplmap working again!

Previously on HTB: Doctor, this tool was worked fine with python2, but when I tried to use it again on HTB: Nunchucks, it threw these error messages.

→ kali@kali «tplmap» «192.168.1.55» git:(master) ✗ 
$ python tplmap.py 
Traceback (most recent call last):
  File "/opt/tplmap-venv/tplmap/./tplmap.py", line 2, in <module>
    from utils import cliparser
  File "/opt/tplmap-venv/tplmap/utils/cliparser.py", line 163, in <module>
    parser.formatter.format_option_strings = type(parser.formatter.format_option_strings)(_, parser, type(parser))
TypeError: method expected 2 arguments, got 3

Here’s how I resolve it.

$ python2 -m pip install --upgrade setuptools
$ python2 -m pip install virtualenv 
$ git clone https://github.com/epinna/tplmap.git
$ cd ./tplmap/
$ python2 -m virtualenv tplmap-venv
$ source ./tplmap-venv/bin/activate
(tplmap-venv) $ python2 -m pip install -r requirements.txt 

All the requirements should be listed now.

(tplmap-venv) → $ python2 -m pip list                                                      
--[snip annoying deprecated message]--
Package    Version
---------- ----------
certifi    2018.10.15
chardet    3.0.4
idna       2.8
pip        20.3.4
PyYAML     5.1.2
requests   2.22.0
setuptools 44.1.1
urllib3    1.24.1
wheel      0.37.0

It’s working fine now.

(tplmap-venv) → kali@kali «tplmap» «192.168.1.55» git:(master) 
$ python2 tplmap.py 
[+] Tplmap 0.5
    Automatic Server-Side Template Injection Detection and Exploitation Tool

Usage: python tplmap.py [options]

tplmap.py: error: URL is required. Run with -h for help.

I’m not sure about this, but on my other Kali, these commands (without venv) could get tplmap working again.

$ python2 install --upgrade setuptools
$ python2 -m pip install -r requirements.txt