diff --git a/src/core/operations/FromChromeBrowserTimeStamp.mjs b/src/core/operations/FromChromeBrowserTimeStamp.mjs index 0a0af02a..b9e8d050 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 25807418..1110f7e4 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 3905cebd..b755e150 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 1396d067..dc9b4cd9 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 62f0c109..842ffc0e 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 437a1f14..a2083076 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 758495d7..aa682598 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 17bdf2cb..bc428261 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 33964a1a..73d8f15d 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 d91dc9c6..7a2227f6 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 28398290..bff32cd9 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 c95bc8a5..f1dda3d1 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