Skip to content

Commit

Permalink
[frontend/backend] add obfuscation in payload info
Browse files Browse the repository at this point in the history
Signed-off-by: Marine LM <[email protected]>
  • Loading branch information
MarineLeM committed Dec 20, 2024
1 parent 0d04053 commit 651090b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class StatusPayloadOutput {
@JsonProperty("payload_arguments")
private List<PayloadArgument> arguments = new ArrayList<>();

@JsonProperty("payload_obfuscator")
private String obfuscator;

@JsonProperty("payload_prerequisites")
private List<PayloadPrerequisite> prerequisites = new ArrayList<>();

Expand Down
9 changes: 9 additions & 0 deletions openbas-api/src/main/java/io/openbas/utils/PayloadMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static io.openbas.database.model.Executable.EXECUTABLE_TYPE;
import static io.openbas.database.model.FileDrop.FILE_DROP_TYPE;
import static io.openbas.database.model.NetworkTraffic.NETWORK_TRAFFIC_TYPE;
import static java.util.Optional.ofNullable;

import io.openbas.database.model.*;
import io.openbas.rest.atomic_testing.form.AttackPatternSimple;
Expand All @@ -27,6 +28,14 @@ public StatusPayloadOutput getStatusPayloadOutputFromInject(Optional<Inject> inj
Optional<InjectorContract> injectorContractOpt = inject.get().getInjectorContract();
if (injectorContractOpt.isPresent()) {
InjectorContract injectorContract = injectorContractOpt.get();

if (ofNullable(inject.get().getContent())
.map(c -> c.has("obfuscator"))
.orElse(Boolean.FALSE)) {
String obfuscator = inject.get().getContent().findValue("obfuscator").asText();
statusPayloadOutputBuilder.obfuscator(obfuscator);
}

if (inject.get().getStatus().isEmpty()) {
Payload payload = injectorContract.getPayload();
statusPayloadOutputBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ const AtomicTestingPayloadInfo: FunctionComponent<Props> = () => {
);
})
)}
{ payloadOutput.payload_obfuscator
&& (
<>
<Typography
variant="h3"
gutterBottom
style={{ marginTop: 20 }}
>
{t('Obfuscator')}
</Typography>
<Typography key="obfuscator" variant="body2">
{payloadOutput.payload_obfuscator}
</Typography>
</>

)}
<Typography
variant="h3"
gutterBottom
Expand Down
1 change: 1 addition & 0 deletions openbas-front/src/utils/api-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,7 @@ export interface StatusPayloadOutput {
payload_description?: string;
payload_external_id?: string;
payload_name?: string;
payload_obfuscator?: string;
payload_platforms?: ("Linux" | "Windows" | "MacOS" | "Container" | "Service" | "Generic" | "Internal" | "Unknown")[];
payload_prerequisites?: PayloadPrerequisite[];
/** @uniqueItems true */
Expand Down

0 comments on commit 651090b

Please sign in to comment.