mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Added 'Encode NetBIOS Name' and 'Decode NetBIOS Name' operations
This commit is contained in:
parent
e803d208e8
commit
ee5aea5443
3 changed files with 85 additions and 0 deletions
|
@ -131,6 +131,8 @@ var Categories = [
|
||||||
"Format MAC addresses",
|
"Format MAC addresses",
|
||||||
"Change IP format",
|
"Change IP format",
|
||||||
"Group IP addresses",
|
"Group IP addresses",
|
||||||
|
"Encode NetBIOS Name",
|
||||||
|
"Decode NetBIOS Name",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1536,6 +1536,32 @@ var OperationConfig = {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"Encode NetBIOS Name": {
|
||||||
|
description: "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.<br><br>There are two levels of encoding. The first level maps a NetBIOS name into a domain system name. The second level maps the domain system name into the 'compressed' representation required for interaction with the domain name system.<br><br>This operation carries out the first level of encoding. See RFC 1001 for full details.",
|
||||||
|
run: NetBIOS.runEncodeName,
|
||||||
|
inputType: "byteArray",
|
||||||
|
outputType: "byteArray",
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
name: "Offset",
|
||||||
|
type: "number",
|
||||||
|
value: NetBIOS.OFFSET
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Decode NetBIOS Name": {
|
||||||
|
description: "NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long. Within the NetBIOS-over-TCP protocols, a longer representation is used.<br><br>There are two levels of encoding. The first level maps a NetBIOS name into a domain system name. The second level maps the domain system name into the 'compressed' representation required for interaction with the domain name system.<br><br>This operation decodes the first level of encoding. See RFC 1001 for full details.",
|
||||||
|
run: NetBIOS.runDecodeName,
|
||||||
|
inputType: "byteArray",
|
||||||
|
outputType: "byteArray",
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
name: "Offset",
|
||||||
|
type: "number",
|
||||||
|
value: NetBIOS.OFFSET
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"Offset checker": {
|
"Offset checker": {
|
||||||
description: "Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",
|
description: "Compares multiple inputs (separated by the specified delimiter) and highlights matching characters which appear at the same position in all samples.",
|
||||||
run: StrUtils.runOffsetChecker,
|
run: StrUtils.runOffsetChecker,
|
||||||
|
|
57
src/js/operations/NetBIOS.js
Normal file
57
src/js/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 = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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