Skip to content

Commit 638fa5b

Browse files
committed
bug fix: add website owner email for vhost ssl config
1 parent e922b47 commit 638fa5b

File tree

2 files changed

+8
-111
lines changed

2 files changed

+8
-111
lines changed

plogical/sslUtilities.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ def getDNSRecords(virtualHostName):
6464

6565
@staticmethod
6666
def installSSLForDomain(virtualHostName, adminEmail='usman@cyberpersons.com'):
67+
68+
try:
69+
website = Websites.objects.get(domain=virtualHostName)
70+
adminEmail = website.adminEmail
71+
except BaseException as msg:
72+
logging.CyberCPLogFileWriter.writeToFile('%s [installSSLForDomain:72]' % (str(msg)))
73+
74+
6775
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
6876
confPath = sslUtilities.Server_root + "/conf/vhosts/" + virtualHostName
6977
completePathToConfigFile = confPath + "/vhost.conf"

plogical/test.py

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +0,0 @@
1-
import requests
2-
import re
3-
import sys
4-
import warnings
5-
from flask import Flask, request, render_template, redirect, url_for
6-
from io_parser import FormParser
7-
from urllib3.exceptions import InsecureRequestWarning
8-
9-
warnings.simplefilter('ignore', InsecureRequestWarning)
10-
11-
app = Flask(__name__)
12-
app.debug = True
13-
app.config.update(
14-
JSON_SORT_KEYS=False,
15-
JSONIFY_PRETTYPRINT_REGULAR=True
16-
)
17-
18-
view = 'index.html'
19-
20-
21-
@app.route('/', methods=['GET'])
22-
def explore():
23-
error = {
24-
'types': set(),
25-
'input': [],
26-
}
27-
http = None
28-
x_lsadc_cache, x_qc_cache, x_litespeed_cache, cf_cache_cache, browser_cache, cache_support, x_sucuri_cache = (
29-
False,) * 7
30-
fp = FormParser(host=request.args.get('host'), ip=request.args.get('ip'),
31-
port=request.args.get('port'),
32-
advanced=request.args.get('advanced'))
33-
34-
if not fp.host:
35-
return render_template(view, form=fp.__dict__())
36-
if fp.check_error():
37-
error['types'].add('input')
38-
error['input'] = fp.error_msgs
39-
return render_template(view, form=fp.__dict__(), error=error)
40-
form = fp.__dict__()
41-
42-
finalURL = ''
43-
44-
if form['url'].find('http') == -1:
45-
finalURL = 'https://%s' % (form['url'])
46-
else:
47-
finalURL = form['url']
48-
49-
try:
50-
51-
resp = requests.get('' + (finalURL, form['ip'])[form['advanced']], headers={
52-
'Host': form['host'],
53-
'User-Agent': 'wget/http3check.net',
54-
}, verify=False)
55-
56-
http = [key + ': ' + value for key, value in resp.headers.items() if key != 'Link']
57-
http.insert(0, 'HTTP/1.1 {} {}'.format(resp.status_code, resp.reason))
58-
for key, value in resp.headers.items():
59-
key = key.lower()
60-
value = value.lower()
61-
if key == 'x-lsadc-cache':
62-
if value == 'hit':
63-
x_lsadc_cache = True
64-
cache_support = True
65-
elif key == 'x-qc-cache':
66-
if value == 'hit':
67-
x_qc_cache = True
68-
cache_support = True
69-
elif key == 'x-litespeed-cache':
70-
if value == 'hit':
71-
x_litespeed_cache = True
72-
cache_support = True
73-
elif key == 'cf-cache-status':
74-
if value == 'hit':
75-
cf_cache_cache = True
76-
elif key == 'cache-control':
77-
if 'no-cache' not in value and 'max-age=0' not in value:
78-
browser_cache = True
79-
elif key == 'x-sucuri-cache':
80-
if value == 'hit':
81-
x_sucuri_cache = True
82-
83-
finalHTTP = []
84-
from flask import Markup
85-
86-
for items in http:
87-
if items.lower().find('x-litespeed-cache:') > -1 or items.lower().find('x-lsadc-cache:') > -1 or items.lower().find(
88-
'x-qc-cache:') > -1:
89-
finalHTTP.append(Markup('<strong>%s</strong>' % (items)))
90-
elif items.lower().find('link:') > -1:
91-
pass
92-
else:
93-
finalHTTP.append(items)
94-
95-
return render_template(view, cache_support=cache_support, x_lsadc_cache=x_lsadc_cache, x_qc_cache=x_qc_cache,
96-
x_litespeed_cache=x_litespeed_cache, cf_cache_cache=cf_cache_cache,
97-
x_sucuri_cache=x_sucuri_cache,
98-
browser_cache=browser_cache, form=form, http=finalHTTP)
99-
except BaseException as msg:
100-
return render_template(view, form={}, error=str(msg))
101-
102-
103-
@app.route('/<page>', methods=['GET'])
104-
def home(page):
105-
if page == 'about' or page == 'about.html':
106-
return render_template(view, about=True)
107-
# return redirect("https://lscache.io/", code=302)
108-
return redirect(url_for('explore'))
109-
110-
if __name__ == '__main__':
111-
app.run(host= '0.0.0.0')

0 commit comments

Comments
 (0)