Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 4e28dba7 authored by Jérôme Gorin's avatar Jérôme Gorin
Browse files

Add idx tracking on line details

parent 6c87b856
Branches
Tags
No related merge requests found
Showing
with 41 additions and 35 deletions
......@@ -16,8 +16,8 @@ export class BeaconLine extends Details{
public log : Log | null = null;
public occurrances : number;
constructor(beacon:any){
super('beacon');
constructor(beacon:any, idx:number){
super('beacon', idx);
this.filter =beacon.filter;
this.listName = beacon.listName;
this.query = beacon.query;
......
......@@ -27,8 +27,8 @@ export class CookieLine extends Details{
public firstPartyStorage:boolean;
public log: CookieLog | null = null;
constructor(cookie:any){
super('cookie');
constructor(cookie:any, idx:number){
super('cookie', idx);
this.name =cookie.name;
this.value = cookie.value;
this.domain = cookie.domain;
......
......@@ -14,8 +14,8 @@ export class LocalStorageLine extends Details{
public firstPartyStorage : string[];
public log:Log | null = null;
constructor(host:string, key:string, value:any){
super('localstorage');
constructor(host:string, key:string, value:any, idx:number){
super('localstorage', idx);
this.host = host;
this.key = key;
this.value = value.value;
......
......@@ -11,8 +11,8 @@ export class ProtocolLine extends Details{
finding:string;
severity:string;
constructor(id:string, finding:string, severity:string){
super('protocol');
constructor(id:string, finding:string, severity:string, idx:number){
super('protocol', idx);
this.id = id;
this.finding = finding;
this.severity = severity;
......@@ -25,8 +25,8 @@ export class VulnerabilityLine extends Details{
severity:string="";
cve:string=""
constructor(id:string, finding:string, severity:string, cve:string){
super('vulnerability');
constructor(id:string, finding:string, severity:string, cve:string, idx : number){
super('vulnerability', idx);
this.id = id;
this.finding = finding;
this.severity = severity;
......@@ -45,13 +45,13 @@ export class TestSSLCard extends Card{
super("TestSSL Scan", "testSSL");
if (testssl_result && testssl_result.scanResult && testssl_result.scanResult[0]){
for (let protocol of testssl_result.scanResult[0].protocols){
this.protocols.push(new ProtocolLine(protocol.id, protocol.finding, protocol.severity));
}
testssl_result.scanResult[0].protocols.forEach((protocol:any, idx:number) => {
this.protocols.push(new ProtocolLine(protocol.id, protocol.finding, protocol.severity, idx));
});
for (let vulnerability of testssl_result.scanResult[0].vulnerabilities){
this.vulnerabilities.push(new VulnerabilityLine(vulnerability.id, vulnerability.finding, vulnerability.severity, vulnerability.cve));
}
testssl_result.scanResult[0].vulnerabilities.forEach((vulnerability:any, idx:number) => {
this.vulnerabilities.push(new VulnerabilityLine(vulnerability.id, vulnerability.finding, vulnerability.severity, vulnerability.cve, idx));
});
}
this.testSSLError = testSSLError;
this.testSSLErrorOutput = testSSLErrorOutput;
......
......@@ -11,8 +11,8 @@ export class UnsafeForm extends Details{
action:string="";
method:string="";
constructor(id:string, action:string, method:string){
super('unsafeForm');
constructor(id:string, action:string, method:string, idx:number){
super('unsafeForm', idx);
this.id = id;
this.action = action;
this.method = method;
......@@ -26,8 +26,8 @@ export class UnsafeFormsCard extends Card {
constructor(unsafeForms: any[]) {
super("Web Forms with non-encrypted Transmission", "forms");
if (!unsafeForms) return;
for (let line of unsafeForms){
this.unsafeForms.push(new UnsafeForm(line.id, line.action, line.method))
}
unsafeForms.forEach((line:any, idx:number) => {
this.unsafeForms.push(new UnsafeForm(line.id, line.action, line.method, idx))
});
}
}
......@@ -16,9 +16,11 @@ export type kindDetail = ''|
export class Details {
public kind: kindDetail;
public status:Status;
public idx:number;
constructor(kind: kindDetail) {
constructor(kind: kindDetail, idx:number) {
this.kind = kind;
this.status = 'pending';
this.idx = idx;
}
}
......@@ -45,19 +45,21 @@ export class InspectionService {
const cookieCard = new CookieCard("Cookies");
if (!value) return cookieCard;
for (const cookie of value) {
const cookieLine = new CookieLine(cookie);
value.forEach((cookie:any, idx:number) => {
const cookieLine = new CookieLine(cookie, idx);
cookieCard.push(cookieLine)
}
});
return cookieCard;
}
inspectLocalStorage(value: any):LocalStorageCard{
const localStorageCard = new LocalStorageCard("Local Storage");
if (!value) return localStorageCard;
let idx = 0;
for (const host in value) {
for (const key in value[host]) {
const localStorageLine = new LocalStorageLine(host, key, value[host][key]);
const localStorageLine = new LocalStorageLine(host, key, value[host][key], idx++);
localStorageCard.push(localStorageLine)
}
}
......@@ -76,10 +78,12 @@ export class InspectionService {
inspectBeacons(value:any) : BeaconCard{
const beaconCard = new BeaconCard();
if (!value) return beaconCard;
for (const beacon of value) {
const beaconLine = new BeaconLine(beacon);
value.forEach((beacon:any, idx:number) => {
const beaconLine = new BeaconLine(beacon, idx);
beaconCard.push(beaconLine)
}
});
return beaconCard;
}
......
......@@ -17,7 +17,7 @@
</tr>
</thead>
<tbody #tableContent>
@for(line of (this.card.beaconLines | filterForBeacon:searchBeacon | filterForStatus:searchStatus); track line){
@for(line of (this.card.beaconLines | filterForBeacon:searchBeacon | filterForStatus:searchStatus); track line.idx){
<tr>
<td class="truncate" (click)="selected(line)">{{line.url}}</td>
<td class="truncate" (click)="selected(line)">{{line.occurrances}}</td>
......
......@@ -25,7 +25,7 @@
| filterForCookie:searchCookie
| filterForStatus:searchStatus
| filterForCookieKnowledgeBase:searchKnowledge
| async); track line) {
| async); track line.idx) {
<tr>
<td class="truncate" (click)="selected(line)">{{line.domain}}</td>
<td class="truncate" (click)="selected(line)">{{line.name}}</td>
......
......@@ -19,7 +19,7 @@
</tr>
</thead>
<tbody #tableContent>
@for (line of (this.card.localStorageLines | filterForLocalStorage:searchLocalStorage | filterForStatus:searchStatus); track line) {
@for (line of (this.card.localStorageLines | filterForLocalStorage:searchLocalStorage | filterForStatus:searchStatus); track line.idx) {
<tr>
<td class="truncate" (click)="selected(line)">{{line.host}}</td>
......
......@@ -33,7 +33,7 @@
</tr>
</thead>
<tbody #tableContent>
@for(line of card.protocols; track line.id; let idx = $index){
@for(line of card.protocols; track line.idx; let idx = $index){
<tr>
<td class="truncate">{{line.id}}</td>
<td class="truncate">{{line.finding}}</td>
......@@ -92,7 +92,7 @@
</tr>
</thead>
<tbody #tableContent>
@for(line of card.vulnerabilities; track line.id;let idx = $index){
@for(line of card.vulnerabilities; track line.idx;let idx = $index){
<tr>
<td class="truncate">{{line.id}}</td>
<td class="truncate">{{line.finding}}</td>
......
......@@ -20,7 +20,7 @@
</tr>
</thead>
<tbody #tableContent>
@for(line of this.card.unsafeForms; track line.id; let idx = $index){
@for(line of this.card.unsafeForms; track line.idx; let idx = $index){
<tr>
<td class="truncate">{{line.method}}</td>
<td class="truncate">{{line.action}}</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment