mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-23 16:31:01 +00:00
Навел красоту в hexdump, почистил код
This commit is contained in:
parent
567946ac2a
commit
76d524ca06
@ -19,23 +19,7 @@ export default {
|
||||
props: ['servicePort', 'streamId',],
|
||||
data: function () {
|
||||
return {
|
||||
packets: [
|
||||
// {
|
||||
// id: 39,
|
||||
// timestamp: 1556555231394,
|
||||
// content: 'wuAAUEtPbKUAAAAAoAL///jUAAACBAW0BAIIChMcPpEAAAAAAQMDBw==',
|
||||
// },
|
||||
// {
|
||||
// id: 40,
|
||||
// timestamp: 1556555231392,
|
||||
// content: 'AFDC4CVNkpxLT2ymoBJxIIKHAAACBAW0BAIICoTZHMUTHD6RAQMDBw==',
|
||||
// },
|
||||
// {
|
||||
// id: 41,
|
||||
// timestamp: 1556555231396,
|
||||
// content: '0KLQtdGB0YLQvtCy0LDRjyDRgdGC0YDQvtC60LAuLi4=',
|
||||
// },
|
||||
],
|
||||
packets: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@ -42,12 +42,7 @@ export default {
|
||||
name: "Navbar",
|
||||
data: function () {
|
||||
return {
|
||||
ctfServices: [
|
||||
// {
|
||||
// port: 1337,
|
||||
// name: 'ShittyService',
|
||||
// },
|
||||
],
|
||||
ctfServices: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -9,8 +9,6 @@
|
||||
|
||||
<script>
|
||||
|
||||
// import {Hexdump,} from '@/components/hexdump.js' // Why the fuck is this working, Babel?!?!
|
||||
|
||||
export default {
|
||||
name: 'Packet',
|
||||
props: ['id', 'content', 'timestamp',],
|
||||
@ -21,16 +19,16 @@ export default {
|
||||
const hex = "0123456789ABCDEF";
|
||||
for (let b = 0; b < buffer.length; b += blockSize) {
|
||||
let block = buffer.slice(b, Math.min(b + blockSize, buffer.length));
|
||||
let addr = ("0000" + b.toString(10)).slice(-4);
|
||||
let codes = block.split('').map(function (ch) {
|
||||
let addr = ("0000000000" + b.toString(10)).slice(-10);
|
||||
let codes = block.split('').map(ch => {
|
||||
let code = ch.charCodeAt(0);
|
||||
return " " + hex[(0xF0 & code) >> 4] + hex[0x0F & code];
|
||||
}).join("");
|
||||
codes += " ".repeat(blockSize - block.length);
|
||||
codes += " ..".repeat(blockSize - block.length);
|
||||
// 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);
|
||||
lines.push(addr + " " + codes + " " + chars);
|
||||
lines.push(addr + ":" + codes + " |" + chars + "|");
|
||||
}
|
||||
return lines.join("\n");
|
||||
},
|
||||
@ -42,33 +40,6 @@ export default {
|
||||
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>
|
||||
<style scoped>
|
||||
|
||||
@ -24,12 +24,7 @@ export default {
|
||||
props: ['servicePort', 'streamId',],
|
||||
data: function () {
|
||||
return {
|
||||
streams: [
|
||||
// {
|
||||
// id: 111,
|
||||
// time: 1556411080,
|
||||
// },
|
||||
],
|
||||
streams: [],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user