43 lines
965 B
Python
43 lines
965 B
Python
#!/usr/bin/env python3
|
|
|
|
def read_file(file_name):
|
|
with open(file_name, 'r') as file:
|
|
data = file.readlines()
|
|
return [line.strip() for line in data if line.strip()]
|
|
|
|
def generate_san_config(ips, domains, emails):
|
|
san_config = ""
|
|
entries = []
|
|
|
|
for i, ip in enumerate(ips):
|
|
entries.append(f"IP.{i} = {ip}")
|
|
|
|
for i, domain in enumerate(domains):
|
|
entries.append(f"DNS.{i} = {domain}")
|
|
|
|
for i, email in enumerate(emails):
|
|
entries.append(f"email.{i} = {email}")
|
|
|
|
san_config += "\n".join(entries)
|
|
return san_config
|
|
|
|
def main():
|
|
ip_file = "vars/ips"
|
|
domain_file = "vars/domains"
|
|
email_file = "vars/emails"
|
|
|
|
ips = read_file(ip_file)
|
|
domains = read_file(domain_file)
|
|
emails = read_file(email_file)
|
|
|
|
if not ips and not domains and not emails:
|
|
return
|
|
|
|
san_config = generate_san_config(ips, domains, emails)
|
|
|
|
print(san_config)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|