Merge 3706c062fc98c181d4a41c24b7ff2470b50cee2b into 6d138f345fd2faeed631befc2451429fec138025
This commit is contained in:
commit
91ca615413
@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author n1474335 [n1474335@gmail.com]
|
|
||||||
* @copyright Crown Copyright 2016
|
|
||||||
* @license Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
|
||||||
import Utils from "../Utils.mjs";
|
|
||||||
import {HASH_DELIM_OPTIONS} from "../lib/Delim.mjs";
|
|
||||||
import ssdeepjs from "ssdeep.js";
|
|
||||||
import OperationError from "../errors/OperationError.mjs";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare SSDEEP hashes operation
|
|
||||||
*/
|
|
||||||
class CompareSSDEEPHashes extends Operation {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CompareSSDEEPHashes constructor
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.name = "Compare SSDEEP hashes";
|
|
||||||
this.module = "Crypto";
|
|
||||||
this.description = "Compares two SSDEEP fuzzy hashes to determine the similarity between them on a scale of 0 to 100.";
|
|
||||||
this.infoURL = "https://forensicswiki.org/wiki/Ssdeep";
|
|
||||||
this.inputType = "string";
|
|
||||||
this.outputType = "Number";
|
|
||||||
this.args = [
|
|
||||||
{
|
|
||||||
"name": "Delimiter",
|
|
||||||
"type": "option",
|
|
||||||
"value": HASH_DELIM_OPTIONS
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} input
|
|
||||||
* @param {Object[]} args
|
|
||||||
* @returns {Number}
|
|
||||||
*/
|
|
||||||
run(input, args) {
|
|
||||||
const samples = input.split(Utils.charRep(args[0]));
|
|
||||||
if (samples.length !== 2) throw new OperationError("Incorrect number of samples.");
|
|
||||||
return ssdeepjs.similarity(samples[0], samples[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default CompareSSDEEPHashes;
|
|
||||||
Loading…
x
Reference in New Issue
Block a user