epinna / tplmap

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

module 'collections' has no attribute 'Mapping' #104

Open freedom1b2830 opened 2 years ago

freedom1b2830 commented 2 years ago

any pages

error msg:

Testing if GET parameter 'id' is injectable
Exiting: module 'collections' has no attribute 'Mapping'

versions: Tplmap 0.5 616b0e5 #!/usr/bin/env python ->Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux

os distr: ArchLinux

0xSysR3ll commented 1 year ago

Hello,

The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated.

It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄

Br,

0xSysr3ll

ndsecc commented 1 year ago

After your defined change it says:

Tplmap 0.5 Automatic Server-Side Template Injection Detection and Exploitation Tool

Testing if GET parameter 'name' is injectable Exiting: name 'collections' is not defined

ndsecc commented 1 year ago

For python 3.10 it's: from collections import Mapping

man3kin3ko commented 1 year ago

For those who is little confused like me, you should not just add from collections import Mapping, but replace collections.Mapping with Mapping at lines 21 and 22 in the core/plugin.py

abdulx01 commented 1 year ago

Hello,

The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated.

It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄

Br,

0xSysr3ll

After changing the collection library to: from collections import Mapping there is another issue is arising. ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Help me;

inzel commented 9 months ago

Hello, The error comes from this import in core/plugin.py :

import collections

In fact, since python3.3, this method to import Mapping is deprecated. It should be :

from collections.abc import Mapping

I will make a pull request to fix this but you can fix this issue 😄 Br, 0xSysr3ll

After changing the collection library to: from collections import Mapping there is another issue is arising. ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Help me;

You probably need to change it from from collections import Mapping to from collections.abc import Mapping

r-erd commented 7 months ago

I just encountered this issue and resolved it by replacing the import with import collections.abc and also replacing the references in lines 21 and 22 in core/plugin.py with collections.abc.Mapping instead of collections.Mapping.

hhhhhhhds6 commented 7 months ago

hello the solution is go to core/plugin.py and change "import collections" to "import collections.abc" then down in line 21 22 change collections.abc.Mapping instead of collections.Mapping.