This repository has been archived on 2020-02-13. You can view files and clone it, but cannot push or open issues or pull requests.
cgi-pw_manager/index.py

31 lines
858 B
Python
Executable File

#!/usr/bin/python3.5
# DEBUG
import cgitb
cgitb.enable()
# IMPORT DES MODULES
import configparser
import os
from functions.headfoot import printheader,printfooter
# IMPORT DE LA CONFIGURATION
config = configparser.ConfigParser()
config.read('config.conf')
DOMAIN = config.get('general','domain')
PROTO = config.get('general','proto')
# AFFICHAGE DES ENTETES
printheader()
# BODY
print('<a href="http://', DOMAIN , '/new.py">Nouveau VHOST</a>', "<br>" , sep='' )
for i in sorted(os.listdir("/etc/apache2/sites-available")):
if os.path.isfile("/etc/apache2/sites-enabled/" + i):
print('<a href="', PROTO , '://', DOMAIN, '/file.py?file=',i, '">', i ,'</a> is enable!<br>', sep='')
else:
print('<a href="', PROTO , '://', DOMAIN, '/file.py?file=',i, '">', i ,'</a> is disable!<br>', sep='')
# AFFICHAGE DES FOOTERS
printfooter()