mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 17:08:31 +01:00
Removed dependency for Utils.js from NetBIOS.js
This commit is contained in:
parent
df122da1d2
commit
e61ced93d6
1 changed files with 4 additions and 7 deletions
|
@ -1,5 +1,3 @@
|
||||||
import Utils from "../Utils.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetBIOS operations.
|
* NetBIOS operations.
|
||||||
*
|
*
|
||||||
|
@ -29,14 +27,13 @@ const NetBIOS = {
|
||||||
offset = args[0];
|
offset = args[0];
|
||||||
|
|
||||||
if (input.length <= 16) {
|
if (input.length <= 16) {
|
||||||
|
let len = input.length;
|
||||||
|
input.length = 16;
|
||||||
|
input.fill(32, len, 16);
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
output.push((input[i] >> 4) + offset);
|
output.push((input[i] >> 4) + offset);
|
||||||
output.push((input[i] & 0xf) + offset);
|
output.push((input[i] & 0xf) + offset);
|
||||||
}
|
}
|
||||||
for (let i = input.length; i < 16; i++) {
|
|
||||||
output.push(67);
|
|
||||||
output.push(65);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
@ -59,7 +56,7 @@ const NetBIOS = {
|
||||||
output.push((((input[i] & 0xff) - offset) << 4) |
|
output.push((((input[i] & 0xff) - offset) << 4) |
|
||||||
(((input[i + 1] & 0xff) - offset) & 0xf));
|
(((input[i + 1] & 0xff) - offset) & 0xf));
|
||||||
}
|
}
|
||||||
output = Utils.strToByteArray(Utils.byteArrayToChars(output).trim());
|
output = output.filter(x => x !== 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
Loading…
Reference in a new issue