|
@@ -1,25 +1,26 @@
|
|
/**
|
|
/**
|
|
* @author bwhitn [brian.m.whitney@gmail.com]
|
|
* @author bwhitn [brian.m.whitney@gmail.com]
|
|
- * @copyright Crown Copyright 2017
|
|
|
|
|
|
+ * @copyright Crown Copyright 2018
|
|
* @license Apache-2.0
|
|
* @license Apache-2.0
|
|
*/
|
|
*/
|
|
|
|
|
|
import Operation from "../Operation";
|
|
import Operation from "../Operation";
|
|
|
|
+import OperationError from "../errors/OperationError";
|
|
import cptable from "../vendor/js-codepage/cptable.js";
|
|
import cptable from "../vendor/js-codepage/cptable.js";
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Encode Citrix CTX1 class
|
|
|
|
|
|
+ * Citrix CTX1 Decode operation
|
|
*/
|
|
*/
|
|
-class DecodeCitrixCTX1 extends Operation {
|
|
|
|
|
|
+class CitrixCTX1Decode extends Operation {
|
|
|
|
|
|
/**
|
|
/**
|
|
- * EncodeCitrixCTX1 constructor
|
|
|
|
|
|
+ * CitrixCTX1Decode constructor
|
|
*/
|
|
*/
|
|
constructor() {
|
|
constructor() {
|
|
super();
|
|
super();
|
|
|
|
|
|
this.name = "Citrix CTX1 Decode";
|
|
this.name = "Citrix CTX1 Decode";
|
|
- this.module = "Ciphers";
|
|
|
|
|
|
+ this.module = "Encodings";
|
|
this.description = "Decodes strings in a Citrix CTX1 password format to plaintext.";
|
|
this.description = "Decodes strings in a Citrix CTX1 password format to plaintext.";
|
|
this.infoURL = "https://www.reddit.com/r/AskNetsec/comments/1s3r6y/citrix_ctx1_hash_decoding/";
|
|
this.infoURL = "https://www.reddit.com/r/AskNetsec/comments/1s3r6y/citrix_ctx1_hash_decoding/";
|
|
this.inputType = "byteArray";
|
|
this.inputType = "byteArray";
|
|
@@ -34,13 +35,13 @@ class DecodeCitrixCTX1 extends Operation {
|
|
*/
|
|
*/
|
|
run(input, args) {
|
|
run(input, args) {
|
|
if (input.length % 4 !== 0) {
|
|
if (input.length % 4 !== 0) {
|
|
- return "";
|
|
|
|
|
|
+ throw new OperationError("Incorrect hash length");
|
|
}
|
|
}
|
|
const revinput = input.reverse();
|
|
const revinput = input.reverse();
|
|
const result = [];
|
|
const result = [];
|
|
let temp = 0;
|
|
let temp = 0;
|
|
- for (let i = 0; i < revinput.length; i+=2) {
|
|
|
|
- if (i+2 >= revinput.length) {
|
|
|
|
|
|
+ for (let i = 0; i < revinput.length; i += 2) {
|
|
|
|
+ if (i + 2 >= revinput.length) {
|
|
temp = 0;
|
|
temp = 0;
|
|
} else {
|
|
} else {
|
|
temp = ((revinput[i + 2] - 0x41) & 0xf) ^ (((revinput[i + 3]- 0x41) << 4) & 0xf0);
|
|
temp = ((revinput[i + 2] - 0x41) & 0xf) ^ (((revinput[i + 3]- 0x41) << 4) & 0xf0);
|
|
@@ -54,4 +55,4 @@ class DecodeCitrixCTX1 extends Operation {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-export default DecodeCitrixCTX1;
|
|
|
|
|
|
+export default CitrixCTX1Decode;
|