diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json
index f663e16d..11e8f076 100755
--- a/src/core/config/Categories.json
+++ b/src/core/config/Categories.json
@@ -422,6 +422,7 @@
"Frequency distribution",
"Index of Coincidence",
"Chi Square",
+ "PLIST Viewer",
"Disassemble x86",
"Pseudo-Random Number Generator",
"Generate UUID",
diff --git a/src/core/operations/PLISTViewer.mjs b/src/core/operations/PLISTViewer.mjs
index 1d263468..6229d336 100644
--- a/src/core/operations/PLISTViewer.mjs
+++ b/src/core/operations/PLISTViewer.mjs
@@ -5,7 +5,6 @@
*/
import Operation from "../Operation.mjs";
-import OperationError from "../errors/OperationError.mjs";
/**
* PLIST Viewer operation
@@ -46,11 +45,115 @@ class PLISTViewer extends Operation {
* @returns {string}
*/
run(input, args) {
- // const [firstArg, secondArg] = args;
- throw new OperationError("Test");
+ const reserved = [["","",8],
+ ["","",6],
+ ["","",9],
+ ["","", 6],
+ ["","",6],
+ ["","",7],
+ ["","",6],
+ ["","",5],
+ ["",false,8],
+ ["",true,7]];
+
+ function the_viewer(input, dictionary_flag){
+ var new_dict = new Array();
+ var result = new Array();
+ var new_key = null;
+ while(dictionary_flag ? input.slice(0,7) != "" : input.slice(0,8) != ""){
+ reserved.forEach( function (elem, index){
+ var element = elem[0];
+ var endelement = elem[1];
+ var length = elem[2];
+ let temp = input.slice(0,length);
+ if(temp == element){
+ input = input.slice(length);
+ if(temp == ""){
+ var returned = the_viewer(input, true);
+ input = returned[1];
+ if(new_key)
+ new_dict[new_key] = returned[0];
+ else
+ new_dict["plist"] = returned[0];
+ new_key = null;
+ }else if(temp == ""){
+ var returned = the_viewer(input, false);
+ if(dictionary_flag)
+ new_dict[new_key] = returned[0];
+ else
+ result.push(returned[0]);
+ input = returned[1];
+ new_key = null;
+ }else if(temp == ""){
+ var end = input.indexOf(endelement);
+ new_key = input.slice(0, end);
+ input = input.slice(end+length+1);
+ }else if(temp == "" || temp == ""){
+ new_dict[new_key] = endelement;
+ new_key = null;
+ }else{
+ var end = input.indexOf(endelement);
+ var toadd = input.slice(0, end);
+ if(temp == "")
+ toadd = parseInt(toadd);
+ else if(temp == "")
+ toadd = parseFloat(toadd);
+ if(dictionary_flag){
+ new_dict[new_key] = toadd;
+ new_key = null;
+ }else{
+ result.push(toadd);
+ }
+ input = input.slice(end+length+1);
+ }
+ }
+ });
+ }
+ if(dictionary_flag){
+ input = input.slice(7);
+ return [new_dict, input];
+ }else{
+ input = input.slice(8);
+ return [result, input];
+ }
+ }
+
+ let result = "";
+ function print_it(input, depth) {
+ Object.keys(input).forEach((key, index) => {
+ if(typeof(input[key]) == "object") {
+ result += (("\t".repeat(depth)) + key + ": {\n");
+ print_it(input[key], depth+1);
+ result += (("\t".repeat(depth)) + "}\n");
+ } else {
+ result += (("\t".repeat(depth)) + key + " : " + input[key] + "\n");
+ }
+ });
+ }
+
+ while (input.indexOf("/, "");
+ }
+ while (input.indexOf("") !== -1){
+ input = input.replace(/<\/plist>/, "");
+ }
+ console.log(input);
+ while(input.indexOf("\n") !== -1)
+ input = input.replace("\n", "");
+ while(input.indexOf("\t") !== -1)
+ input = input.replace("\t", "");
+ while(input.indexOf(" ") !== -1)
+ input = input.replace(" ", "");
+ console.log(input);
+ input = input.slice(input.indexOf("")+6);
+ //return input
+ var other = the_viewer(input, 1);
+ print_it(other[0],1);
+ result = "{\n" + result;
+ result += "}";
+ return result;
}
-
}
export default PLISTViewer;