Added check and exception for writable folders

This commit is contained in:
ProDigySML
2019-01-31 22:39:06 -08:00
parent 892aea749d
commit 49dc0d5611

View File

@@ -2,6 +2,7 @@ from argparse import ArgumentParser
from netaddr import IPNetwork, IPRange, IPGlob from netaddr import IPNetwork, IPRange, IPGlob
from Interlace.lib.core.output import OutputHelper, Level from Interlace.lib.core.output import OutputHelper, Level
import os.path import os.path
from os import access, W_OK
import sys import sys
from re import compile from re import compile
@@ -68,6 +69,10 @@ class InputHelper(object):
final_commands = set() final_commands = set()
output = OutputHelper(arguments) output = OutputHelper(arguments)
# checking for whether output is writable and whether it exists
if not access(arguments.output, W_OK):
raise Exception("Directory provided isn't writable")
if arguments.port: if arguments.port:
if "," in arguments.port: if "," in arguments.port:
ports = arguments.port.split(",") ports = arguments.port.split(",")