Skip to content

Commit

Permalink
[backend] Handle errors for payloads (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
damgouj authored Dec 3, 2024
1 parent 7664b91 commit d0b1c67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public InjectorRegistration registerInjector(
}
}
if (platform.equals("linux") || platform.equals("macos")) {
filename = "openbas-agent-" + version;
filename = "openbas-implant-" + version;
String resourcePath = "/openbas-implant/" + platform + "/" + architecture + "/";
in = getClass().getResourceAsStream("/implants" + resourcePath + filename);
if (in == null) { // Dev mode, get from artifactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ public Executable() {}
public Executable(String id, String type, String name) {
super(id, type, name);
}

/*
* return the number of actions an executable is expected to achieve
* by default this is 2 here, one file drop and one execution
*/
public int getNumberOfActions() {
return DEFAULT_NUMBER_OF_ACTIONS_FOR_EXECUTABLE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
@EntityListeners(ModelBaseListener.class)
public class Payload implements Base {

private static final int DEFAULT_NUMBER_OF_ACTIONS_FOR_PAYLOAD = 1;
protected static final int DEFAULT_NUMBER_OF_ACTIONS_FOR_EXECUTABLE = 2;

public enum PAYLOAD_SOURCE {
COMMUNITY,
FILIGRAN,
Expand Down Expand Up @@ -190,6 +193,6 @@ public Payload(String id, String type, String name) {
* by default this is 1, e.g. one command, one file drop etc...
*/
public int getNumberOfActions() {
return 1;
return DEFAULT_NUMBER_OF_ACTIONS_FOR_PAYLOAD;
}
}

0 comments on commit d0b1c67

Please sign in to comment.