From 9f7a36954ec6290003c9518176e22199e325d4b7 Mon Sep 17 00:00:00 2001 From: sd5 Date: Wed, 1 Dec 2021 14:08:08 +0000 Subject: [PATCH 1/5] Added 12 Timestamps --- src/core/config/Categories.json | 42 ++++++--------- .../operations/FromChromeBrowserTimeStamp.mjs | 47 ++++++++++++++++ .../FromFirefoxBrowserTimeStamp.mjs | 47 ++++++++++++++++ src/core/operations/FromHFSPlusTimeStamp.mjs | 46 ++++++++++++++++ .../operations/FromMacAbsoluteTimestamp.mjs | 45 ++++++++++++++++ .../operations/FromUNIX32bitTimeStamp.mjs | 46 ++++++++++++++++ .../operations/FromWindows64bitTimeStamp.mjs | 47 ++++++++++++++++ .../operations/ToChromeBrowserTimeStamp.mjs | 52 ++++++++++++++++++ .../operations/ToFirefoxBrowserTimeStamp.mjs | 53 +++++++++++++++++++ src/core/operations/ToHFSPlusTimeStamp.mjs | 52 ++++++++++++++++++ .../operations/ToMacAbsoluteTimestamp.mjs | 51 ++++++++++++++++++ src/core/operations/ToUNIX32bitTimeStamp.mjs | 52 ++++++++++++++++++ .../operations/ToWindows64bitTimeStamp.mjs | 53 +++++++++++++++++++ 13 files changed, 608 insertions(+), 25 deletions(-) create mode 100644 src/core/operations/FromChromeBrowserTimeStamp.mjs create mode 100644 src/core/operations/FromFirefoxBrowserTimeStamp.mjs create mode 100644 src/core/operations/FromHFSPlusTimeStamp.mjs create mode 100644 src/core/operations/FromMacAbsoluteTimestamp.mjs create mode 100644 src/core/operations/FromUNIX32bitTimeStamp.mjs create mode 100644 src/core/operations/FromWindows64bitTimeStamp.mjs create mode 100644 src/core/operations/ToChromeBrowserTimeStamp.mjs create mode 100644 src/core/operations/ToFirefoxBrowserTimeStamp.mjs create mode 100644 src/core/operations/ToHFSPlusTimeStamp.mjs create mode 100644 src/core/operations/ToMacAbsoluteTimestamp.mjs create mode 100644 src/core/operations/ToUNIX32bitTimeStamp.mjs create mode 100644 src/core/operations/ToWindows64bitTimeStamp.mjs diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 09ee8d15b7..7417d85e02 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -18,15 +18,15 @@ "From Binary", "To Octal", "From Octal", + "To Base64", + "From Base64", + "Show Base64 offsets", "To Base32", "From Base32", "To Base58", "From Base58", "To Base62", "From Base62", - "To Base64", - "From Base64", - "Show Base64 offsets", "To Base85", "From Base85", "To Base", @@ -61,9 +61,7 @@ "Parse TLV", "CSV to JSON", "JSON to CSV", - "Avro to JSON", - "CBOR Encode", - "CBOR Decode" + "Avro to JSON" ] }, { @@ -136,11 +134,6 @@ "PGP Verify", "PGP Encrypt and Sign", "PGP Decrypt and Verify", - "Generate RSA Key Pair", - "RSA Sign", - "RSA Verify", - "RSA Encrypt", - "RSA Decrypt", "Parse SSH Host Key" ] }, @@ -191,13 +184,8 @@ "URL Encode", "URL Decode", "Protobuf Decode", - "Protobuf Encode", "VarInt Encode", "VarInt Decode", - "JA3 Fingerprint", - "JA3S Fingerprint", - "HASSH Client Fingerprint", - "HASSH Server Fingerprint", "Format MAC addresses", "Change IP format", "Group IP addresses", @@ -212,10 +200,8 @@ "ops": [ "Encode text", "Decode text", - "Unicode Text Format", "Remove Diacritics", - "Unescape Unicode Characters", - "Convert to NATO alphabet" + "Unescape Unicode Characters" ] }, { @@ -245,7 +231,6 @@ "Pad lines", "Find / Replace", "Regular expression", - "Fuzzy Match", "Offset checker", "Hamming Distance", "Convert distance", @@ -256,7 +241,6 @@ "Convert co-ordinate format", "Show on map", "Parse UNIX file permissions", - "Parse ObjectID timestamp", "Swap endianness", "Parse colour code", "Escape string", @@ -272,10 +256,21 @@ "Translate DateTime Format", "From UNIX Timestamp", "To UNIX Timestamp", + "From UNIX 32-bit Timestamp", + "To UNIX 32-bit Timestamp", "Windows Filetime to UNIX Timestamp", "UNIX Timestamp to Windows Filetime", + "From Mac Absolute Timestamp", + "To Mac Absolute Timestamp", + "From HFS(+) Timestamp", + "To HFS(+) Timestamp", + "From Windows 64-bit Filetime Timestamp", + "To Windows 64-bit Filetime Timestamp", + "From Chrome Browser Timestamp", + "To Chrome Browser Timestamp", + "From Firefox Browser Timestamp", + "To Firefox Browser Timestamp", "Extract dates", - "Get Time", "Sleep" ] }, @@ -295,7 +290,6 @@ "JPath expression", "CSS selector", "Extract EXIF", - "Extract ID3", "Extract Files" ] }, @@ -329,7 +323,6 @@ "SHA1", "SHA2", "SHA3", - "SM3", "Keccak", "Shake", "RIPEMD", @@ -414,7 +407,6 @@ "ops": [ "Render Image", "Play Media", - "Generate Image", "Optical Character Recognition", "Remove EXIF", "Extract EXIF", diff --git a/src/core/operations/FromChromeBrowserTimeStamp.mjs b/src/core/operations/FromChromeBrowserTimeStamp.mjs new file mode 100644 index 0000000000..38eba3ff68 --- /dev/null +++ b/src/core/operations/FromChromeBrowserTimeStamp.mjs @@ -0,0 +1,47 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From Chrome Browser Timestamp operation + */ +class FromChromeBrowserTimestamp extends Operation { + + /** + * FromChromeBrowserTimestamp constructor + */ + constructor() { + super(); + + this.name = "From Chrome Browser Timestamp"; + this.module = "Default"; + this.description = "Converts Chrome Browser Timestamp to datetime string

e.g. 12883423549000000 \ + becomes 5 April 209 16:45:49 UTC

Chrome Browser timestamp is a 17 digit value representing the number of microseconds since \ + January 1, 1601 UTC."; + this.infoURL = "https://support.google.com/chrome/community?hl=en"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const d = moment.unix((input /1000000) - 11644473600); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + + throw new OperationError(); + } +} + +export default FromChromeBrowserTimestamp; diff --git a/src/core/operations/FromFirefoxBrowserTimeStamp.mjs b/src/core/operations/FromFirefoxBrowserTimeStamp.mjs new file mode 100644 index 0000000000..258074183e --- /dev/null +++ b/src/core/operations/FromFirefoxBrowserTimeStamp.mjs @@ -0,0 +1,47 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From Firefox Browser Timestamp operation + */ +class FromFirefoxBrowserTimestamp extends Operation { + + /** + * FromFirefoxBrowserTimestamp constructor + */ + constructor() { + super(); + + this.name = "From Firefox Browser Timestamp"; + this.module = "Default"; + this.description = "Converts Firefox Browser Timestamp to datetime string

e.g. 1341575244735000 \ + becomes 6 July 2012 11:47:24 UTC

Firefox Browser timestamp is a 16 digit value representing the number of microseconds since \ + January 1, 1970 UTC. Note: fractions of seconds are not retained."; + this.infoURL = "https://support.mozilla.org/en-US/"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const d = moment.unix((input /1000000)); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + + throw new OperationError(); + } +} + +export default FromFirefoxBrowserTimestamp; diff --git a/src/core/operations/FromHFSPlusTimeStamp.mjs b/src/core/operations/FromHFSPlusTimeStamp.mjs new file mode 100644 index 0000000000..3905cebd83 --- /dev/null +++ b/src/core/operations/FromHFSPlusTimeStamp.mjs @@ -0,0 +1,46 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From HFSPlus filesystem Timestamp operation + */ +class FromHFSPlusTimestamp extends Operation { + + /** + * FromHFSPlusTimestamp constructor + */ + constructor() { + super(); + + this.name = "From HFS(+) Timestamp"; + this.module = "Default"; + this.description = "Converts Apple HFS/HFS+ Filesystem Timestamp to datetime string

e.g. CDF566EE becomes 30 June 2013 04:39:10 UTC

Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://en.wikipedia.org/wiki/HFS_Plus"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const h = parseInt(input, 16); + const d = moment.unix(h - 2082844800); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + + throw new OperationError(); + } +} + +export default FromHFSPlusTimestamp; diff --git a/src/core/operations/FromMacAbsoluteTimestamp.mjs b/src/core/operations/FromMacAbsoluteTimestamp.mjs new file mode 100644 index 0000000000..1396d067b7 --- /dev/null +++ b/src/core/operations/FromMacAbsoluteTimestamp.mjs @@ -0,0 +1,45 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From Mac Absolute Timestamp operation + */ +class FromMacAbsoluteTimestamp extends Operation { + + /** + * FromMacAbsoluteTimestamp constructor + */ + constructor() { + super(); + + this.name = "From Mac Absolute Timestamp"; + this.module = "Default"; + this.description = "Converts Apple Mac Absolute Timestamp to datetime string

e.g. 591621300 becomes Tue 1 October 2019 11:15:00 UTC

Mac Absolute timestamp is a 32-bit value representing the number of seconds since January 1, 2001 UTC"; + this.infoURL = "https://developer.apple.com/documentation/corefoundation/cfabsolutetime"; + this.inputType = "number"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {number} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const d = moment.unix(input + 978307200); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + + throw new OperationError(); + } +} + +export default FromMacAbsoluteTimestamp; diff --git a/src/core/operations/FromUNIX32bitTimeStamp.mjs b/src/core/operations/FromUNIX32bitTimeStamp.mjs new file mode 100644 index 0000000000..62f0c1092e --- /dev/null +++ b/src/core/operations/FromUNIX32bitTimeStamp.mjs @@ -0,0 +1,46 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From UNIX 32bit filesystem Timestamp operation + */ +class FromUNIX32bitTimestamp extends Operation { + + /** + * FromUNIX32bitTimestamp constructor + */ + constructor() { + super(); + + this.name = "From UNIX 32-bit Timestamp"; + this.module = "Default"; + this.description = "Converts UNIX 32-bit Hex Timestamp to datetime string

e.g. 51C3C311 becomes 21 June 2013 03:05:53 UTC

UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://wikipedia.org/wiki/Unix_time"; + this.inputType = "string"; + this.outputType = "string"; + + + this.args = []; + } + + /** + * @param {string} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const h = parseInt(input, 16); + const d = moment.unix(h); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } +} + +export default FromUNIX32bitTimestamp; diff --git a/src/core/operations/FromWindows64bitTimeStamp.mjs b/src/core/operations/FromWindows64bitTimeStamp.mjs new file mode 100644 index 0000000000..437a1f1400 --- /dev/null +++ b/src/core/operations/FromWindows64bitTimeStamp.mjs @@ -0,0 +1,47 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * From Windows 64bit Filesystem Timestamp operation + */ +class FromWindows64bitTimestamp extends Operation { + + /** + * FromWindows64bitFilesystemTimestamp constructor + */ + constructor() { + super(); + + this.name = "From Windows 64-bit Filetime Timestamp"; + this.module = "Default"; + this.description = "Converts Windows 64-bit Hex Filetime Timestamp to datetime string

e.g. 01CEE16F415343EE becomes 14 November 2013 19:21:19 UTC

windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://en.wikipedia.org/wiki/System_time"; + this.inputType = "string"; + this.outputType = "string"; + this.args = []; + } + + /** + * @param {string} input + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + + const h = parseInt(input, 16); + const secs = h/10000000; + const d = moment.unix(secs - 11644473600); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + + throw new OperationError(); + } +} + +export default FromWindows64bitTimestamp; diff --git a/src/core/operations/ToChromeBrowserTimeStamp.mjs b/src/core/operations/ToChromeBrowserTimeStamp.mjs new file mode 100644 index 0000000000..758495d768 --- /dev/null +++ b/src/core/operations/ToChromeBrowserTimeStamp.mjs @@ -0,0 +1,52 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To Chrome Browser Timestamp operation + */ +class ToChromeBrowserTimestamp extends Operation { + + /** + * ToChromeBrowserTimestamp constructor + */ + constructor() { + super(); + + this.name = "To Chrome Browser Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to Chrome Browser Timestamp

e.g. 5 April 2009 16:45:49 UTC\ + becomes 12883423549000000

Chrome Browser timestamp is a 17 digit value representing the number of microseconds since January 1, 1601 UTC."; + this.infoURL = "https://support.google.com/chrome/community?hl=en"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = ((d.unix()+11644473600) * 1000000); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } +} + +export default ToChromeBrowserTimestamp; diff --git a/src/core/operations/ToFirefoxBrowserTimeStamp.mjs b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs new file mode 100644 index 0000000000..17bdf2cb16 --- /dev/null +++ b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs @@ -0,0 +1,53 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To Firefox Browser Timestamp operation + */ +class ToFirefoxBrowserTimestamp extends Operation { + + /** + * ToFirefoxBrowserTimestamp constructor + */ + constructor() { + super(); + + this.name = "To Firefox Browser Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to Firefox Browser Timestamp

e.g. 6 July 2012 11:47:24 UTC\ + becomes 1341575244735000

Firefox Browser timestamp is a 16 digit value representing the number of microseconds since \ + January 1, 1970 UTC. Note: fractions of seconds are not retained."; + this.infoURL = "https://support.mozilla.org/en-US/"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = (d.unix() * 1000000); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } +} + +export default ToFirefoxBrowserTimestamp; diff --git a/src/core/operations/ToHFSPlusTimeStamp.mjs b/src/core/operations/ToHFSPlusTimeStamp.mjs new file mode 100644 index 0000000000..33964a1a04 --- /dev/null +++ b/src/core/operations/ToHFSPlusTimeStamp.mjs @@ -0,0 +1,52 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To HFSPlus filesystem Timestamp operation + */ +class ToHFSPlusTimestamp extends Operation { + + /** + * ToHFSPlusTimestamp constructor + */ + constructor() { + super(); + + this.name = "To HFS(+) Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to Apple HFS/HFS+ Filesystem Timestamp

e.g. 30 June 2013 04:39:10 UTC becomes CDF566EE

Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://en.wikipedia.org/wiki/HFS_Plus"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = d.unix(); + const hexString = (result + 2082844800).toString(16); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)`: hexString.toUpperCase(); + } +} + +export default ToHFSPlusTimestamp; diff --git a/src/core/operations/ToMacAbsoluteTimestamp.mjs b/src/core/operations/ToMacAbsoluteTimestamp.mjs new file mode 100644 index 0000000000..d91dc9c6f1 --- /dev/null +++ b/src/core/operations/ToMacAbsoluteTimestamp.mjs @@ -0,0 +1,51 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To Mac Absolute Timestamp operation + */ +class ToMacAbsoluteTimestamp extends Operation { + + /** + * FromMacAbsoluteTimestamp constructor + */ + constructor() { + super(); + + this.name = "To Mac Absolute Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to Apple Mac Absolute Timestamp

e.g. Tue 1 October 2019 11:15:00 UTC becomes 591621300

Mac Absolute timestamp is a 32-bit value representing the number of seconds since January 1, 2001 UTC"; + this.infoURL = "https://developer.apple.com/documentation/corefoundation/cfabsolutetime"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = (d.unix()-978307200); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } +} + +export default ToMacAbsoluteTimestamp; diff --git a/src/core/operations/ToUNIX32bitTimeStamp.mjs b/src/core/operations/ToUNIX32bitTimeStamp.mjs new file mode 100644 index 0000000000..283982900d --- /dev/null +++ b/src/core/operations/ToUNIX32bitTimeStamp.mjs @@ -0,0 +1,52 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To UNIX 32bit filesystem Timestamp operation + */ +class ToUNIX32bitTimestamp extends Operation { + + /** + * ToUNIX32bitTimestamp constructor + */ + constructor() { + super(); + + this.name = "To UNIX 32-bit Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to UNIX 32-bit Hex Timestamp

e.g. 21 June 2013 03:05:53 UTC becomes 51C3C311

UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://wikipedia.org/wiki/Unix_time"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = d.unix(); + const hexString = result.toString(16); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); + } +} + +export default ToUNIX32bitTimestamp; diff --git a/src/core/operations/ToWindows64bitTimeStamp.mjs b/src/core/operations/ToWindows64bitTimeStamp.mjs new file mode 100644 index 0000000000..c95bc8a54b --- /dev/null +++ b/src/core/operations/ToWindows64bitTimeStamp.mjs @@ -0,0 +1,53 @@ +/** + * @author mykulh [mykulh@yahoo.co.uk] + * @copyright Crown Copyright 2021 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; +import OperationError from "../errors/OperationError.mjs"; +import moment from "moment-timezone"; + +/** + * To Windows 64bit filesystem Timestamp operation + */ +class ToWindows64bitTimestamp extends Operation { + + /** + * ToWindows64bitFilesystemTimestamp constructor + */ + constructor() { + super(); + + this.name = "To Windows 64-bit Filetime Timestamp"; + this.module = "Default"; + this.description = "Converts datetime string to Windows 64-bit Hex Filetime Timestamp

e.g. 14 November 2013 19:21:19 UTC becomes
01CEE16F415343EE
windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC

Use with swap endianness recipe if required."; + this.infoURL = "https://en.wikipedia.org/wiki/System_time"; + this.inputType = "string"; + this.outputType = "string"; + this.args = [ + { + "name": "Show parsed datetime", + "type": "boolean", + "value": true + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + * @throws {OperationError} if invalid unit + */ + run(input, args) { + const [showDateTime] = args, + d = moment.utc(input); + let result = d.unix(); + const step1 = result + 11644473600; + const hexString = (step1 * 10000000).toString(16); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase() ; + } +} + +export default ToWindows64bitTimestamp; From 6ffbe8fa9ea701f5127f6842570e4b8827cf4817 Mon Sep 17 00:00:00 2001 From: sd5 Date: Wed, 1 Dec 2021 14:09:45 +0000 Subject: [PATCH 2/5] Added 12 Timestamps and config --- src/core/config/Categories.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index 7417d85e02..94a5e87257 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -260,7 +260,7 @@ "To UNIX 32-bit Timestamp", "Windows Filetime to UNIX Timestamp", "UNIX Timestamp to Windows Filetime", - "From Mac Absolute Timestamp", + "From Mac Absolute Timestamp", "To Mac Absolute Timestamp", "From HFS(+) Timestamp", "To HFS(+) Timestamp", From cabf232ea5fabea21169a6f6bdbbdddefabfa2a2 Mon Sep 17 00:00:00 2001 From: mykulh Date: Fri, 14 Jun 2024 10:45:00 +0100 Subject: [PATCH 3/5] Updated file for 2024 --- .../operations/FromChromeBrowserTimeStamp.mjs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/core/operations/FromChromeBrowserTimeStamp.mjs b/src/core/operations/FromChromeBrowserTimeStamp.mjs index 38eba3ff68..0a0af02a11 100644 --- a/src/core/operations/FromChromeBrowserTimeStamp.mjs +++ b/src/core/operations/FromChromeBrowserTimeStamp.mjs @@ -18,7 +18,6 @@ class FromChromeBrowserTimestamp extends Operation { */ constructor() { super(); - this.name = "From Chrome Browser Timestamp"; this.module = "Default"; this.description = "Converts Chrome Browser Timestamp to datetime string

e.g. 12883423549000000 \ @@ -36,12 +35,12 @@ class FromChromeBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - - const d = moment.unix((input /1000000) - 11644473600); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - - throw new OperationError(); + try{ + const d = moment.unix((input /1000000) - 11644473600); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { + throw new OperationError(); + } } } - -export default FromChromeBrowserTimestamp; +export default FromChromeBrowserTimestamp; \ No newline at end of file From 7cb1f1ff87ca6fc36068f4df85163114ff29c6c8 Mon Sep 17 00:00:00 2001 From: mykulh Date: Fri, 14 Jun 2024 11:11:35 +0100 Subject: [PATCH 4/5] Updated all files for 2024 --- .../operations/FromChromeBrowserTimeStamp.mjs | 4 ++-- .../FromFirefoxBrowserTimeStamp.mjs | 13 ++++++------- src/core/operations/FromHFSPlusTimeStamp.mjs | 11 +++++------ .../operations/FromMacAbsoluteTimestamp.mjs | 13 ++++++------- .../operations/FromUNIX32bitTimeStamp.mjs | 13 +++++++------ .../operations/FromWindows64bitTimeStamp.mjs | 13 ++++++------- .../operations/ToChromeBrowserTimeStamp.mjs | 15 ++++++++------- .../operations/ToFirefoxBrowserTimeStamp.mjs | 15 ++++++++------- src/core/operations/ToHFSPlusTimeStamp.mjs | 17 +++++++++-------- .../operations/ToMacAbsoluteTimestamp.mjs | 15 ++++++++------- src/core/operations/ToUNIX32bitTimeStamp.mjs | 17 +++++++++-------- .../operations/ToWindows64bitTimeStamp.mjs | 19 ++++++++++--------- 12 files changed, 84 insertions(+), 81 deletions(-) diff --git a/src/core/operations/FromChromeBrowserTimeStamp.mjs b/src/core/operations/FromChromeBrowserTimeStamp.mjs index 0a0af02a11..b9e8d05011 100644 --- a/src/core/operations/FromChromeBrowserTimeStamp.mjs +++ b/src/core/operations/FromChromeBrowserTimeStamp.mjs @@ -39,8 +39,8 @@ class FromChromeBrowserTimestamp extends Operation { const d = moment.unix((input /1000000) - 11644473600); return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; } catch { - throw new OperationError(); + throw new OperationError("Unrecognised format"); } } } -export default FromChromeBrowserTimestamp; \ No newline at end of file +export default FromChromeBrowserTimestamp; diff --git a/src/core/operations/FromFirefoxBrowserTimeStamp.mjs b/src/core/operations/FromFirefoxBrowserTimeStamp.mjs index 258074183e..1110f7e4ce 100644 --- a/src/core/operations/FromFirefoxBrowserTimeStamp.mjs +++ b/src/core/operations/FromFirefoxBrowserTimeStamp.mjs @@ -18,7 +18,6 @@ class FromFirefoxBrowserTimestamp extends Operation { */ constructor() { super(); - this.name = "From Firefox Browser Timestamp"; this.module = "Default"; this.description = "Converts Firefox Browser Timestamp to datetime string

e.g. 1341575244735000 \ @@ -36,12 +35,12 @@ class FromFirefoxBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - - const d = moment.unix((input /1000000)); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - - throw new OperationError(); + try{ + const d = moment.unix((input /1000000)); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { + throw new OperationError("Unrecognised format"); + } } } - export default FromFirefoxBrowserTimestamp; diff --git a/src/core/operations/FromHFSPlusTimeStamp.mjs b/src/core/operations/FromHFSPlusTimeStamp.mjs index 3905cebd83..b755e15015 100644 --- a/src/core/operations/FromHFSPlusTimeStamp.mjs +++ b/src/core/operations/FromHFSPlusTimeStamp.mjs @@ -18,7 +18,6 @@ class FromHFSPlusTimestamp extends Operation { */ constructor() { super(); - this.name = "From HFS(+) Timestamp"; this.module = "Default"; this.description = "Converts Apple HFS/HFS+ Filesystem Timestamp to datetime string

e.g. CDF566EE becomes 30 June 2013 04:39:10 UTC

Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC

Use with swap endianness recipe if required."; @@ -34,13 +33,13 @@ class FromHFSPlusTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - + try{ const h = parseInt(input, 16); const d = moment.unix(h - 2082844800); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - - throw new OperationError(); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch{ + throw new OperationError("Unrecognised format"); + } } } - export default FromHFSPlusTimestamp; diff --git a/src/core/operations/FromMacAbsoluteTimestamp.mjs b/src/core/operations/FromMacAbsoluteTimestamp.mjs index 1396d067b7..dc9b4cd9ac 100644 --- a/src/core/operations/FromMacAbsoluteTimestamp.mjs +++ b/src/core/operations/FromMacAbsoluteTimestamp.mjs @@ -18,7 +18,6 @@ class FromMacAbsoluteTimestamp extends Operation { */ constructor() { super(); - this.name = "From Mac Absolute Timestamp"; this.module = "Default"; this.description = "Converts Apple Mac Absolute Timestamp to datetime string

e.g. 591621300 becomes Tue 1 October 2019 11:15:00 UTC

Mac Absolute timestamp is a 32-bit value representing the number of seconds since January 1, 2001 UTC"; @@ -34,12 +33,12 @@ class FromMacAbsoluteTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - - const d = moment.unix(input + 978307200); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - - throw new OperationError(); + try{ + const d = moment.unix(input + 978307200); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { + throw new OperationError("Unrecognised format"); + } } } - export default FromMacAbsoluteTimestamp; diff --git a/src/core/operations/FromUNIX32bitTimeStamp.mjs b/src/core/operations/FromUNIX32bitTimeStamp.mjs index 62f0c1092e..842ffc0e7a 100644 --- a/src/core/operations/FromUNIX32bitTimeStamp.mjs +++ b/src/core/operations/FromUNIX32bitTimeStamp.mjs @@ -18,7 +18,6 @@ class FromUNIX32bitTimestamp extends Operation { */ constructor() { super(); - this.name = "From UNIX 32-bit Timestamp"; this.module = "Default"; this.description = "Converts UNIX 32-bit Hex Timestamp to datetime string

e.g. 51C3C311 becomes 21 June 2013 03:05:53 UTC

UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC

Use with swap endianness recipe if required."; @@ -36,11 +35,13 @@ class FromUNIX32bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - - const h = parseInt(input, 16); - const d = moment.unix(h); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + try{ + const h = parseInt(input, 16); + const d = moment.unix(h); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { + throw new OperationError("Unrecognised format"); + } } } - export default FromUNIX32bitTimestamp; diff --git a/src/core/operations/FromWindows64bitTimeStamp.mjs b/src/core/operations/FromWindows64bitTimeStamp.mjs index 437a1f1400..a20830765c 100644 --- a/src/core/operations/FromWindows64bitTimeStamp.mjs +++ b/src/core/operations/FromWindows64bitTimeStamp.mjs @@ -18,7 +18,6 @@ class FromWindows64bitTimestamp extends Operation { */ constructor() { super(); - this.name = "From Windows 64-bit Filetime Timestamp"; this.module = "Default"; this.description = "Converts Windows 64-bit Hex Filetime Timestamp to datetime string

e.g. 01CEE16F415343EE becomes 14 November 2013 19:21:19 UTC

windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC

Use with swap endianness recipe if required."; @@ -34,14 +33,14 @@ class FromWindows64bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - + try{ const h = parseInt(input, 16); const secs = h/10000000; const d = moment.unix(secs - 11644473600); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - - throw new OperationError(); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default FromWindows64bitTimestamp; +export default FromWindows64bitTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToChromeBrowserTimeStamp.mjs b/src/core/operations/ToChromeBrowserTimeStamp.mjs index 758495d768..aa6825987e 100644 --- a/src/core/operations/ToChromeBrowserTimeStamp.mjs +++ b/src/core/operations/ToChromeBrowserTimeStamp.mjs @@ -18,7 +18,6 @@ class ToChromeBrowserTimestamp extends Operation { */ constructor() { super(); - this.name = "To Chrome Browser Timestamp"; this.module = "Default"; this.description = "Converts datetime string to Chrome Browser Timestamp

e.g. 5 April 2009 16:45:49 UTC\ @@ -42,11 +41,13 @@ class ToChromeBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = ((d.unix()+11644473600) * 1000000); - return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = ((d.unix()+11644473600) * 1000000); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToChromeBrowserTimestamp; +export default ToChromeBrowserTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToFirefoxBrowserTimeStamp.mjs b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs index 17bdf2cb16..bc42826131 100644 --- a/src/core/operations/ToFirefoxBrowserTimeStamp.mjs +++ b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs @@ -18,7 +18,6 @@ class ToFirefoxBrowserTimestamp extends Operation { */ constructor() { super(); - this.name = "To Firefox Browser Timestamp"; this.module = "Default"; this.description = "Converts datetime string to Firefox Browser Timestamp

e.g. 6 July 2012 11:47:24 UTC\ @@ -43,11 +42,13 @@ class ToFirefoxBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = (d.unix() * 1000000); - return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = (d.unix() * 1000000); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToFirefoxBrowserTimestamp; +export default ToFirefoxBrowserTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToHFSPlusTimeStamp.mjs b/src/core/operations/ToHFSPlusTimeStamp.mjs index 33964a1a04..73d8f15dab 100644 --- a/src/core/operations/ToHFSPlusTimeStamp.mjs +++ b/src/core/operations/ToHFSPlusTimeStamp.mjs @@ -18,7 +18,6 @@ class ToHFSPlusTimestamp extends Operation { */ constructor() { super(); - this.name = "To HFS(+) Timestamp"; this.module = "Default"; this.description = "Converts datetime string to Apple HFS/HFS+ Filesystem Timestamp

e.g. 30 June 2013 04:39:10 UTC becomes CDF566EE

Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC

Use with swap endianness recipe if required."; @@ -41,12 +40,14 @@ class ToHFSPlusTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = d.unix(); - const hexString = (result + 2082844800).toString(16); - return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)`: hexString.toUpperCase(); + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = d.unix(); + const hexString = (result + 2082844800).toString(16); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)`: hexString.toUpperCase(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToHFSPlusTimestamp; +export default ToHFSPlusTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToMacAbsoluteTimestamp.mjs b/src/core/operations/ToMacAbsoluteTimestamp.mjs index d91dc9c6f1..7a2227f6c6 100644 --- a/src/core/operations/ToMacAbsoluteTimestamp.mjs +++ b/src/core/operations/ToMacAbsoluteTimestamp.mjs @@ -18,7 +18,6 @@ class ToMacAbsoluteTimestamp extends Operation { */ constructor() { super(); - this.name = "To Mac Absolute Timestamp"; this.module = "Default"; this.description = "Converts datetime string to Apple Mac Absolute Timestamp

e.g. Tue 1 October 2019 11:15:00 UTC becomes 591621300

Mac Absolute timestamp is a 32-bit value representing the number of seconds since January 1, 2001 UTC"; @@ -41,11 +40,13 @@ class ToMacAbsoluteTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = (d.unix()-978307200); - return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = (d.unix()-978307200); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToMacAbsoluteTimestamp; +export default ToMacAbsoluteTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToUNIX32bitTimeStamp.mjs b/src/core/operations/ToUNIX32bitTimeStamp.mjs index 283982900d..bff32cd93e 100644 --- a/src/core/operations/ToUNIX32bitTimeStamp.mjs +++ b/src/core/operations/ToUNIX32bitTimeStamp.mjs @@ -18,7 +18,6 @@ class ToUNIX32bitTimestamp extends Operation { */ constructor() { super(); - this.name = "To UNIX 32-bit Timestamp"; this.module = "Default"; this.description = "Converts datetime string to UNIX 32-bit Hex Timestamp

e.g. 21 June 2013 03:05:53 UTC becomes 51C3C311

UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC

Use with swap endianness recipe if required."; @@ -41,12 +40,14 @@ class ToUNIX32bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = d.unix(); - const hexString = result.toString(16); - return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = d.unix(); + const hexString = result.toString(16); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToUNIX32bitTimestamp; +export default ToUNIX32bitTimestamp; \ No newline at end of file diff --git a/src/core/operations/ToWindows64bitTimeStamp.mjs b/src/core/operations/ToWindows64bitTimeStamp.mjs index c95bc8a54b..f1dda3d191 100644 --- a/src/core/operations/ToWindows64bitTimeStamp.mjs +++ b/src/core/operations/ToWindows64bitTimeStamp.mjs @@ -18,7 +18,6 @@ class ToWindows64bitTimestamp extends Operation { */ constructor() { super(); - this.name = "To Windows 64-bit Filetime Timestamp"; this.module = "Default"; this.description = "Converts datetime string to Windows 64-bit Hex Filetime Timestamp

e.g. 14 November 2013 19:21:19 UTC becomes
01CEE16F415343EE
windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC

Use with swap endianness recipe if required."; @@ -41,13 +40,15 @@ class ToWindows64bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - const [showDateTime] = args, - d = moment.utc(input); - let result = d.unix(); - const step1 = result + 11644473600; - const hexString = (step1 * 10000000).toString(16); - return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase() ; + try{ + const [showDateTime] = args,d = moment.utc(input); + let result = d.unix(); + const step1 = result + 11644473600; + const hexString = (step1 * 10000000).toString(16); + eturn showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); + } catch { + throw new OperationError("Unrecognised format"); + } } } - -export default ToWindows64bitTimestamp; +export default ToWindows64bitTimestamp; \ No newline at end of file From 66e35156ccc1bd5fc209e9cebc4f777f26a1a186 Mon Sep 17 00:00:00 2001 From: mykulh Date: Fri, 14 Jun 2024 11:31:48 +0100 Subject: [PATCH 5/5] Syntax corrections for Lint --- src/core/operations/FromChromeBrowserTimeStamp.mjs | 4 ++-- src/core/operations/FromHFSPlusTimeStamp.mjs | 12 ++++++------ src/core/operations/FromMacAbsoluteTimestamp.mjs | 4 ++-- src/core/operations/FromUNIX32bitTimeStamp.mjs | 4 ++-- src/core/operations/FromWindows64bitTimeStamp.mjs | 10 +++++----- src/core/operations/ToChromeBrowserTimeStamp.mjs | 2 +- src/core/operations/ToFirefoxBrowserTimeStamp.mjs | 2 +- src/core/operations/ToHFSPlusTimeStamp.mjs | 2 +- src/core/operations/ToMacAbsoluteTimestamp.mjs | 4 ++-- src/core/operations/ToUNIX32bitTimeStamp.mjs | 2 +- src/core/operations/ToWindows64bitTimeStamp.mjs | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/core/operations/FromChromeBrowserTimeStamp.mjs b/src/core/operations/FromChromeBrowserTimeStamp.mjs index b9e8d05011..68bd26226b 100644 --- a/src/core/operations/FromChromeBrowserTimeStamp.mjs +++ b/src/core/operations/FromChromeBrowserTimeStamp.mjs @@ -35,7 +35,7 @@ class FromChromeBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const d = moment.unix((input /1000000) - 11644473600); return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; } catch { @@ -43,4 +43,4 @@ class FromChromeBrowserTimestamp extends Operation { } } } -export default FromChromeBrowserTimestamp; +export default FromChromeBrowserTimestamp; \ No newline at end of file diff --git a/src/core/operations/FromHFSPlusTimeStamp.mjs b/src/core/operations/FromHFSPlusTimeStamp.mjs index b755e15015..2d1dfc4cfa 100644 --- a/src/core/operations/FromHFSPlusTimeStamp.mjs +++ b/src/core/operations/FromHFSPlusTimeStamp.mjs @@ -33,13 +33,13 @@ class FromHFSPlusTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ - const h = parseInt(input, 16); - const d = moment.unix(h - 2082844800); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; - } catch{ + try { + const h = parseInt(input, 16); + const d = moment.unix(h - 2082844800); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + } catch { throw new OperationError("Unrecognised format"); } } } -export default FromHFSPlusTimestamp; +export default FromHFSPlusTimestamp; \ No newline at end of file diff --git a/src/core/operations/FromMacAbsoluteTimestamp.mjs b/src/core/operations/FromMacAbsoluteTimestamp.mjs index dc9b4cd9ac..045e023374 100644 --- a/src/core/operations/FromMacAbsoluteTimestamp.mjs +++ b/src/core/operations/FromMacAbsoluteTimestamp.mjs @@ -33,7 +33,7 @@ class FromMacAbsoluteTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const d = moment.unix(input + 978307200); return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; } catch { @@ -41,4 +41,4 @@ class FromMacAbsoluteTimestamp extends Operation { } } } -export default FromMacAbsoluteTimestamp; +export default FromMacAbsoluteTimestamp; \ No newline at end of file diff --git a/src/core/operations/FromUNIX32bitTimeStamp.mjs b/src/core/operations/FromUNIX32bitTimeStamp.mjs index 842ffc0e7a..e5b863bcd3 100644 --- a/src/core/operations/FromUNIX32bitTimeStamp.mjs +++ b/src/core/operations/FromUNIX32bitTimeStamp.mjs @@ -35,7 +35,7 @@ class FromUNIX32bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const h = parseInt(input, 16); const d = moment.unix(h); return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; @@ -44,4 +44,4 @@ class FromUNIX32bitTimestamp extends Operation { } } } -export default FromUNIX32bitTimestamp; +export default FromUNIX32bitTimestamp; \ No newline at end of file diff --git a/src/core/operations/FromWindows64bitTimeStamp.mjs b/src/core/operations/FromWindows64bitTimeStamp.mjs index a20830765c..164f24934d 100644 --- a/src/core/operations/FromWindows64bitTimeStamp.mjs +++ b/src/core/operations/FromWindows64bitTimeStamp.mjs @@ -33,11 +33,11 @@ class FromWindows64bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ - const h = parseInt(input, 16); - const secs = h/10000000; - const d = moment.unix(secs - 11644473600); - return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; + try { + const h = parseInt(input, 16); + const secs = h/10000000; + const d = moment.unix(secs - 11644473600); + return d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss") + " UTC"; } catch { throw new OperationError("Unrecognised format"); } diff --git a/src/core/operations/ToChromeBrowserTimeStamp.mjs b/src/core/operations/ToChromeBrowserTimeStamp.mjs index aa6825987e..127661230f 100644 --- a/src/core/operations/ToChromeBrowserTimeStamp.mjs +++ b/src/core/operations/ToChromeBrowserTimeStamp.mjs @@ -41,7 +41,7 @@ class ToChromeBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = ((d.unix()+11644473600) * 1000000); return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); diff --git a/src/core/operations/ToFirefoxBrowserTimeStamp.mjs b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs index bc42826131..f2a1506c49 100644 --- a/src/core/operations/ToFirefoxBrowserTimeStamp.mjs +++ b/src/core/operations/ToFirefoxBrowserTimeStamp.mjs @@ -42,7 +42,7 @@ class ToFirefoxBrowserTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = (d.unix() * 1000000); return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); diff --git a/src/core/operations/ToHFSPlusTimeStamp.mjs b/src/core/operations/ToHFSPlusTimeStamp.mjs index 73d8f15dab..b8308dc301 100644 --- a/src/core/operations/ToHFSPlusTimeStamp.mjs +++ b/src/core/operations/ToHFSPlusTimeStamp.mjs @@ -40,7 +40,7 @@ class ToHFSPlusTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = d.unix(); const hexString = (result + 2082844800).toString(16); diff --git a/src/core/operations/ToMacAbsoluteTimestamp.mjs b/src/core/operations/ToMacAbsoluteTimestamp.mjs index 7a2227f6c6..b12519bcd8 100644 --- a/src/core/operations/ToMacAbsoluteTimestamp.mjs +++ b/src/core/operations/ToMacAbsoluteTimestamp.mjs @@ -40,10 +40,10 @@ class ToMacAbsoluteTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = (d.unix()-978307200); - return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); + return showDateTime ? `${result} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : result.toString(); } catch { throw new OperationError("Unrecognised format"); } diff --git a/src/core/operations/ToUNIX32bitTimeStamp.mjs b/src/core/operations/ToUNIX32bitTimeStamp.mjs index bff32cd93e..85d3314a34 100644 --- a/src/core/operations/ToUNIX32bitTimeStamp.mjs +++ b/src/core/operations/ToUNIX32bitTimeStamp.mjs @@ -40,7 +40,7 @@ class ToUNIX32bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = d.unix(); const hexString = result.toString(16); diff --git a/src/core/operations/ToWindows64bitTimeStamp.mjs b/src/core/operations/ToWindows64bitTimeStamp.mjs index f1dda3d191..1eae4f6977 100644 --- a/src/core/operations/ToWindows64bitTimeStamp.mjs +++ b/src/core/operations/ToWindows64bitTimeStamp.mjs @@ -40,12 +40,12 @@ class ToWindows64bitTimestamp extends Operation { * @throws {OperationError} if invalid unit */ run(input, args) { - try{ + try { const [showDateTime] = args,d = moment.utc(input); let result = d.unix(); const step1 = result + 11644473600; const hexString = (step1 * 10000000).toString(16); - eturn showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); + return showDateTime ? `${hexString.toUpperCase()} (${d.tz("UTC").format("ddd D MMMM YYYY HH:mm:ss")} UTC)` : hexString.toUpperCase(); } catch { throw new OperationError("Unrecognised format"); }