|
1 | 1 | # nmap3.py |
2 | | -# |
| 2 | +# |
3 | 3 | # Copyright 2019 Wangolo Joel <wangolo@ldap.testlumiotic.com> |
4 | | -# |
| 4 | +# |
5 | 5 | # This program is free software; you can redistribute it and/or modify |
6 | 6 | # it under the terms of the GNU General Public License as published by |
7 | 7 | # the Free Software Foundation; either version 2 of the License, or |
8 | 8 | # (at your option) any later version. |
9 | | -# |
| 9 | +# |
10 | 10 | # This program is distributed in the hope that it will be useful, |
11 | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | 13 | # GNU General Public License for more details. |
14 | | -# |
| 14 | +# |
15 | 15 | # You should have received a copy of the GNU General Public License |
16 | 16 | # along with this program; if not, write to the Free Software |
17 | 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | 18 | # MA 02110-1301, USA. |
19 | | -# |
| 19 | +# |
| 20 | + |
| 21 | +__author__ = "Wangolo Joel (inquiry@nmapper.com)" |
| 22 | +__version__ = "1.9.3" |
| 23 | +__last_modification__ = "Jun/06/2025" |
| 24 | + |
| 25 | +import typing |
20 | 26 |
|
21 | | -__author__ = 'Wangolo Joel (inquiry@nmapper.com)' |
22 | | -__version__ = '1.9.3' |
23 | | -__last_modification__ = 'Jun/06/2025' |
24 | 27 |
|
25 | 28 | class NmapNotInstalledError(Exception): |
26 | 29 | """Exception raised when nmap is not installed""" |
27 | | - |
28 | | - def __init__(self, path=""): |
| 30 | + |
| 31 | + def __init__(self, path: typing.Optional[str] = None): |
29 | 32 | self.message = f"Nmap is either not installed or we couldn't locate \ |
30 | 33 | nmap path. Please ensure nmap is installed and provide right path string. \n\ |
31 | 34 | Provided: *{path if path else 'Not provided'}*" |
32 | 35 | super().__init__(self.message) |
33 | | - |
| 36 | + |
| 37 | + |
34 | 38 | class NmapXMLParserError(Exception): |
35 | 39 | """Exception raised when we can't parse the output""" |
36 | | - |
37 | | - def __init__(self, message="Unable to parse xml output"): |
38 | | - self.message = message |
| 40 | + |
| 41 | + def __init__(self, message: str = "Unable to parse xml output"): |
| 42 | + self.message = message |
39 | 43 | super().__init__(message) |
40 | 44 |
|
| 45 | + |
41 | 46 | class NmapExecutionError(Exception): |
42 | 47 | """Exception raised when en error occurred during nmap call""" |
43 | | - |
|
0 commit comments