Skip to content

Commit 2561051

Browse files
committed
add to NmapNotInstallError wrong provided path in desc
1 parent 349a029 commit 2561051

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

nmap3/exceptions.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1818
# MA 02110-1301, USA.
1919
#
20-
#
21-
import shlex
22-
import subprocess
23-
import sys
24-
import re
2520

2621
__author__ = 'Wangolo Joel (inquiry@nmapper.com)'
2722
__version__ = '1.6.0'
@@ -30,9 +25,11 @@
3025
class NmapNotInstalledError(Exception):
3126
"""Exception raised when nmap is not installed"""
3227

33-
def __init__(self, message="Nmap is either not installed or we couldn't locate nmap path Please ensure nmap is installed"):
34-
self.message = message
35-
super().__init__(message)
28+
def __init__(self, path=""):
29+
self.message = f"Nmap is either not installed or we couldn't locate \
30+
nmap path. Please ensure nmap is installed and provide right path string. \n\
31+
Provided: *{path if path else 'Not provided'}*"
32+
super().__init__(self.message)
3633

3734
class NmapXMLParserError(Exception):
3835
"""Exception raised when we can't parse the output"""

nmap3/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def get_nmap_path(path:str='') -> str:
5454
except Exception as e:
5555
print(e)
5656
sub_proc.kill()
57-
raise NmapNotInstalledError()
57+
raise NmapNotInstalledError(path=path)
5858
else:
5959
if os_type == 'win32':
6060
return output.decode('utf8').strip().replace("\\", "/")

0 commit comments

Comments
 (0)