From 9896d4b104cdcfaacd0fec35a3c0e8b8f8ed69cc Mon Sep 17 00:00:00 2001 From: av0idd4rk Date: Sat, 10 Oct 2026 03:40:43 +0300 Subject: [PATCH] Add packet IP address display and search --- package.json | 3 +- src/components/Packet.vue | 20 ++++++++ src/components/PatternsDropdown.vue | 4 ++ src/components/Sidebar.vue | 2 +- src/views/PatternModal.vue | 25 ++++++++- tests/ip-patterns.test.cjs | 79 +++++++++++++++++++++++++++++ 6 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 tests/ip-patterns.test.cjs diff --git a/package.json b/package.json index 0261e95..8758165 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", - "lint": "vue-cli-service lint" + "lint": "vue-cli-service lint", + "test:ip-patterns": "node --test tests/ip-patterns.test.cjs" }, "dependencies": { "axios": "^1.4.0", diff --git a/src/components/Packet.vue b/src/components/Packet.vue index ce5b4a0..efcbbd3 100644 --- a/src/components/Packet.vue +++ b/src/components/Packet.vue @@ -7,6 +7,11 @@ +
+ {{ packet.sourceIp || '?' }} + → + {{ packet.destinationIp || '?' }} +

@@ -25,6 +30,8 @@ id: Number(), matches: Array(), timestamp: Number(), + sourceIp: String(), + destinationIp: String(), incoming: Boolean(), ungzipped: Boolean(), webSocketParsed: Boolean(), @@ -50,6 +57,13 @@ }, }, methods: { + ipHighlightStyle(target) { + const match = (this.packet.matches || []).find(match => match.searchTarget === target && + this.$store.state.patterns.some(pattern => pattern.id === match.patternId && !pattern.deleted)); + if (!match) return {}; + const pattern = this.$store.state.patterns.find(pattern => pattern.id === match.patternId); + return {backgroundColor: pattern.color,}; + }, atou(b64) { const text = atob(b64); const length = text.length; @@ -127,6 +141,7 @@ }, {}); // Array to object let offset = 0; this.packet.matches + .filter(match => !match.searchTarget || match.searchTarget === 'CONTENT') .filter(match => !patterns[match.patternId].deleted) .sort((a, b) => a.startPosition - b.startPosition) .forEach(match => { @@ -179,6 +194,11 @@