Skip to content
Permalink
2e84ec9122
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
38 lines (25 sloc) 911 Bytes
import logging
import random
import string
import jinja2
def create_target():
"""
Create the Target C File
@param seed: Seed for the target, between 0 and 32
"""
env = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath="."))
template = env.get_template("target.jinja2")
username = random.choice(["Zaphod",
"Ford",
"Arthur",
"Tricia"])
logging.debug("User is %s", username)
password = "".join(random.choice(string.ascii_letters) for x in range(16))
logging.debug("Password is %s", password)
result = template.render(username = username,
password = password)
with open("target.c", "w") as fd:
fd.write(result)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
create_target()