Skip to content

Commit

Permalink
Add onlyValidate to API & remove driver path from source code
Browse files Browse the repository at this point in the history
  • Loading branch information
simone36050 committed Nov 11, 2024
1 parent 36e3544 commit b2ee13e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions tool/src/main/java/migt/ExecuteWebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public void handle(String target, org.eclipse.jetty.server.Request baseRequest,
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");

if("/execute".equals(target) && baseRequest.getMethod().equals("POST")) {
// read param onlyValidate
String onlyValidateStr = request.getParameter("onlyValidate");
boolean onlyValidate = Boolean.parseBoolean(onlyValidateStr);

// read content
JsonObject body = new Gson().fromJson(request.getReader(), TypeToken.get(JsonObject.class));

Expand Down Expand Up @@ -126,7 +130,9 @@ public void handle(String target, org.eclipse.jetty.server.Request baseRequest,
result.addProperty("success", true);
}

mainPane.btnExecuteSuite.doClick();
if(!onlyValidate) {
mainPane.btnExecuteSuite.doClick();
}

writeOutputJson(result, response.getWriter());
baseRequest.setHandled(true);
Expand All @@ -150,7 +156,7 @@ public void handle(String target, org.eclipse.jetty.server.Request baseRequest,
record.addProperty("description", t.getDescription());
record.addProperty("type", t.isActive ? "active" : "passive");
record.addProperty("mitigations", t.mitigations);
record.addProperty("result", t.applicable ? (t.success ? "success" : "failed") : "not applicable");
record.addProperty("result", t.applicable ? (t.success ? "passed" : "failed") : "not applicable");
/* record.addProperty("statements", "");
System.out.println("Affected entity: " + t.affected_entity);
record.add("affected entity", JsonNull.INSTANCE); */
Expand Down
1 change: 0 additions & 1 deletion tool/src/main/java/migt/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public Main() {
//--------------------------------------
//DRIVER_PATH = Main.class.getClassLoader().getResource("driver/geckodriver").getPath();
//DRIVER_PATH = JOptionPane.showInputDialog(null, "enter the driver path:");
DRIVER_PATH = "/usr/local/bin/geckodriver";
//--------------------------------------

if (!DRIVER_PATH.equals("")) {
Expand Down

0 comments on commit b2ee13e

Please sign in to comment.