Add support for file inputs
This commit is contained in:
parent
30d51db336
commit
beb92ca506
@ -223,8 +223,16 @@ def get_args():
|
|||||||
"""Set argparse options."""
|
"""Set argparse options."""
|
||||||
parser = ArgumentParser(prog='ssl_checker.py', add_help=False,
|
parser = ArgumentParser(prog='ssl_checker.py', add_help=False,
|
||||||
description="""Collects useful information about given host's SSL certificates.""")
|
description="""Collects useful information about given host's SSL certificates.""")
|
||||||
parser.add_argument('-H', '--host', dest='hosts', nargs='*', required=True,
|
|
||||||
|
|
||||||
|
group = parser.add_mutually_exclusive_group()
|
||||||
|
|
||||||
|
group.add_argument('-H', '--host', dest='hosts', nargs='*', required=False,
|
||||||
help='Hosts as input separated by space')
|
help='Hosts as input separated by space')
|
||||||
|
|
||||||
|
group.add_argument('-f', '--host-file', dest='host_file', required=False,
|
||||||
|
help='Hosts as input from file')
|
||||||
|
|
||||||
parser.add_argument('-s', '--socks', dest='socks',
|
parser.add_argument('-s', '--socks', dest='socks',
|
||||||
default=False, metavar='HOST:PORT',
|
default=False, metavar='HOST:PORT',
|
||||||
help='Enable SOCKS proxy for connection')
|
help='Enable SOCKS proxy for connection')
|
||||||
@ -246,6 +254,12 @@ def get_args():
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Get hosts from file if provided
|
||||||
|
if args.host_file:
|
||||||
|
hosts_file = open(args.host_file, 'r')
|
||||||
|
args.hosts = hosts_file.readlines()
|
||||||
|
hosts_file.close()
|
||||||
|
|
||||||
# Checks hosts list
|
# Checks hosts list
|
||||||
if isinstance(args.hosts, list):
|
if isinstance(args.hosts, list):
|
||||||
if len(args.hosts) == 0:
|
if len(args.hosts) == 0:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user