Commit 9787319c authored by Edvard Rejthar's avatar Edvard Rejthar

common css for MDM and MDMaug frontends

parent 3f0a81b4
......@@ -127,7 +127,7 @@ class _Url(set):
def list_sourcefiles(self):
for file in self.sourcefiles:
yield Config.APP_DOMAIN + "/api/nicify/" + file
yield Config.APP_DOMAIN + "/api/nicify" + file
class _Address(set):
""" Adresa navstivene domeny """
......
# Zpracuje log z firefoxu. Ten v tmp necha .tmp fily s html a js a screenshot.
from html import escape
import io
import logging
from contextlib import redirect_stdout
from html import escape
from os import listdir
from os.path import isfile, join, splitext
from bs4 import BeautifulSoup
from os.path import isfile, join, splitext
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import HtmlLexer
......@@ -51,13 +51,11 @@ class TrafficLogParser:
def nicifyFile(sourcefile):
""" Returns nicified output of a .tmp file containing the source codes """
nicefile = sourcefile + ".htm"
if isfile(nicefile):
with open(nicefile, "r") as f:
nice_file = sourcefile + ".htm"
if isfile(nice_file):
with open(nice_file, "r") as f:
return f.read()
else:
import ipdb; ipdb.set_trace()
with open(sourcefile, 'r') as f:
type_ = ""
# first row is URL a type of stream (since Webextensions no more mime type)
......@@ -67,21 +65,26 @@ class TrafficLogParser:
contents = f.read() # the rest of the file contains source data
if contents == "":
return "error: no content fetched"
buf = io.StringIO()
with redirect_stdout(buf): # print -> promenna
logging.debug("<h3>{}</h3>".format(url))
if "main_frame" in type_ or "sub_frame" in type_: # X"html"
if "main_frame" in type_ or "sub_frame" in type_: # X"html"
TrafficLogParser.HtmlParse(contents)
elif "script" in type_: # X"javascript"
elif "script" in type_: # X"javascript"
TrafficLogParser.JsParse(contents)
else: # output file of an unknown type in plain-text at least
print(escape(contents))
data = buf.getvalue()
with open(nicefile, "w") as f2: # zapsat hezke formatovani do souboru
f2.write(data) # cachovat
with open(nice_file, "w") as f2: # zapsat hezke formatovani do souboru
f2.write(data)
buf.close()
return data
# html parser
......
#reply-filter input {
width: 150px;
}
#analysis-result-panel .analysis {
clear: both;
}
#analysis .screenshot,
#analysis-result-panel .screenshot {
float: right;
}
#analysis .domain,
#analysis-result-panel .domain {
color: black;
font-weight: bold;
}
#analysis .addresses,
#analysis-result-panel .addresses {
font-size: 75%;
}
#analysis .addresses .ip,
#analysis-result-panel .addresses .ip {
color: blue;
margin-left: 5px;
}
#analysis .addresses .country,
#analysis-result-panel .addresses .country {
font-weight: bold;
}
#analysis .urls,
#analysis-result-panel .urls {
margin-left: 5px;
}
#analysis .urls li,
#analysis-result-panel .urls li {
color: green;
margin: 0;
}
#analysis .urls li:hover,
#analysis-result-panel .urls li:hover {
color: #111;
}
#analysis .voting,
#analysis-result-panel .voting {
margin-right: 5px;
}
#analysis .web[data-vote=allow] .urls,
#analysis-result-panel .web[data-vote=allow] .urls,
#analysis .web[data-vote=allow] .addresses,
#analysis-result-panel .web[data-vote=allow] .addresses {
display: none;
}
#analysis .web[data-vote=block],
#analysis-result-panel .web[data-vote=block] {
background-color: #f55;
}
#analysis .web[data-vote=block] .urls p,
#analysis-result-panel .web[data-vote=block] .urls p {
color: white;
}
#analysis .web[data-vote=log],
#analysis-result-panel .web[data-vote=log] {
background-color: #cc9;
}
#analysisTemp {
clear: both;
}
.safebrowsing-status {
display: inline-block;
margin: 2px;
border: 1px dotted pink;
padding: 5px;
}
/*# sourceMappingURL=analysis-style.css.map */
\ No newline at end of file
{"version":3,"sources":["./analysis-style.less"],"names":[],"mappings":"AAAA,aAAc;EACV,YAAA;;AAGJ,sBACI;EACI,WAAA;;AAIR,SACI;AAD0B,sBAC1B;EACI,YAAA;;AAFR,SAII;AAJ0B,sBAI1B;EACI,YAAA;EACA,iBAAA;;AANR,SAQI;AAR0B,sBAQ1B;EACI,cAAA;;AATR,SAQI,WAEI;AAVsB,sBAQ1B,WAEI;EACI,WAAA;EACA,gBAAA;;AAZZ,SAQI,WAMI;AAdsB,sBAQ1B,WAMI;EACI,iBAAA;;AAfZ,SAkBI;AAlB0B,sBAkB1B;EACI,gBAAA;;AAnBR,SAkBI,MAEI;AApBsB,sBAkB1B,MAEI;EAEI,YAAA;EACA,SAAA;;AACA,SANR,MAEI,GAIK;AAAD,sBANR,MAEI,GAIK;EACG,WAAA;;AAzBhB,SA6BI;AA7B0B,sBA6B1B;EACI,iBAAA;;AA9BR,SAgCI,KAAI,iBACA;AAjCsB,sBAgC1B,KAAI,iBACA;AAjCR,SAgCI,KAAI,iBACO;AAjCe,sBAgC1B,KAAI,iBACO;EACH,aAAA;;AAlCZ,SAqCI,KAAI;AArCsB,sBAqC1B,KAAI;EACA,sBAAA;;AAtCR,SAqCI,KAAI,iBAEA,MACA;AAxCsB,sBAqC1B,KAAI,iBAEA,MACA;EACI,YAAA;;AAzCZ,SA6CI,KAAI;AA7CsB,sBA6C1B,KAAI;EACA,sBAAA;;AAGR;EACI,WAAA;;AAEJ;EACI,qBAAA;EACA,WAAA;EACA,uBAAA;EACA,YAAA","file":"analysis-style.css"}
\ No newline at end of file
#reply-filter input {
width: 150px;
}
#analysis-result-panel {
.analysis {
clear:both;
}
}
#analysis /* MDM frontend */, #analysis-result-panel /* MDMaug frontend */{
.screenshot {
float: right;
}
.domain {
color: black;
font-weight: bold;
}
.addresses {
font-size: 75%;
.ip {
color: blue;
margin-left: 5px;
}
.country {
font-weight: bold;
}
}
.urls {
margin-left: 5px;
li {
//cursor: pointer;
color: green;
margin: 0;
&:hover {
color: #111;
}
}
}
.voting {
margin-right: 5px;
}
.web[data-vote=allow] {
.urls, .addresses {
display: none;
}
}
.web[data-vote=block] {
background-color: #f55;
.urls
p {
color: white;
}
}
.web[data-vote=log] {
background-color: #cc9;
}
}
#analysisTemp {
clear: both; // floating screenshot wont overflow
}
.safebrowsing-status {
display: inline-block;
margin: 2px;
border: 1px dotted pink;
padding: 5px;
}
\ No newline at end of file
// ==UserScript==
// @name mdm
// @namespace mdm
// @include https://mdm.nic.cz/detail/*
// @version 1
// @grant none
// ==/UserScript==
// @description MDM-stranka s detaily nakazene sity. Ve FF doporucuju zaskrtnout, at se taby oteviraji vedle rodice, nikoli na konci. (Ja pouzivam TabMixPlus.)
// The page https://mdm.nic.cz/detail/*
// MDM-stranka s detaily nakazene sity. Ve FF doporucuju zaskrtnout, at se taby oteviraji vedle rodice, nikoli na konci. (Ja pouzivam TabMixPlus.)
/*
if (typeof jQuery !== "function") {var js = document.createElement("script");var he = document.getElementsByTagName('head')[0];js.type = "text/javascript";js.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js";he.appendChild(js);
js.addEventListener("load", function() {$(function() {go();});});}*/
if (document.location.href.indexOf("https://mdm.nic.cz/detail/") === 0) {
var KEY = {DOWN: 40, UP: 38, LEFT: 37, RIGHT: 39, ALT: 17, C: 67, L: 76, N: 78, W: 87, N1: 49, N2: 50, N3: 51, N4: 52, N5: 53, N6: 54, N7: 55, N8: 56, N9: 57, F: 70, S: 83};
$ = j;
if (typeof j === "function") { // load jQuery from MDM's local variable 'j'
$ = j;
}
APP_HOST = "https://217.31.202.41:8000";
$(function () {
$('#detail_tabs').tabs('option', 'active', 3);//XX nejprve jdeme na tab korespondence (nevim, jestli tohle funguje)
//Prida tab s analyzou
// Add the MDMaug tab to the MDM application
$("div#detail_tabs ul").prepend("<li class='ui-state-default ui-corner-top'><a href='#analysisWrapper'>Analýza <span id='analysis-info'></span></a></li>");
$("div#detail_tabs").append($("<div />", {id: 'analysisWrapper', class: 'ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'}));
$("div#detail_tabs").tabs("refresh");
$("<h1>MDMaug analýza</h1><p>(Alt+↕ pohybuje mezi hlasováním)</p>").prependTo("#analysisWrapper");
//jQueryUI=1.8 $("div#detail_tabs").tabs().tabs('add','#analysisWrapper','Analýza');
//sessionStorage.clear();
Analysis = function () {
//vypis analyzy
......@@ -296,36 +290,6 @@ if (document.location.href.indexOf("https://mdm.nic.cz/detail/") === 0) {
correspondenceCount = "";
correspondenceUrl = "";
/**
* css stylovani stranky
*/
style = function () {
//stylovani
$('html > head').append($('<style>#reply-filter input { width:150px; }' +
'#analysis .screenshot { float:right; }' +
'#analysis .domain { color: black; font-weight: bold;}' +
'#analysis .addresses { font-size:75%} ' +
'#analysis .addresses .ip { color: blue; margin-left:5px}' +
'#analysis .addresses .country { font-weight: bold}' +
'#analysis .urls {margin-left:5px}' +
'#analysis .urls li { Xcursor:pointer; color: green; margin: 0;}' +
'#analysis .urls li:hover {color:#111;}' +
'#analysis .voting {margin-right: 5px}' +
'#analysis .web[data-vote=allow] .urls {display:none}' +
'#analysis .web[data-vote=allow] .addresses {display:none}' +
'#analysis .web[data-vote=block] {background-color:#f55;}' +
'#analysis .web[data-vote=block] .urls p{color:white;}' +
'#analysis .web[data-vote=log] {background-color:#cc9}' +
'#analysisTemp {clear: both}' + // floatovany screenshot nepreteka
//'#output {width: 100%; height: 120px}' +
'.safebrowsing-status {display:inline-block; margin:2px;border: 1px dotted pink;padding: 5px;}' +
'.pdns::before { content: " -- PDNS: "}' +
'.pdns > span { display: inline-block; margin-left: 5px; position: relative; }' +
'</style>'));
};
/**
* preklikneme na tab "status" a skrolujeme na konec textarey
*/
......@@ -542,7 +506,7 @@ if (document.location.href.indexOf("https://mdm.nic.cz/detail/") === 0) {
* //autoloader tridy
*/
init = function () {
style();
//style();
hotkeys();
refreshControls();
parseHash();
......
#page0 {
margin:20px;
}
#page1 {
background:#888;
margin:0;
padding:1%;
}
#container {
overflow:hidden;
}
#menu {
background-color:#eed;
float:left;
margin:0 0 -100000px;
padding:1% 1% 100000px;
width:20%;
}
#menu ul {
border:none;
list-style:none;
margin:0 auto;
padding:0;
width:100%;
}
#menu ul li {
background-color:#ccb;
margin:2px 0 0;
padding:5px;
text-align:left;
}
#menu ul li.indent {
margin-left:25px;
}
#menu ul li a {
display:block;
font-weight:700;
width:auto;
}
#menu ul li:hover {
background-color:#edb;
}
#menu > div {
background-color:#ccb;
display:block;
padding:5px;
}
#menu img {
border:0;
}
#content {
background-color:#9bc;
float:left;
margin:0 0 0 1%;
min-height:650px;
overflow:auto;
padding:1%;
width:75%;
}
#content h1 {
margin-top:0;
}
.roundedcorners {
-khtml-border-radius:5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}
.fail {
background-color:#fdd;
color:#800;
display:block;
text-align:center;
}
.info {
background-color:#dfd;
color:#800;
display:block;
text-align:center;
}
.loading {
text-decoration:blink;
}
label.upper {
display:block;
margin-top:.33em;
}
#ticket {
margin-top:5px;
padding:5px;
}
#ticket>div {
background-color:#def;
border:2px solid #888;
margin-top:5px;
padding:10px;
}
#ticket>div.odd {
background-color:#cde;
}
#ticket>div>div.caption {
float:left;
}
#ticket>div>div.reply {
margin:0 0 0 auto;
position:relative;
text-align:left;
width:80px;
}
#ticket>div>div.reply img {
left:-25px;
position:absolute;
top:-4px;
}
#ticket>div>div.clear {
clear:both;
}
#ticket span {
float:left;
width:80px;
}
#ticket hr {
color:#888;
}
#ticket div.download {
background-color:#ade;
border:2px solid #888;
float:left;
margin-right:5px;
padding:10px;
width:200px;
}
body {
font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;
font-size:0.6875em;
}
#content table.zebra {
border-collapse:collapse;
border-color:#ade;
border-style:solid;
border-width:0 2px 2px;
margin:10px 0;
width:100%;
}
#content table.zebra tbody tr:nth-child(even) {
background-color:#ade;
}
#content table.zebra th {
background-color:#ade;
font-weight:700;
}
#content table.zebra td,th {
padding:2px;
text-align:center;
}
#content table.zebra td img {
height:16px;
width:16px;
}
#content table.zebra td a:hover {
color:#a60;
}
/*
* Wrapping inside <pre> tags
* http://www.longren.org/wrapping-text-inside-pre-tags/
*/
pre {
font-size:1.25em;
white-space:pre-wrap; /* css-3 */
white-space:-moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space:-pre-wrap; /* Opera 4-6 */
white-space:-o-pre-wrap; /* Opera 7 */
word-wrap:break-word; /* Internet Explorer 5.5+ */
width:99%;
}
#lastupdated-filter .form-fields {
margin:0 0 20px;
padding:0;
}
#lastupdated-filter .form-fields > li {
float:left;
list-style-type:none;
margin:0 20px 0 0;
padding:0;
}
#lastupdated-filter .form-fields li label {
margin-right:7px;
}
#lastupdated-filter .form-fields input[type="text"] {
width:100px;
}
#lastupdated-filter .form-fields img {
display:none;
margin-left:5px;
margin-top:-2px;
vertical-align:middle;
}
.js #lastupdated-filter .form-fields img {
cursor:pointer;
display:inline;
}
#reply-filter>fieldset>label {
float:left;
width:15em;
}
#reply-filter textarea,#settings-filter textarea,#status-filter textarea {
width:100%;
}
#login-filter {
background-color:#9bc;
margin:0 auto;
padding:20px;
text-align:left;
width:500px;
}
#login-filter h1 {
text-align:center;
}
#login-filter input[type="text"] {
background-image:url('mojeid-icon.png');
background-repeat:no-repeat;
padding-left:20px;
width:10em;
}
#manual-threat label {
float:left;
margin:0 auto 0 0;
width:30em;
}
.clear-fix:after {
clear:both;
content:".";
display:block;
height:0;
visibility:hidden;
}
.hard-break-column {
white-space:pre-wrap; /* css-3 */
white-space:-moz-pre-wrap; /* Mozilla, since 1999 */
white-space:-pre-wrap; /* Opera 4-6 */
white-space:-o-pre-wrap; /* Opera 7 */
width:50%;
word-wrap:break-word; /* Internet Explorer 5.5+ */
}
#dialog-update label,#dialog-update input,#dialog-update select {
display:block;
}
img.icon {
margin-bottom:-2px;
}
.ui-widget {
font-family:Verdana,Geneva,Arial,Helvetica,sans-serif,"Corbel";
font-size:1em;
}
.stats {
float:left;
width:20em;
margin-right:1em;
}
......@@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Mdmaug</title>
<link rel="stylesheet" href="style.css?v=1">
<link rel="stylesheet" href="screen.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="analysis-style.css">
<!-- <script src="jquery.js"></script>-->
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
......
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