Skip to content

Commit

Permalink
🤔 Imports , Header , add bordered to tables
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinrais committed Oct 21, 2021
1 parent ef3ed1f commit beb9c6f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/common/components/elements/CardTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ export default {
}
.tab-th {
&.active {
@apply border-r-2 border-primary w-full;
}
}
.tab-headers,
.tab-contents {
@apply pl-1 pr-4;
@apply pl-1 pr-0;
}
}
Expand Down
81 changes: 67 additions & 14 deletions src/modules/scan/pages/static-analysis/PE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,31 @@
:lines="get_IAT"
/>
</card-tab>
<card-tab :active="'Header' == currentTab">
<code>{{ get_Header }}</code>
</card-tab>
<card-tab :active="'NtHeader' == currentTab">
<table-cols
title="File Header"
:htmlFields="['format']"
:customFields="false"
:bordered="true"
:lines="get_NtHeader.fileHeader"
/>
<div class="divider"></div>
<table-cols
title="Optional Header"
:htmlFields="['format']"
:customFields="false"
:bordered="true"
:lines="get_NtHeader.optionalHeader"
/>
<div class="divider"></div>
<table-cols
title="Data Directory"
:htmlFields="['format']"
:customFields="false"
:bordered="true"
:columns="[
{ key: 'key', title: 'Virtual Address' },
{ key: 'value', title: 'Size' },
Expand All @@ -58,15 +64,42 @@
/>
</card-tab>
<card-tab :active="'Imports' == currentTab">
<template v-for="(importItem, index) in get_Imports" :key="index">
<table-cols
title="Descriptor"
:columns="get_Descriptor_columns(importItem.Descriptor)"
:lines="get_Descriptor_line(importItem.Descriptor)"
/>
<table-cols title="Functions" :lines="importItem.Functions" />
<div class="divider"></div>
</template>
<card-tabs
:tabs="get_Imports_tabs"
:mode="'vertical'"
:active="currentImport"
v-on:switchTab="switchImport($event)"
>
<card-tab
v-for="(importItem, index) in get_Imports"
:key="index"
:active="importItem.Name == currentImport"
>
<table-cols
:striped="true"
:bordered="true"
:lines="[
{ key: 'Name', value: importItem.Name },
{ key: 'Offset', value: importItem.Offset },
]"
></table-cols>
<div class="divider"></div>
<table-cols
title="Descriptor"
:bordered="true"
:columns="get_Columns(importItem.Descriptor)"
:lines="get_Descriptor_line(importItem.Descriptor)"
/>
<div class="divider"></div>
<table-cols
title="Functions"
:bordered="true"
:columns="get_Columns(importItem.Functions[0])"
:lines="importItem.Functions"
/>
<div class="divider"></div>
</card-tab>
</card-tabs>
</card-tab>
</card-tabs>
</div>
Expand Down Expand Up @@ -96,14 +129,18 @@ export default {
hexa: true,
file: null,
currentTab: null,
currentImport: null,
treeList: [],
};
},
methods: {
switchTab(tab) {
this.currentTab = tab;
},
get_Descriptor_columns(obj) {
switchImport(tab) {
this.currentImport = tab;
},
get_Columns(obj) {
return Object.keys(obj).map((key) => ({
key: key,
title: translateKey(key),
Expand Down Expand Up @@ -211,19 +248,28 @@ export default {
let items = this.getFilePE[this.currentTab] || [];
return items.map((item) => {
console.log(item);
return item;
});
},
get_Imports_tabs() {
return this.get_Imports.map((item) => ({
name: item.Name,
title: item.Offset,
}));
},
get_Header() {
return this.getFilePE[this.currentTab];
},
},
async beforeMount() {
this.file = await this.getFileSummary;
this.treeList = this.getFirstTree.filter(
(key) => !["Is32", "Is64"].includes(key.name)
);
this.currentTab = this.treeList[3].name;
this.currentTab = this.treeList[0].name;
this.currentImport = this.get_Imports[0].Name;
},
};
</script>
Expand Down Expand Up @@ -273,7 +319,14 @@ export default {
}
.divider {
@apply pb-2 border-b border-gray-light border-opacity-40;
@apply my-4 border-b border-gray-light border-opacity-80;
}
.tab-contents {
@apply break-words;
}
code {
@apply break-all;
}
}
</style>

0 comments on commit beb9c6f

Please sign in to comment.