fix lint error

This commit is contained in:
Soufiane Fariss
2024-08-02 01:48:51 +02:00
parent 07b4e1f8a2
commit b0ffc86399
7 changed files with 26 additions and 33 deletions

View File

@@ -3,12 +3,11 @@ require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-prettier/skip-formatting'],
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
'vue/multi-word-component-names': 'off'
}
}

View File

@@ -68,11 +68,6 @@ const filterMode = ref('lenient')
const sourceDialogVisible = ref(false)
const currentSource = ref('')
const showSource = (source) => {
currentSource.value = source
sourceDialogVisible.value = true
}
import { parseFunctionCapabilities } from '../utils/rdocParser'
const tableData = computed(() => parseFunctionCapabilities(props.data, props.showLibraryRules))

View File

@@ -28,7 +28,7 @@ const createSunburstData = (rules) => {
let currentId = ''
let parent = ''
parts.forEach((part, index) => {
parts.forEach((part) => {
currentId = currentId ? `${currentId}/${part}` : part
if (!data.ids.includes(currentId)) {

View File

@@ -47,21 +47,17 @@
:class="{ 'w-3': col.field === 'mbc', 'w-full': col.field === 'name' }"
filterMatchMode="contains"
>
<!-- Filter template -->
<template #filter>
<InputText v-model="filters[col.field]" type="text" :placeholder="`Filter by ${col.header}`" />
</template>
<!-- Address column body template -->
<template v-if="col.field === 'address'" #body="slotProps">
<span class="text-sm" style="font-family: monospace">
{{ slotProps.node.data.address }}
<template #body="slotProps">
<!-- Address column -->
<span v-if="col.field === 'address'" class="text-sm" style="font-family: monospace">
{{ slotProps.node.data.type === 'match location' ? '' : slotProps.node.data.address }}
</span>
</template>
<!-- Tactic column body template -->
<template v-if="col.field === 'tactic'" #body="slotProps">
<div v-if="slotProps.node.data.attack">
<!-- Tactic column -->
<div v-else-if="col.field === 'tactic' && slotProps.node.data.attack">
<div v-for="(attack, index) in slotProps.node.data.attack" :key="index">
<a :href="createATTACKHref(attack)" target="_blank">
{{ attack.technique }} <span class="text-500 text-sm font-normal ml-1">({{ attack.id }})</span>
@@ -78,11 +74,9 @@
</div>
</div>
</div>
</template>
<!-- MBC column body template -->
<template v-if="col.field === 'mbc'" #body="slotProps">
<div v-if="slotProps.node.data.mbc">
<!-- MBC column -->
<div v-else-if="col.field === 'mbc' && slotProps.node.data.mbc">
<div v-for="(mbc, index) in slotProps.node.data.mbc" :key="index">
<a :href="createMBCHref(mbc)" target="_blank">
{{ mbc.parts.join('::') }}
@@ -90,16 +84,15 @@
</a>
</div>
</div>
</template>
<!-- Namespace column body template -->
<template v-if="col.field === 'namespace'" #body="slotProps">
<span v-if="!slotProps.node.data.lib">
<!-- Namespace column -->
<span v-else-if="col.field === 'namespace' && !slotProps.node.data.lib">
{{ slotProps.node.data.namespace }}
</span>
</template>
</Column>
</TreeTable>
<ContextMenu ref="menu" :model="contextMenuItems">
<template #item="{ item, props }">
<a v-ripple v-bind="props.action" :href="item.url" :target="item.target">

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { parseRules, parseFunctionCapabilities, parseProcessCapabilities } from '../utils/rdocParser'
import { parseRules, parseFunctionCapabilities } from '../utils/rdocParser'
describe('parseRules', () => {
it('should return an empty array for empty rules', () => {

View File

@@ -7,7 +7,7 @@
* @returns {Array} - Parsed tree data for the TreeTable component
*/
export function parseRules(rules, flavor, layout, maxMatches = 1) {
return Object.entries(rules).map(([ruleName, rule], index) => {
return Object.entries(rules).map(([, rule], index) => {
const ruleNode = {
key: `${index}`,
data: {
@@ -253,18 +253,22 @@ function parseNode(node, key, rules, lib, layout) {
return result
}
// TODO(s-ff): decide if we want to show call info or not
// e.g. explorer.exe{id:0,tid:10,pid:100,ppid:1000}
function getCallInfo(node, layout) {
if (!node.locations || node.locations.length === 0) return null
const location = node.locations[0]
if (location.type !== 'call') return null
// eslint-disable-next-line no-unused-vars
const [ppid, pid, tid, callId] = location.value
// eslint-disable-next-line no-unused-vars
const callName = node.node.feature.api
const pname = getProcessName(layout, location)
const cname = getCallName(layout, location)
// eslint-disable-next-line no-unused-vars
const [fname, separator, restWithArgs] = partition(cname, '(')
const [args, , returnValueWithParen] = rpartition(restWithArgs, ')')
@@ -441,9 +445,10 @@ function formatAddress(address) {
return `file+${formatHex(address.value)}`
case 'dn_token':
return `token(${formatHex(address.value)})`
case 'dn_token_offset':
case 'dn_token_offset': {
const [token, offset] = address.value
return `token(${formatHex(token)})+${formatHex(offset)}`
}
case 'process':
//const [ppid, pid] = address.value;
//return `process{pid:${pid}}`;

View File

@@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteSingleFile } from 'vite-plugin-singlefile'
// eslint-disable-next-line no-unused-vars
export default defineConfig(({ command, mode }) => {
const isBundle = mode === 'bundle'