42 lines
945 B
Python
Executable File
42 lines
945 B
Python
Executable File
#!/usr/bin/python3.5
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import cgi
|
|
import cgitb
|
|
cgitb.enable()
|
|
import re
|
|
import configparser
|
|
from functions.headfoot import printheader,printfooter
|
|
from functions.htmlsyntaxfc import htmlsyntax
|
|
# IMPORT DE LA CONFIGURATION
|
|
config = configparser.ConfigParser()
|
|
config.read('config.conf')
|
|
|
|
DOMAIN = config.get('general','domain')
|
|
PROTO = config.get('general','proto')
|
|
|
|
# TRAITEMENT DES DATA
|
|
fs = cgi.FieldStorage()
|
|
VHOSTNAME = cgi.escape(fs.getvalue('file'))
|
|
VHOSTPATH = "/etc/apache2/sites-available/" + VHOSTNAME
|
|
VHOSTFILE = open(VHOSTPATH, "r")
|
|
VHOST = VHOSTFILE.read()
|
|
|
|
VHOST = htmlsyntax(VHOST)
|
|
#VHOST = re.sub('<', '<', VHOST)
|
|
#VHOST = re.sub('>', '>', VHOST)
|
|
|
|
# AFFICHAGE DES ENTETES
|
|
printheader()
|
|
|
|
# BODY
|
|
print('<b>', VHOSTNAME , '</b>')
|
|
print("<pre>")
|
|
print('<p>', VHOST, '</p>' )
|
|
print('</pre>')
|
|
print('<a href="', PROTO , '://', DOMAIN , '/index.py">Retour</a>', sep='')
|
|
|
|
# AFFICHAGE DU FOOTER
|
|
printfooter()
|
|
|