mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Added 12 Timestamps
This commit is contained in:
parent
ae1b12c120
commit
9f7a36954e
13 changed files with 608 additions and 25 deletions
|
@ -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",
|
||||
|
|
47
src/core/operations/FromChromeBrowserTimeStamp.mjs
Normal file
47
src/core/operations/FromChromeBrowserTimeStamp.mjs
Normal file
|
@ -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<br><br>e.g. <code>12883423549000000</code> \
|
||||
becomes <code>5 April 209 16:45:49 UTC</code><br><br>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;
|
47
src/core/operations/FromFirefoxBrowserTimeStamp.mjs
Normal file
47
src/core/operations/FromFirefoxBrowserTimeStamp.mjs
Normal file
|
@ -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<br><br>e.g. <code>1341575244735000</code> \
|
||||
becomes <code>6 July 2012 11:47:24 UTC</code><br><br>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;
|
46
src/core/operations/FromHFSPlusTimeStamp.mjs
Normal file
46
src/core/operations/FromHFSPlusTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
45
src/core/operations/FromMacAbsoluteTimestamp.mjs
Normal file
45
src/core/operations/FromMacAbsoluteTimestamp.mjs
Normal file
|
@ -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<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";
|
||||
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;
|
46
src/core/operations/FromUNIX32bitTimeStamp.mjs
Normal file
46
src/core/operations/FromUNIX32bitTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
47
src/core/operations/FromWindows64bitTimeStamp.mjs
Normal file
47
src/core/operations/FromWindows64bitTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
52
src/core/operations/ToChromeBrowserTimeStamp.mjs
Normal file
52
src/core/operations/ToChromeBrowserTimeStamp.mjs
Normal file
|
@ -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<br><br>e.g. <code>5 April 2009 16:45:49 UTC</code>\
|
||||
becomes <code>12883423549000000</code><br><br>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;
|
53
src/core/operations/ToFirefoxBrowserTimeStamp.mjs
Normal file
53
src/core/operations/ToFirefoxBrowserTimeStamp.mjs
Normal file
|
@ -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<br><br>e.g. <code>6 July 2012 11:47:24 UTC</code>\
|
||||
becomes <code>1341575244735000</code><br><br>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;
|
52
src/core/operations/ToHFSPlusTimeStamp.mjs
Normal file
52
src/core/operations/ToHFSPlusTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
51
src/core/operations/ToMacAbsoluteTimestamp.mjs
Normal file
51
src/core/operations/ToMacAbsoluteTimestamp.mjs
Normal file
|
@ -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<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";
|
||||
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;
|
52
src/core/operations/ToUNIX32bitTimeStamp.mjs
Normal file
52
src/core/operations/ToUNIX32bitTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
53
src/core/operations/ToWindows64bitTimeStamp.mjs
Normal file
53
src/core/operations/ToWindows64bitTimeStamp.mjs
Normal file
|
@ -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<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.";
|
||||
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;
|
Loading…
Add table
Add a link
Reference in a new issue