mirror of
https://github.com/jtesta/ssh-audit.git
synced 2024-11-22 10:31:41 +01:00
Now prints a graceful error message when policy file is not found.
This commit is contained in:
parent
1730126af8
commit
f0db035044
@ -21,10 +21,13 @@
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
import sys
|
||||||
|
|
||||||
from typing import Dict, List, Tuple
|
from typing import Dict, List, Tuple
|
||||||
from typing import Optional, Any, Union, cast
|
from typing import Optional, Any, Union, cast
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
from ssh_audit import exitcodes
|
||||||
from ssh_audit.ssh2_kex import SSH2_Kex # pylint: disable=unused-import
|
from ssh_audit.ssh2_kex import SSH2_Kex # pylint: disable=unused-import
|
||||||
from ssh_audit.banner import Banner
|
from ssh_audit.banner import Banner
|
||||||
|
|
||||||
@ -107,8 +110,12 @@ class Policy:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if policy_file is not None:
|
if policy_file is not None:
|
||||||
with open(policy_file, "r") as f:
|
try:
|
||||||
policy_data = f.read()
|
with open(policy_file, "r") as f:
|
||||||
|
policy_data = f.read()
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Error: policy file not found: %s" % policy_file)
|
||||||
|
sys.exit(exitcodes.UNKNOWN_ERROR)
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
if policy_data is not None:
|
if policy_data is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user