mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Merge branch 'filetimemod' of https://github.com/bwhitn/CyberChef into bwhitn-filetimemod
This commit is contained in:
commit
e7cea889ab
2 changed files with 31 additions and 2 deletions
|
@ -90,7 +90,13 @@ const DateTime = {
|
|||
*/
|
||||
runFromFiletimeToUnix: function(input, args) {
|
||||
let units = args[0];
|
||||
input = new BigInteger(input).subtract(new BigInteger("116444736000000000"));
|
||||
let format = args[1];
|
||||
if (format === "Hex") {
|
||||
input = new BigInteger(input, 16);
|
||||
} else {
|
||||
input = new BigInteger(input);
|
||||
}
|
||||
input = input.subtract(new BigInteger("116444736000000000"));
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.divide(new BigInteger("10000000"));
|
||||
} else if (units === "Milliseconds (ms)") {
|
||||
|
@ -116,6 +122,7 @@ const DateTime = {
|
|||
*/
|
||||
runToFiletimeFromUnix: function(input, args) {
|
||||
let units = args[0];
|
||||
let format = args[1];
|
||||
input = new BigInteger(input);
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.multiply(new BigInteger("10000000"));
|
||||
|
@ -128,10 +135,22 @@ const DateTime = {
|
|||
} else {
|
||||
throw "Unrecognised unit";
|
||||
}
|
||||
return input.add(new BigInteger("116444736000000000")).toString();
|
||||
input = input.add(new BigInteger("116444736000000000"));
|
||||
if (format === "Hex"){
|
||||
return input.toString(16);
|
||||
} else {
|
||||
return input.toString();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
FILETIME_FORMATS: ["Decimal", "Hex"],
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue