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 @@