mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-25 06:49:24 +00:00
parent
d45339e543
commit
7002a4d666
@ -18,8 +18,9 @@
|
|||||||
label="Pattern"
|
label="Pattern"
|
||||||
description="Substring, RegEx or bytes"
|
description="Substring, RegEx or bytes"
|
||||||
label-for="pattern-value">
|
label-for="pattern-value">
|
||||||
<b-form-input @keydown.native.enter="addPattern" id="pattern-value" required
|
<b-form-input @keydown.native.enter="addPattern" @keydown="validateKey"
|
||||||
v-model="newPattern.value"/>
|
id="pattern-value" required v-model="newPattern.value"
|
||||||
|
:placeholder="getPlaceholder()"/>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label-cols-sm="4"
|
label-cols-sm="4"
|
||||||
@ -58,6 +59,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const hexRegex = /[0-9A-Fa-f ]/;
|
||||||
export default {
|
export default {
|
||||||
name: 'AddPattern',
|
name: 'AddPattern',
|
||||||
data() {
|
data() {
|
||||||
@ -72,6 +74,19 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getPlaceholder() {
|
||||||
|
if (this.newPattern.searchType === 'REGEX') return 'CTF{.{42}}';
|
||||||
|
else if (this.newPattern.searchType === 'SUBSTRING') return 'HTTP/2';
|
||||||
|
else return 'DEAD BEEF 1337';
|
||||||
|
},
|
||||||
|
validateKey(e) {
|
||||||
|
console.log('', e);
|
||||||
|
if (this.newPattern.searchType !== 'SUBBYTES') return;
|
||||||
|
if (!hexRegex.test(e?.key)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
checkValidity() {
|
checkValidity() {
|
||||||
return this.$refs.addPatternForm.reportValidity();
|
return this.$refs.addPatternForm.reportValidity();
|
||||||
},
|
},
|
||||||
@ -94,6 +109,10 @@
|
|||||||
}
|
}
|
||||||
console.debug('Adding pattern...', this.newPattern);
|
console.debug('Adding pattern...', this.newPattern);
|
||||||
|
|
||||||
|
if (this.newPattern.searchType === 'SUBBYTES') {
|
||||||
|
this.newPattern.value = this.newPattern.value.replace(/\s+/g, '').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
this.$http.post('pattern/', this.newPattern)
|
this.$http.post('pattern/', this.newPattern)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user