diff options
author | sss <sss@dark-alexandr.net> | 2023-01-17 00:38:19 +0300 |
---|---|---|
committer | sss <sss@dark-alexandr.net> | 2023-01-17 00:38:19 +0300 |
commit | cc3f33db7a8d3c4ad373e646b199808e01bc5d9b (patch) | |
tree | ec09d690c7656ab5f2cc72607e05fb359c24d8b2 /www/js/webrdp-ext.js |
added webrdp public code
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' : '' + ), '' + ); + +} |