diff options
Diffstat (limited to 'www/js/webrdp-ext.js')
-rw-r--r-- | www/js/webrdp-ext.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/www/js/webrdp-ext.js b/www/js/webrdp-ext.js new file mode 100644 index 0000000..9a96b23 --- /dev/null +++ b/www/js/webrdp-ext.js @@ -0,0 +1,19 @@ +/** BSD-2-Clause license + * + * Copyright (c) 2018-2023 NST <www.newinfosec.ru>, smake <smake at ya dot ru>. + * + */ + +ArrayBuffer.prototype.toHexdump = function () { + return new Uint8Array(this).reduce( + (p, c, i, a) => p + ( + i % 16 === 0 ? i.toString(16).padStart(6, 0) + ' ' : ' ' + ) + c.toString(16).padStart(2, 0) + ( + i === a.length - 1 || i % 16 === 15 ? + ' '.repeat((15 - i % 16) * 3) + Array.from(a).splice(i - i % 16, 16).reduce((r, v) => r + ( + v > 31 && v < 127 || v > 159 ? String.fromCharCode(v) : '.' + ), ' ') + '\n' : '' + ), '' + ); + +} |