feat: add option to get host names from an external file
This commit is contained in:
parent
5b59455bef
commit
dd39b24277
1 changed files with 13 additions and 1 deletions
|
@ -87,12 +87,24 @@ def get_issuer(cert):
|
||||||
default=True,
|
default=True,
|
||||||
help="Enable/disable ANSI color output to show cert validity",
|
help="Enable/disable ANSI color output to show cert validity",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--filename",
|
||||||
|
"-f",
|
||||||
|
type=click.Path(),
|
||||||
|
help="Read a list of hosts to check from a file",
|
||||||
|
)
|
||||||
@click.argument("hosts", nargs=-1)
|
@click.argument("hosts", nargs=-1)
|
||||||
def main(san, dump, color, hosts):
|
def main(san, dump, color, filename, hosts):
|
||||||
"""Return information about certificates given including their validity"""
|
"""Return information about certificates given including their validity"""
|
||||||
# setup the list of tuples
|
# setup the list of tuples
|
||||||
all_hosts = []
|
all_hosts = []
|
||||||
# handle a domain given with a : in it to specify the port
|
# handle a domain given with a : in it to specify the port
|
||||||
|
if filename:
|
||||||
|
hosts = []
|
||||||
|
with open(filename, "r") as infile:
|
||||||
|
for line in infile:
|
||||||
|
line = line.strip()
|
||||||
|
hosts.append(line)
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
# if a host has a : in it, split on the :, first field will be host
|
# if a host has a : in it, split on the :, first field will be host
|
||||||
# second field will be the port
|
# second field will be the port
|
||||||
|
|
Loading…
Reference in a new issue