mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 00:48:31 +01:00
Merge branch 'n1073645-FiletimeEndianness'
This commit is contained in:
commit
4bae662357
1 changed files with 15 additions and 1 deletions
|
@ -35,6 +35,11 @@ class WindowsFiletimeToUNIXTimestamp extends Operation {
|
|||
"name": "Input format",
|
||||
"type": "option",
|
||||
"value": ["Decimal", "Hex"]
|
||||
},
|
||||
{
|
||||
"name": "Swap Endianness",
|
||||
"type": "boolean",
|
||||
"value": false
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@ -45,7 +50,16 @@ class WindowsFiletimeToUNIXTimestamp extends Operation {
|
|||
* @returns {string}
|
||||
*/
|
||||
run(input, args) {
|
||||
const [units, format] = args;
|
||||
const [units, format, swapEndianness] = args;
|
||||
|
||||
if (swapEndianness) {
|
||||
let result = "";
|
||||
for (let i = input.length - 2; i >= 0; i -= 2) {
|
||||
result += input.charAt(i);
|
||||
result += input.charAt(i + 1);
|
||||
}
|
||||
input = result;
|
||||
}
|
||||
|
||||
if (!input) return "";
|
||||
|
||||
|
|
Loading…
Reference in a new issue