Commit 60d80fa0 authored by Edvard Rejthar's avatar Edvard Rejthar

MDM re-integration

parent 024d2761
......@@ -25,8 +25,8 @@ class Config:
browser = 'firefox' # iceweasel, firefox. What browser gets launched.
config_file = '/opt/mdmaug/.cache/mdmaug-scans/_tmp/queue.cache' # RAM disk was too small: '/tmp/mdm/queue.cache'
APP_PORT = 5000
APP_IP = "127.0.0.1" # 217.31.202.41
APP_HOST = f'http://{APP_IP}:{APP_PORT}' # Xhttps
APP_IP = "127.0.0.1" # CHANGE HERE IF NOT RUN ON LOCALHOST
APP_HOST = f'http://{APP_IP}:{APP_PORT}' # YOU MAY NEED TO CHANGE **https**
LOG_DIR = "/opt/mdmaug/.cache/mdmaug-scans/_tmp/"
CACHE_DIR = "/opt/mdmaug/.cache/mdmaug-scans/"
ALLOWED_DESTINATION = {"mdm.nic.cz": "https://mdm.nic.cz",
......
......@@ -136,7 +136,12 @@ def controller(request_url):
if "destination" in request:
if request["destination"] in Config.ALLOWED_DESTINATION:
# send everything up, we are in an iframe
return render_template("_message.html", contents=output, url=request_url,
try:
# this is not very nice workaround - MDM needs to know if it called 'vote' or 'analyze' command
cmd = list(request.keys())[3]
except:
cmd = "unknown"
return render_template("_message.html", contents=output, url=request_url, cmd=cmd,
destination=Config.ALLOWED_DESTINATION[request['destination']])
else:
return "Wrong destination: " + escape(request["destination"])
......
......@@ -171,7 +171,7 @@ class Encounter(DbModel):
logger.error(f"domain {host} should have been inserted in the database, but it hasn't been")
raise
ip_list = list(set([o.ip for o in rows if o.ip is not None]))
count = 0
count = 0
if ip_list:
count += Encounter.update(status=str(status)).where(Encounter.ip << ip_list).execute()
# ovlivnit i host s IP = NULL
......
This diff is collapsed.
......@@ -171,7 +171,7 @@ if (document.location.href.indexOf("https://mdm.nic.cz/list/") === 0) {
$("<label><input type='checkbox' checked='checked' name='wellknownfree' />Nechci zahrnout wz.cz apod</label> <span title='Webzdarma.cz, chytrak.cz apod mají stále nějaké hrozby a někdy je jejich týmy řeší proaktivně. Zašrktnutím této možnosti takové weby budeme rovnou ignorovat.'>(?)</span> <br />"));
};
$(window).load(function () {
$(window).on("load", function () {
/**
* nacteni ceka na flexigrid a plugin tabs, muze trvat nekolik vterin, nez se nacte
......
<html><body>
<div id=root>
{{ contents }}
{{ contents|safe }}
{% block main %}{% endblock %}
</div>
<script>parent.postMessage({'{{ analyze }}':document.getElementById('root').innerHTML, 'url' : '{{ url }}'}, '{{ destination }}');</script>
</body></html>
\ No newline at end of file
<script>parent.postMessage({'{{ cmd }}':document.getElementById('root').innerHTML, 'url' : '{{ url }}'}, '{{ destination }}');</script>
</body></html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment