Updated all files for 2024

This commit is contained in:
mykulh 2024-06-14 11:11:35 +01:00
parent cabf232ea5
commit 7cb1f1ff87
12 changed files with 84 additions and 81 deletions

View file

@ -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;
export default FromChromeBrowserTimestamp;

View file

@ -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<br><br>e.g. <code>1341575244735000</code> \
@ -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;

View file

@ -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<br><br>e.g. <code>CDF566EE</code> becomes <code>30 June 2013 04:39:10 UTC</code><br><br>Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC<br><br> 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;

View file

@ -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<br><br>e.g. <code>591621300</code> becomes <code>Tue 1 October 2019 11:15:00 UTC</code><br><br>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;

View file

@ -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<br><br>e.g. <code>51C3C311</code> becomes <code>21 June 2013 03:05:53 UTC</code><br><br>UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC<br><br> 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;

View file

@ -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<br><br>e.g. <code>01CEE16F415343EE</code> becomes <code>14 November 2013 19:21:19 UTC</code><br><br>windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC<br><br> 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;

View file

@ -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<br><br>e.g. <code>5 April 2009 16:45:49 UTC</code>\
@ -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;

View file

@ -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<br><br>e.g. <code>6 July 2012 11:47:24 UTC</code>\
@ -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;

View file

@ -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<br><br>e.g. <code>30 June 2013 04:39:10 UTC</code> becomes <code>CDF566EE</code><br><br>Mac HFS/HFS+ timestamp is a 4 Byte Hex String representing the number of seconds since January 1, 1904 UTC<br><br> 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;

View file

@ -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<br><br>e.g. <code>Tue 1 October 2019 11:15:00 UTC</code> becomes <code>591621300</code><br><br>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;

View file

@ -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<br><br>e.g. <code>21 June 2013 03:05:53 UTC</code> becomes <code>51C3C311</code><br><br>UNIX 32-bit timestamp is a 4 Byte Hex value representing the number of seconds since January 1, 1970 UTC<br><br> 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;

View file

@ -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<br><br>e.g. <code>14 November 2013 19:21:19 UTC</code> becomes <code></code><br>01CEE16F415343EE<br>windows 64-bit filetime timestamp is a 8 Byte Hex value representing the number of 100s of nanoseconds since January 1, 1601 UTC<br><br> 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;