48 lines
1.0 KiB
Python
Executable File
48 lines
1.0 KiB
Python
Executable File
#!/usr/bin/python3.5
|
|
import cgi
|
|
import cgitb
|
|
cgitb.enable()
|
|
import re
|
|
import configparser
|
|
from functions.headfoot import printheader,printfooter
|
|
|
|
# IMPORT DE LA CONFIGURATION
|
|
config = configparser.ConfigParser()
|
|
config.read('config.conf')
|
|
|
|
DOMAIN = config.get('general','domain')
|
|
TEMPLATEPATH = config.get('general','templatepath')
|
|
PROTO = config.get('general','proto')
|
|
|
|
# EXTRACTION DES VARIABLES
|
|
TEMPLATEFILE = open(TEMPLATEPATH, "r")
|
|
TEMPLATE = TEMPLATEFILE.read()
|
|
|
|
ALLVARIABLES = re.findall(r'\$\$\w+', TEMPLATE)
|
|
VARIABLES = ""
|
|
|
|
for i in ALLVARIABLES:
|
|
if VARIABLES.find(i) == -1:
|
|
VARIABLES = VARIABLES +" "+ i
|
|
|
|
VARIABLES = re.sub('[$$]', '', VARIABLES)
|
|
|
|
printheader()
|
|
|
|
# BODY
|
|
print('<form action="/create.py">')
|
|
print('Nom du VirtualHost : <input type="text" name="VHOSTNAME"><br>')
|
|
|
|
for i in VARIABLES.split():
|
|
print(i, ':')
|
|
print('<input type="text" name="', i , '"><br>', sep="")
|
|
|
|
print('<input type="submit" value="GO">')
|
|
|
|
print('</form>')
|
|
print('<br><a href="', PROTO , '://', DOMAIN , '/index.py">Retour</a>', sep='')
|
|
|
|
|
|
printfooter()
|
|
|