mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-25 10:09:26 +00:00
Навел красоту в hexdump, почистил код
This commit is contained in:
parent
567946ac2a
commit
76d524ca06
@ -19,23 +19,7 @@ export default {
|
|||||||
props: ['servicePort', 'streamId',],
|
props: ['servicePort', 'streamId',],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
packets: [
|
packets: [],
|
||||||
// {
|
|
||||||
// id: 39,
|
|
||||||
// timestamp: 1556555231394,
|
|
||||||
// content: 'wuAAUEtPbKUAAAAAoAL///jUAAACBAW0BAIIChMcPpEAAAAAAQMDBw==',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 40,
|
|
||||||
// timestamp: 1556555231392,
|
|
||||||
// content: 'AFDC4CVNkpxLT2ymoBJxIIKHAAACBAW0BAIICoTZHMUTHD6RAQMDBw==',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// id: 41,
|
|
||||||
// timestamp: 1556555231396,
|
|
||||||
// content: '0KLQtdGB0YLQvtCy0LDRjyDRgdGC0YDQvtC60LAuLi4=',
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@ -42,12 +42,7 @@ export default {
|
|||||||
name: "Navbar",
|
name: "Navbar",
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
ctfServices: [
|
ctfServices: [],
|
||||||
// {
|
|
||||||
// port: 1337,
|
|
||||||
// name: 'ShittyService',
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// import {Hexdump,} from '@/components/hexdump.js' // Why the fuck is this working, Babel?!?!
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Packet',
|
name: 'Packet',
|
||||||
props: ['id', 'content', 'timestamp',],
|
props: ['id', 'content', 'timestamp',],
|
||||||
@ -21,16 +19,16 @@ export default {
|
|||||||
const hex = "0123456789ABCDEF";
|
const hex = "0123456789ABCDEF";
|
||||||
for (let b = 0; b < buffer.length; b += blockSize) {
|
for (let b = 0; b < buffer.length; b += blockSize) {
|
||||||
let block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
|
let block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
|
||||||
let addr = ("0000" + b.toString(10)).slice(-4);
|
let addr = ("0000000000" + b.toString(10)).slice(-10);
|
||||||
let codes = block.split('').map(function (ch) {
|
let codes = block.split('').map(ch => {
|
||||||
let code = ch.charCodeAt(0);
|
let code = ch.charCodeAt(0);
|
||||||
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code];
|
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code];
|
||||||
}).join("");
|
}).join("");
|
||||||
codes += " ".repeat(blockSize - block.length);
|
codes += " ..".repeat(blockSize - block.length);
|
||||||
// eslint-disable-next-line no-control-regex
|
// eslint-disable-next-line no-control-regex
|
||||||
let chars = block.replace(/[\x00-\x1F\x20]/g, '.');
|
let chars = block.replace(/[\x00-\x1F]/g, '.');
|
||||||
chars += " ".repeat(blockSize - block.length);
|
chars += " ".repeat(blockSize - block.length);
|
||||||
lines.push(addr + " " + codes + " " + chars);
|
lines.push(addr + ":" + codes + " |" + chars + "|");
|
||||||
}
|
}
|
||||||
return lines.join("\n");
|
return lines.join("\n");
|
||||||
},
|
},
|
||||||
@ -42,33 +40,6 @@ export default {
|
|||||||
return this.hexdump(dataString, this.$store.state.hexdumpBlockSize);
|
return this.hexdump(dataString, this.$store.state.hexdumpBlockSize);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// mounted() {
|
|
||||||
//
|
|
||||||
// this.hex = new Hexdump(dataString, { // TODO: в настройки
|
|
||||||
// container: 'hexdump-' + this.$props.id,
|
|
||||||
// base: 'hex',
|
|
||||||
// width: 16,
|
|
||||||
// ascii: false,
|
|
||||||
// byteGrouping: 1,
|
|
||||||
// html: false,
|
|
||||||
// // endian: 'little',
|
|
||||||
// lineNumber: true,
|
|
||||||
// nonPrintable: '?',
|
|
||||||
// style: {
|
|
||||||
// lineNumberLeft: '',
|
|
||||||
// lineNumberRight: ':',
|
|
||||||
// stringLeft: '|',
|
|
||||||
// stringRight: '|',
|
|
||||||
// hexLeft: '',
|
|
||||||
// hexRight: '',
|
|
||||||
// hexNull: '.g',
|
|
||||||
// stringNull: ' ',
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// beforeDestroy() {
|
|
||||||
// delete this.hex;
|
|
||||||
// },
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -24,12 +24,7 @@ export default {
|
|||||||
props: ['servicePort', 'streamId',],
|
props: ['servicePort', 'streamId',],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
streams: [
|
streams: [],
|
||||||
// {
|
|
||||||
// id: 111,
|
|
||||||
// time: 1556411080,
|
|
||||||
// },
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user