From b57c5e851f6cdd7febdd17159dc6c18bb41f8316 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= <joaopereira>
Date: Wed, 2 Oct 2019 16:53:02 +1000
Subject: [PATCH] Update Instruction.java
---
fuzzer/Instruction.java | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/fuzzer/Instruction.java b/fuzzer/Instruction.java
index e6bb0d0..8608385 100644
--- a/fuzzer/Instruction.java
+++ b/fuzzer/Instruction.java
@@ -28,7 +28,7 @@ public enum Instruction {
}
return grammar;
}
-
+
private final String opcode;
private final OperandType[] operands;
@@ -40,7 +40,7 @@ public enum Instruction {
public String getOpcode(){
return opcode;
}
-
+
public OperandType[] getOperands(){
return operands;
}
@@ -52,5 +52,30 @@ public enum Instruction {
}
return "\"" + opcode + "\"" + operandsString;
}
-
+
+ public Instruction fromStringToInstruction(String input) {
+ int end_command = input.indexOf(" ");
+
+ String command = "";
+ if (end_command != -1) {
+ command += input.substring(0, end_command);
+ }
+
+ if (command == "put") {
+ return Instruction.PUT;
+ } else if (command == "get") {
+ return Instruction.GET;
+ } else if (command == "rem") {
+ return Instruction.REM;
+ } else if (command == "save") {
+ return Instruction.SAVE;
+ } else if (command == "list") {
+ return Instruction.LIST;
+ } else if (command == "masterpw") {
+ return Instruction.MASTERPW;
+ }
+
+ return null;
+ }
+
}
--
GitLab