mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Updated dependencies
This commit is contained in:
parent
614af0602a
commit
1c711f5e03
9 changed files with 1722 additions and 256 deletions
|
@ -2455,7 +2455,7 @@ const OperationConfig = {
|
|||
]
|
||||
},
|
||||
"Windows Filetime to UNIX Timestamp": {
|
||||
module: "JSBN",
|
||||
module: "Default",
|
||||
description: "Converts a Windows Filetime value to a UNIX timestamp.<br><br>A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.<br><br>A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).<br><br>This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds.",
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
@ -2473,7 +2473,7 @@ const OperationConfig = {
|
|||
]
|
||||
},
|
||||
"UNIX Timestamp to Windows Filetime": {
|
||||
module: "JSBN",
|
||||
module: "Default",
|
||||
description: "Converts a UNIX timestamp to a Windows Filetime value.<br><br>A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.<br><br>A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).<br><br>This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds.",
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
|
|
@ -10,6 +10,7 @@ import Convert from "../../operations/Convert.js";
|
|||
import DateTime from "../../operations/DateTime.js";
|
||||
import Endian from "../../operations/Endian.js";
|
||||
import Entropy from "../../operations/Entropy.js";
|
||||
import Filetime from "../../operations/Filetime.js";
|
||||
import FileType from "../../operations/FileType.js";
|
||||
import Hexdump from "../../operations/Hexdump.js";
|
||||
import HTML from "../../operations/HTML.js";
|
||||
|
@ -39,6 +40,7 @@ import UUID from "../../operations/UUID.js";
|
|||
* - Utils.js
|
||||
* - otp
|
||||
* - crypto
|
||||
* - bignumber.js
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
|
@ -157,6 +159,8 @@ OpModules.Default = {
|
|||
"Mean": Arithmetic.runMean,
|
||||
"Median": Arithmetic.runMedian,
|
||||
"Standard Deviation": Arithmetic.runStdDev,
|
||||
"Windows Filetime to UNIX Timestamp": Filetime.runFromFiletimeToUnix,
|
||||
"UNIX Timestamp to Windows Filetime": Filetime.runToFiletimeFromUnix,
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import IP from "../../operations/IP.js";
|
||||
import Filetime from "../../operations/Filetime.js";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,8 +20,6 @@ OpModules.JSBN = {
|
|||
"Parse IPv4 header": IP.runParseIPv4Header,
|
||||
"Change IP format": IP.runChangeIpFormat,
|
||||
"Group IP addresses": IP.runGroupIps,
|
||||
"Windows Filetime to UNIX Timestamp": Filetime.runFromFiletimeToUnix,
|
||||
"UNIX Timestamp to Windows Filetime": Filetime.runToFiletimeFromUnix,
|
||||
};
|
||||
|
||||
export default OpModules;
|
||||
|
|
|
@ -69,7 +69,7 @@ const BCD = {
|
|||
runToBCD: function(input, args) {
|
||||
if (input.isNaN())
|
||||
return "Invalid input";
|
||||
if (!input.floor().equals(input))
|
||||
if (!input.integerValue(BigNumber.ROUND_DOWN).isEqualTo(input))
|
||||
return "Fractional values are not supported by BCD";
|
||||
|
||||
const encoding = BCD.ENCODING_LOOKUP[args[0]],
|
||||
|
|
|
@ -555,7 +555,7 @@ DES uses a key length of 8 bytes (64 bits).`;
|
|||
return forge.util.bytesToHex(bytes);
|
||||
case "Integer":
|
||||
for (i = bytes.length - 1; i >= 0; i--) {
|
||||
value = value.mul(256).plus(bytes.charCodeAt(i));
|
||||
value = value.times(256).plus(bytes.charCodeAt(i));
|
||||
}
|
||||
return value.toFixed();
|
||||
case "Byte array":
|
||||
|
|
|
@ -68,7 +68,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.DISTANCE_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.DISTANCE_FACTOR[inputUnits]);
|
||||
return input.div(Convert.DISTANCE_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -148,7 +148,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.DATA_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.DATA_FACTOR[inputUnits]);
|
||||
return input.div(Convert.DATA_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -228,7 +228,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.AREA_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.AREA_FACTOR[inputUnits]);
|
||||
return input.div(Convert.AREA_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -339,7 +339,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.MASS_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.MASS_FACTOR[inputUnits]);
|
||||
return input.div(Convert.MASS_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
@ -404,7 +404,7 @@ const Convert = {
|
|||
let inputUnits = args[0],
|
||||
outputUnits = args[1];
|
||||
|
||||
input = input.mul(Convert.SPEED_FACTOR[inputUnits]);
|
||||
input = input.times(Convert.SPEED_FACTOR[inputUnits]);
|
||||
return input.div(Convert.SPEED_FACTOR[outputUnits]);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {BigInteger} from "jsbn";
|
||||
import BigNumber from "bignumber.js";
|
||||
|
||||
/**
|
||||
* Windows Filetime operations.
|
||||
|
@ -35,27 +35,29 @@ const Filetime = {
|
|||
let units = args[0],
|
||||
format = args[1];
|
||||
|
||||
if (!input) return "";
|
||||
|
||||
if (format === "Hex") {
|
||||
input = new BigInteger(input, 16);
|
||||
input = new BigNumber(input, 16);
|
||||
} else {
|
||||
input = new BigInteger(input);
|
||||
input = new BigNumber(input);
|
||||
}
|
||||
|
||||
input = input.subtract(new BigInteger("116444736000000000"));
|
||||
input = input.minus(new BigNumber("116444736000000000"));
|
||||
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.divide(new BigInteger("10000000"));
|
||||
input = input.dividedBy(new BigNumber("10000000"));
|
||||
} else if (units === "Milliseconds (ms)") {
|
||||
input = input.divide(new BigInteger("10000"));
|
||||
input = input.dividedBy(new BigNumber("10000"));
|
||||
} else if (units === "Microseconds (μs)") {
|
||||
input = input.divide(new BigInteger("10"));
|
||||
input = input.dividedBy(new BigNumber("10"));
|
||||
} else if (units === "Nanoseconds (ns)") {
|
||||
input = input.multiply(new BigInteger("100"));
|
||||
input = input.multipliedBy(new BigNumber("100"));
|
||||
} else {
|
||||
throw "Unrecognised unit";
|
||||
}
|
||||
|
||||
return input.toString();
|
||||
return input.toFixed();
|
||||
},
|
||||
|
||||
|
||||
|
@ -71,26 +73,28 @@ const Filetime = {
|
|||
let units = args[0],
|
||||
format = args[1];
|
||||
|
||||
input = new BigInteger(input);
|
||||
if (!input) return "";
|
||||
|
||||
input = new BigNumber(input);
|
||||
|
||||
if (units === "Seconds (s)"){
|
||||
input = input.multiply(new BigInteger("10000000"));
|
||||
input = input.multipliedBy(new BigNumber("10000000"));
|
||||
} else if (units === "Milliseconds (ms)") {
|
||||
input = input.multiply(new BigInteger("10000"));
|
||||
input = input.multipliedBy(new BigNumber("10000"));
|
||||
} else if (units === "Microseconds (μs)") {
|
||||
input = input.multiply(new BigInteger("10"));
|
||||
input = input.multiplyiedBy(new BigNumber("10"));
|
||||
} else if (units === "Nanoseconds (ns)") {
|
||||
input = input.divide(new BigInteger("100"));
|
||||
input = input.dividedBy(new BigNumber("100"));
|
||||
} else {
|
||||
throw "Unrecognised unit";
|
||||
}
|
||||
|
||||
input = input.add(new BigInteger("116444736000000000"));
|
||||
input = input.plus(new BigNumber("116444736000000000"));
|
||||
|
||||
if (format === "Hex"){
|
||||
return input.toString(16);
|
||||
} else {
|
||||
return input.toString();
|
||||
return input.toFixed();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue