Enchancing report.vue
This commit is contained in:
		@@ -128,8 +128,8 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .report-wrapper {
 | 
					    .report-wrapper {
 | 
				
			||||||
        width:90%;
 | 
					 | 
				
			||||||
        margin:auto;
 | 
					        margin:auto;
 | 
				
			||||||
 | 
					        padding-bottom:1px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .device-ctx {
 | 
					    .device-ctx {
 | 
				
			||||||
@@ -212,10 +212,11 @@
 | 
				
			|||||||
    .report-wrapper {
 | 
					    .report-wrapper {
 | 
				
			||||||
        width:60%;
 | 
					        width:60%;
 | 
				
			||||||
        margin:auto;
 | 
					        margin:auto;
 | 
				
			||||||
 | 
					        padding-bottom: 1px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .device-ctx {
 | 
					    .device-ctx {
 | 
				
			||||||
        padding:15px;
 | 
					        padding:15px 0px 15px 0px;
 | 
				
			||||||
        margin:auto;
 | 
					        margin:auto;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -303,6 +304,17 @@ footer {
 | 
				
			|||||||
    padding-left:40px;
 | 
					    padding-left:40px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					.device-ctx-legend {
 | 
				
			||||||
 | 
					    font-size: 14px;
 | 
				
			||||||
 | 
					    color: #a6a6a6;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					    padding-top: 10px;
 | 
				
			||||||
 | 
					    background-color: #fbfbfb;
 | 
				
			||||||
 | 
					    padding: 10px;
 | 
				
			||||||
 | 
					    border-radius: 5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.group-title {
 | 
					.group-title {
 | 
				
			||||||
    text-transform: uppercase;
 | 
					    text-transform: uppercase;
 | 
				
			||||||
    color : #999;
 | 
					    color : #999;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
        "low_msg": "Només teniu {nb} alertes baixes, <br /> Si us plau comproveu-les.",
 | 
					        "low_msg": "Només teniu {nb} alertes baixes, <br /> Si us plau comproveu-les.",
 | 
				
			||||||
        "save_report": "Desa l'informe",
 | 
					        "save_report": "Desa l'informe",
 | 
				
			||||||
        "report_of": "Informe de",
 | 
					        "report_of": "Informe de",
 | 
				
			||||||
        "ip_address": "Adreça IP",
 | 
					        "ip_address": "Adreça IP:",
 | 
				
			||||||
        "mac_address": "Adreça MAC",
 | 
					        "mac_address": "Adreça MAC:",
 | 
				
			||||||
 | 
					        "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					        "capture_started": "La captura va començar a:",
 | 
				
			||||||
 | 
					        "capture_ended": "La captura va acabar el:",
 | 
				
			||||||
        "high": "alt",
 | 
					        "high": "alt",
 | 
				
			||||||
        "moderat": "moderat",
 | 
					        "moderat": "moderat",
 | 
				
			||||||
        "low": "baix"
 | 
					        "low": "baix"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
    "low_msg": "Sie haben nur {nb} Warnungen der Stufe \"Niedrig\":<br> Überprüfen Sie sie gerne.",
 | 
					    "low_msg": "Sie haben nur {nb} Warnungen der Stufe \"Niedrig\":<br> Überprüfen Sie sie gerne.",
 | 
				
			||||||
    "save_report": "Bericht speichern",
 | 
					    "save_report": "Bericht speichern",
 | 
				
			||||||
    "report_of": "Bericht zu",
 | 
					    "report_of": "Bericht zu",
 | 
				
			||||||
    "ip_address": "IP-Adresse",
 | 
					    "ip_address": "IP-Adresse:",
 | 
				
			||||||
    "mac_address": "MAC-Adresse",
 | 
					    "mac_address": "MAC-Adresse:",
 | 
				
			||||||
 | 
					    "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					    "capture_started": "Capture begann mit:",
 | 
				
			||||||
 | 
					    "capture_ended": "Capture endete an:",
 | 
				
			||||||
    "high": "Hoch",
 | 
					    "high": "Hoch",
 | 
				
			||||||
    "moderate": "Mittel",
 | 
					    "moderate": "Mittel",
 | 
				
			||||||
    "low": "Niedrig"
 | 
					    "low": "Niedrig"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
    "low_msg": "You have only {nb} low alerts,<br /> don't hesitate to check them.",
 | 
					    "low_msg": "You have only {nb} low alerts,<br /> don't hesitate to check them.",
 | 
				
			||||||
    "save_report": "Save the report",
 | 
					    "save_report": "Save the report",
 | 
				
			||||||
    "report_of": "Report of",
 | 
					    "report_of": "Report of",
 | 
				
			||||||
    "ip_address": "IP address",
 | 
					    "ip_address": "IP address:",
 | 
				
			||||||
    "mac_address": "MAC address",
 | 
					    "mac_address": "MAC address:",
 | 
				
			||||||
 | 
					    "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					    "capture_started": "Capture started on:",
 | 
				
			||||||
 | 
					    "capture_ended": "Capture ended on:",
 | 
				
			||||||
    "high": "high",
 | 
					    "high": "high",
 | 
				
			||||||
    "moderate": "moderate",
 | 
					    "moderate": "moderate",
 | 
				
			||||||
    "low": "low"
 | 
					    "low": "low"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
        "low_msg": "Solo tiene {nb} alertas bajas, <br /> por favor revíselas",
 | 
					        "low_msg": "Solo tiene {nb} alertas bajas, <br /> por favor revíselas",
 | 
				
			||||||
        "save_report": "Guardar el informe",
 | 
					        "save_report": "Guardar el informe",
 | 
				
			||||||
        "report_of": "Informe de",
 | 
					        "report_of": "Informe de",
 | 
				
			||||||
        "ip_address": "dirección IP",
 | 
					        "ip_address": "Dirección IP:",
 | 
				
			||||||
        "mac_address": "dirección MAC",
 | 
					        "mac_address": "Dirección MAC:",
 | 
				
			||||||
 | 
					        "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					        "capture_started": "Captura comenzó a:",
 | 
				
			||||||
 | 
					        "capture_ended": "Captura terminó a:",
 | 
				
			||||||
        "high": "alta",
 | 
					        "high": "alta",
 | 
				
			||||||
        "moderate": "moderada",
 | 
					        "moderate": "moderada",
 | 
				
			||||||
        "low": "bajo"
 | 
					        "low": "bajo"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,9 @@
 | 
				
			|||||||
    "report_of": "Rapport de",
 | 
					    "report_of": "Rapport de",
 | 
				
			||||||
    "ip_address": "Adresse IP :",
 | 
					    "ip_address": "Adresse IP :",
 | 
				
			||||||
    "mac_address": "Adresse MAC :",
 | 
					    "mac_address": "Adresse MAC :",
 | 
				
			||||||
 | 
					    "pcap_sha1": "SHA1 :",
 | 
				
			||||||
 | 
					    "capture_started": "Capture débutée le :",
 | 
				
			||||||
 | 
					    "capture_ended": "Capture finie le :",
 | 
				
			||||||
    "high": "elevee",
 | 
					    "high": "elevee",
 | 
				
			||||||
    "moderate": "moyenne",
 | 
					    "moderate": "moyenne",
 | 
				
			||||||
    "low": "basse"
 | 
					    "low": "basse"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
    "low_msg": "Sono presenti solo {nb} avvisi con priorità bassa<br /> da controllare.",
 | 
					    "low_msg": "Sono presenti solo {nb} avvisi con priorità bassa<br /> da controllare.",
 | 
				
			||||||
    "save_report": "Salva il rapporto",
 | 
					    "save_report": "Salva il rapporto",
 | 
				
			||||||
    "report_of": "Rapporto di",
 | 
					    "report_of": "Rapporto di",
 | 
				
			||||||
    "ip_address": "Indirizzo IP",
 | 
					    "ip_address": "Indirizzo IP:",
 | 
				
			||||||
    "mac_address": "Indirizzo MAC",
 | 
					    "mac_address": "Indirizzo MAC:",
 | 
				
			||||||
 | 
					    "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					    "capture_started": "Cattura è iniziata su:",
 | 
				
			||||||
 | 
					    "capture_ended": "Cattura terminata su:",
 | 
				
			||||||
    "high": "elevata",
 | 
					    "high": "elevata",
 | 
				
			||||||
    "moderate": "moderata",
 | 
					    "moderate": "moderata",
 | 
				
			||||||
    "low": "bassa"
 | 
					    "low": "bassa"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
    "low_msg": "Você tem apenas {nb} alertas leves,<br /> não deixe de verificá-los.",
 | 
					    "low_msg": "Você tem apenas {nb} alertas leves,<br /> não deixe de verificá-los.",
 | 
				
			||||||
    "save_report": "Salvar o relatório",
 | 
					    "save_report": "Salvar o relatório",
 | 
				
			||||||
    "report_of": "Relatório de",
 | 
					    "report_of": "Relatório de",
 | 
				
			||||||
    "ip_address": "Endereço IP",
 | 
					    "ip_address": "Endereço IP:",
 | 
				
			||||||
    "mac_address": "Endereço MAC",
 | 
					    "mac_address": "Endereço MAC:",
 | 
				
			||||||
 | 
					    "pcap_sha1": "SHA1:",
 | 
				
			||||||
 | 
					    "capture_started": "Captura iniciada em:",
 | 
				
			||||||
 | 
					    "capture_ended": "Captura terminou em:",
 | 
				
			||||||
    "high": "crítico",
 | 
					    "high": "crítico",
 | 
				
			||||||
    "moderate": "moderado",
 | 
					    "moderate": "moderado",
 | 
				
			||||||
    "low": "leve"
 | 
					    "low": "leve"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,8 +50,11 @@
 | 
				
			|||||||
    "low_msg": "У вас {nb} предупреждение низкого уровня<br />, проверьте их.",
 | 
					    "low_msg": "У вас {nb} предупреждение низкого уровня<br />, проверьте их.",
 | 
				
			||||||
    "save_report": "Сохранить отчет",
 | 
					    "save_report": "Сохранить отчет",
 | 
				
			||||||
    "report_of": "Отчет",
 | 
					    "report_of": "Отчет",
 | 
				
			||||||
    "ip_address": "IP-адрес",
 | 
					    "ip_address": "IP-адрес:",
 | 
				
			||||||
    "mac_address": "MAC-адрес",
 | 
					    "mac_address": "MAC-адрес:",
 | 
				
			||||||
 | 
					    "pcap_sha1": " SHA1:",
 | 
				
			||||||
 | 
					    "capture_started": "Захват начался:",
 | 
				
			||||||
 | 
					    "capture_ended": "захват закончился:",
 | 
				
			||||||
    "high": "высокий",
 | 
					    "high": "высокий",
 | 
				
			||||||
    "moderate": "средний",
 | 
					    "moderate": "средний",
 | 
				
			||||||
    "low": "низкий"
 | 
					    "low": "низкий"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,7 @@ export default {
 | 
				
			|||||||
                        router.replace({ name: 'report', 
 | 
					                        router.replace({ name: 'report', 
 | 
				
			||||||
                                         params: { alerts : response.data.alerts, 
 | 
					                                         params: { alerts : response.data.alerts, 
 | 
				
			||||||
                                                   device : response.data.device, 
 | 
					                                                   device : response.data.device, 
 | 
				
			||||||
 | 
					                                                   pcap : response.data.pcap,  
 | 
				
			||||||
                                                   capture_token : this.capture_token } });
 | 
					                                                   capture_token : this.capture_token } });
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,8 +46,14 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div v-else-if="show_report" class="report-wrapper">
 | 
					        <div v-else-if="show_report" class="report-wrapper">
 | 
				
			||||||
            <div class="device-ctx">
 | 
					            <div class="device-ctx">
 | 
				
			||||||
                <h3 style="margin: 0;">{{ $t("report.report_of") }} {{device.name}}</h3>
 | 
					                <h3 style="margin: 0; padding-left:10px;">{{ $t("report.report_of") }} {{device.name}}</h3>
 | 
				
			||||||
                {{ $t("report.ip_address") }} {{device.ip_address}}<br />{{ $t("report.mac_address") }} {{device.mac_address}}
 | 
					                <div class="device-ctx-legend">
 | 
				
			||||||
 | 
					                    {{ $t("report.pcap_sha1") }} {{ pcap.SHA1 }}<br />
 | 
				
			||||||
 | 
					                    {{ $t("report.capture_started") }} {{ pcap["First packet time"].split(",")[0] }}<br />
 | 
				
			||||||
 | 
					                    {{ $t("report.capture_ended") }} {{ pcap["Last packet time"].split(",")[0] }}<br />
 | 
				
			||||||
 | 
					                    <!-- {{ $t("report.ip_address") }} {{device.ip_address}}<br /> -->
 | 
				
			||||||
 | 
					                    {{ $t("report.mac_address") }} {{device.mac_address}}
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
            <ul class="alerts">
 | 
					            <ul class="alerts">
 | 
				
			||||||
                <li class="alert" v-for="alert in alerts.high" :key="alert.message">
 | 
					                <li class="alert" v-for="alert in alerts.high" :key="alert.message">
 | 
				
			||||||
@@ -105,6 +111,7 @@ export default {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    props: {
 | 
					    props: {
 | 
				
			||||||
        device: Object,
 | 
					        device: Object,
 | 
				
			||||||
 | 
					        pcap: Object,
 | 
				
			||||||
        alerts: Array,
 | 
					        alerts: Array,
 | 
				
			||||||
        capture_token: String
 | 
					        capture_token: String
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,13 +41,18 @@ class Analysis(object):
 | 
				
			|||||||
            :return: dict containing the report or error message.
 | 
					            :return: dict containing the report or error message.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        device, alerts = {}, {}
 | 
					        device, alerts, pcap = {}, {}, {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Getting device configuration.
 | 
					        # Getting device configuration.
 | 
				
			||||||
        if os.path.isfile("/tmp/{}/assets/device.json".format(self.token)):
 | 
					        if os.path.isfile("/tmp/{}/assets/device.json".format(self.token)):
 | 
				
			||||||
            with open("/tmp/{}/assets/device.json".format(self.token), "r") as f:
 | 
					            with open("/tmp/{}/assets/device.json".format(self.token), "r") as f:
 | 
				
			||||||
                device = json.load(f)
 | 
					                device = json.load(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Getting pcap infos.
 | 
				
			||||||
 | 
					        if os.path.isfile("/tmp/{}/assets/capinfos.json".format(self.token)):
 | 
				
			||||||
 | 
					            with open("/tmp/{}/assets/capinfos.json".format(self.token), "r") as f:
 | 
				
			||||||
 | 
					                pcap = json.load(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Getting alerts configuration.
 | 
					        # Getting alerts configuration.
 | 
				
			||||||
        if os.path.isfile("/tmp/{}/assets/alerts.json".format(self.token)):
 | 
					        if os.path.isfile("/tmp/{}/assets/alerts.json".format(self.token)):
 | 
				
			||||||
            with open("/tmp/{}/assets/alerts.json".format(self.token), "r") as f:
 | 
					            with open("/tmp/{}/assets/alerts.json".format(self.token), "r") as f:
 | 
				
			||||||
@@ -55,6 +60,7 @@ class Analysis(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if device != {} and alerts != {}:
 | 
					        if device != {} and alerts != {}:
 | 
				
			||||||
            return {"alerts": alerts,
 | 
					            return {"alerts": alerts,
 | 
				
			||||||
                    "device": device}
 | 
					                    "device": device,
 | 
				
			||||||
 | 
					                    "pcap": pcap}
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return {"message": "No report yet"}
 | 
					            return {"message": "No report yet"}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user