Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the function "nmap3.Nmap().nmap_version_detection()" seems that it has a problem #29

Closed
bobolike123 opened this issue Sep 16, 2020 · 6 comments

Comments

@bobolike123
Copy link

in nmap3\nmapparser.py the function "version_detection()" has not defined the variable "service_version_dict". when I used the "nmap3.Nmap().nmap_version_detection()" to call the "version_detection()", it raised "NameError: name 'service_version_dict' is not defined".

ps: I programmed my code at Win10 OS

@nmmapper
Copy link
Owner

Okay thanks for reporting we shall investigate and fix it immediately.

@nmmapper
Copy link
Owner

It seems you are calling the wrong way

import nmap3
nmap = nmap3.Nmap()
version = nmap.nmap_version() # works
version_result = nmap.nmap_version_detection("your-host.com")

That is how you all nmap_version_detection to detect versions on hosts.

@bobolike123
Copy link
Author

the function 【nmap.nmap_version()】can work properly, but【nmap.nmap_version_detection("my-host.com")】still get wrong. I have tried to change the args from "my-host.com" to "www.my-host.com" even the ipv4 address. They got the same wrong 【'service_version_dict' is not defined"】
Strangely,if I use the 【nmap.scan_top_ports("www.my-host.com",args='-sV')】 instead, it can return the result without any wrong.

By the way, I define the path of 【namp.exe】 and the code is 【nmap = nmap3.Nmap(path=‘my-nmap_exe-path’)】rather than 【nmap=namp3.Nmap()】because my operating system can not find the namp.exe automatically

Is it the problem of my OS?Because I understand that some code programmed at Linux will yield wrong at Win.

The detailed traceback of the information is listed below:
Traceback (most recent call last):
File "F:/pyCode/generator.py", line 127, in
run('version_detection')
File "F:/pyCode/generator.py", line 106, in run
js = _namp3_version_detection(url)
File "F:/pyCode/generator.py", line 60, in _namp3_version_detection
json_result = nmap.nmap_version_detection(host)
File "F:\Anaconda3\lib\site-packages\nmap3\nmap3.py", line 178, in nmap_version_detection
services = self.parser.version_parser(xml_root)
File "F:\Anaconda3\lib\site-packages\nmap3\nmapparser.py", line 393, in version_parser
raise(e)
File "F:\Anaconda3\lib\site-packages\nmap3\nmapparser.py", line 390, in version_parser
service_version_dict[address] = services_result
NameError: name 'service_version_dict' is not defined

Process finished with exit code 1

@nmmapper
Copy link
Owner

Alright, let me look into it again.

@nmmapper
Copy link
Owner

This was a bug, but now it has been fixed. You can update the local installation from git we have not pushed the changes to pypi

pip3 install git+https://github.com/wangoloj/python3-nmap.git

@bobolike123
Copy link
Author

thanks for your effort ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants