Skip to content

Instantly share code, notes, and snippets.

@martimors
Created October 22, 2021 07:31
Show Gist options
  • Save martimors/c52f9df9c31b073c9fb7a673cc908a73 to your computer and use it in GitHub Desktop.
Save martimors/c52f9df9c31b073c9fb7a673cc908a73 to your computer and use it in GitHub Desktop.
Bruteforce environmental variable guessing game because FIX YOUR DOCS
prefixes = ["", "SCHEMA_REGISTRY", "SCHEMA_REGISTRY_SCHEMA_REGISTRY"]
middle = ["CONFLUENT", "KAFKASTORE", "ACL", "TOPIC"]
suffix = ["GROUP_ID", "GROUPID", "CONSUMER_GROUP_ID", "CONSUMER_GROUPID", "GROUP"]
from itertools import permutations
middle_choices = []
for a in range(len(middle)+1):
comb = permutations(middle, a)
for i in comb:
middle_choices.append("_".join(i))
final = []
for k in prefixes:
for m in suffix:
for n in middle_choices:
choice = k + ("_" + n + "_" if n != "" else "_") + m
choice = choice.lstrip("_")
final.append(choice)
with open("lol.txt", "w") as f:
for n, x in enumerate(final):
val = (
f"- name: {x}\n"
f" value: dataplatform-ajamn.test{n}\n"
)
f.write(val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment