mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Restructured src files into a more logical hierarchy
This commit is contained in:
parent
c9910a8ddb
commit
0f2a5014be
125 changed files with 421 additions and 793 deletions
57
src/core/operations/NetBIOS.js
Normal file
57
src/core/operations/NetBIOS.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* NetBIOS operations.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
var NetBIOS = module.exports = {
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
OFFSET: 65,
|
||||
|
||||
/**
|
||||
* Encode NetBIOS Name operation.
|
||||
*
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
runEncodeName: function(input, args) {
|
||||
var output = [],
|
||||
offset = args[0];
|
||||
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
output.push((input[i] >> 4) + offset);
|
||||
output.push((input[i] & 0xf) + offset);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Decode NetBIOS Name operation.
|
||||
*
|
||||
* @param {byteArray} input
|
||||
* @param {Object[]} args
|
||||
* @returns {byteArray}
|
||||
*/
|
||||
runDecodeName: function(input, args) {
|
||||
var output = [],
|
||||
offset = args[0];
|
||||
|
||||
for (var i = 0; i < input.length; i += 2) {
|
||||
output.push(((input[i] - offset) << 4) |
|
||||
((input[i + 1] - offset) & 0xf));
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue