Alpha first commit

This commit is contained in:
root
2017-12-19 23:39:22 +00:00
commit 0f53680f31
7 changed files with 217 additions and 0 deletions

41
file.py Executable file
View File

@@ -0,0 +1,41 @@
#!/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('<', '&lt', VHOST)
#VHOST = re.sub('>', '&gt', 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()