lanmaster53 / recon-ng

Open Source Intelligence gathering tool aimed at reducing the time spent harvesting information from open sources.
GNU General Public License v3.0
4.1k stars 646 forks source link

Issue 'HTMLParser' object has no attribute 'unescape'. #133

Closed ghost closed 3 years ago

ghost commented 3 years ago

I am trying to use recon-ng to do a scan, the steps below all work until it gets to the end of the scan.

recon-ng marketplace refresh marketplace install all modules search modules load recon/domains-contacts/pgp_search info options set SOURCE website run

Soon as I hit run I get the following error:

[!] 'HTMLParser' object has no attribute 'unescape'. [!] Something broken? See https://github.com/lanmaster53/recon-ng/wiki/Troubleshooting#issue-reporting.

I then did "options set verbosity 2" and redone the scan, this time it showed:

Traceback (most recent call last):
File "/usr/share/recon-ng/recon/core/module.py", line 347, in do_run
self.run()
File "/usr/share/recon-ng/recon/core/module.py", line 341, in run
self.module_run(*params)
File "/home/kali/.recon-ng/modules/recon/domains-contacts/pgp_search.py", line 42, in module_run
fname, mname, lname = parse_name(name)
File "/usr/share/recon-ng/recon/utils/parsers.py", line 16, in parse_name
elements = [h.unescape(x) for x in s.strip().split()]
File "/usr/share/recon-ng/recon/utils/parsers.py", line 16, in
elements = [h.unescape(x) for x in s.strip().split()]
AttributeError: 'HTMLParser' object has no attribute 'unescape'


[!] Something broken? See https://github.com/lanmaster53/recon-ng/wiki/Troubleshooting#issue-reporting.

From doing research HTMLParser.unescape was removed from Python since version 3.9.0a1 so can we get a fix for this as nothing works.

I am currently using Kali Linux 64-Bit (Installer) with all updates done.

iiitee commented 3 years ago

I was able to work around this by editing the parsers.py file in /usr/share/recon-ng/recon/utils.
changed: import html.parser to import html and h = html.parser.HTMLParser() to h = html

this seems to have worked for me so far. but I have not done too much testing

ghost commented 3 years ago

It has also worked for me, it looks like some of the attacks just need modifying in the files such as with the modules load recon/domains-vulnerabilities/xssed.

Exit tool recon-ng tool!

recong-ng options set verbosity 2 modules load recon/domains-vulnerabilities/xssed options set source website.com run

Error code given:

Traceback (most recent call last):

File "/usr/share/recon-ng/recon/core/module.py", line 347, in do_run

self.run()

File "/usr/share/recon-ng/recon/core/module.py", line 341, in run

self.module_run(*params)

File "/home/kali/.recon-ng/modules/recon/domains-vulnerabilities/xssed.py", line 28, in module_run

details = [self.html_unescape(x).strip() for x in details]

File "/home/kali/.recon-ng/modules/recon/domains-vulnerabilities/xssed.py", line 28, in

details = [self.html_unescape(x).strip() for x in details]

File "/usr/share/recon-ng/recon/core/module.py", line 96, in html_unescape

return h.unescape(s)

AttributeError: 'HTMLParser' object has no attribute 'unescape'


[!] Something broken? See https://github.com/lanmaster53/recon-ng/wiki/Troubleshooting#issue-reporting .

The issue is:

File "/home/kali/.recon-ng/modules/recon/domains-vulnerabilities/xssed.py", line 28, in module_run

details = [self.html_unescape(x).strip() for x in details]

Fix changed code:

sudo nano /home/kali/.recon-ng/modules/recon/domains-vulnerabilities/xssed.py

import html.parser

details = [html.unescape(x).strip() for x in details]

On Fri, Feb 19, 2021 at 9:32 PM iiitee notifications@github.com wrote:

I was able to work around this by editing the parsers.py file in /usr/share/recon-ng/recon/utils. changed: import html.parser to import html and h = html.parser.HTMLParser() to h = html

this seems to have worked for me so far. but I have not done to much testing

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lanmaster53/recon-ng/issues/133#issuecomment-782370451, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARV3JSR4I7OJ2WUZKXHWWVDS73KIBANCNFSM4XOFBNVQ .

Jedarc commented 3 years ago

I was able to work around this by editing the parsers.py file in /usr/share/recon-ng/recon/utils. changed: import html.parser to import html and h = html.parser.HTMLParser() to h = html

this seems to have worked for me so far. but I have not done too much testing

dont work for me.

RafatKhandaker commented 3 years ago

if you're using kali linux - rewrite the python script parsers.py Here is the fix for the problem (very easy):

Step 1:
Navigate into and open file in text editor:

nano /usr/share/recon-ng/recon/utils/parsers.py

Delete line 15:

        `h=html.parser.HTMLParser()`

Edit line 16:

        ' elements = [html.parser.unescape(x) for x in s.strip().split()] '

This is how the parsers.py file should look: (Once you update this, simply re-launch recon-ng and run the module:)

Screenshot from 2021-03-25 04-10-54

abducar commented 3 years ago

if you're using kali linux - rewrite the python script parsers.py Here is the fix for the problem (very easy):

Step 1: Navigate into and open file in text editor:

nano /usr/share/recon-ng/recon/utils/parsers.py

Delete line 15:

        `h=html.parser.HTMLParser()`

Edit line 16:

        ' elements = [html.parser.unescape(x) for x in s.strip().split()] '

This is how the parsers.py file should look: (Once you update this, simply re-launch recon-ng and run the module:)

Screenshot from 2021-03-25 04-10-54

dont work for me

RafatKhandaker commented 3 years ago

what error do you get once you re-run the module?

go back to global setting and set verbosity to 2

run this comand on global settings recon-ng:

OPTIONS SET VERBOSITY 2

image

RafatKhandaker commented 3 years ago

^ ^ BTW, the root cause of this issue with HTML parser is if you are using python 3.9 over 3.8. Python 3.9 does not contain the HTMLParser() method used in the recon-ng script.

crbarahona commented 3 years ago

This was helpful. Thanks.

robbie888 commented 3 years ago

I was able to work around this by editing the parsers.py file in /usr/share/recon-ng/recon/utils. changed: import html.parser to import html and h = html.parser.HTMLParser() to h = html

this seems to have worked for me so far. but I have not done too much testing

This worked for me, but I only did minimal testing, similar changes might need to be made in other scripts too.

Is this project abandoned? Seems there are quite a few issues now making it quite difficult to use... I also had to edit the bing api related scripts with a different search endpoints, see pull request https://github.com/lanmaster53/recon-ng/pull/128 which resolves that issue and still hasn't been accepted from over a year ago...

lanmaster53 commented 3 years ago

Project not abandoned, but it's definitely been a while since I've had time to commit here. This is definitely a version issue. Quick fix is to say that it is not compatible with Python 3.9. So, only compatible with Python 3.6 to Python 3.8. I need to find a better way to fix this though.

lanmaster53 commented 3 years ago

Since there is already a minimum of 3.6, we are free to move to html.unescape for all instances of this. I will make the change. Thanks all!

lanmaster53 commented 3 years ago

This will be fixed once I push the change to the master branch.