Skip to content

Commit

Permalink
Fixed run-dylib TTP
Browse files Browse the repository at this point in the history
- Can't have `set -e` in either section, otherwise it will error out.
  • Loading branch information
l50 committed Sep 11, 2023
1 parent 7a81ea2 commit 37a16d3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ttps/defense-evasion/macos/run-dylib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This TTP executes a C compiled dylib.
You can run the TTP using the following example:

```bash
ttpforge run ttps/defense-evasion/macos/run-dylib/run-dylib.yaml
ttpforge run forgearmory//defense-evasion/macos/run-dylib/run-dylib.yaml
```

## Steps
Expand Down
4 changes: 0 additions & 4 deletions ttps/defense-evasion/macos/run-dylib/run-dylib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ mitre:
steps:
- name: rundylib
inline: |
set -e
echo -e "First building the source c file into a dylib..."
gcc -dynamiclib calc.c -o calc.dylib
echo -e "Next building the Swift source file to a compiled binary for execution..."
Expand All @@ -27,8 +25,6 @@ steps:
fi
cleanup:
inline: |
set -e
echo "Removing the compiled calc.dylib binary as well as the compiled rundylib file..."
rm calc.dylib rundylib
echo "Closing the Calculator app and paper tape..."
Expand Down
2 changes: 1 addition & 1 deletion ttps/defense-evasion/macos/run-dylib/rundylib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let dispatch = DispatchQueue.global(qos: .background)
if (myhandle != nil){
dispatch.async{
DispatchQueue.main.async {
let x = dlsym(myhandle, "_main")//for calling main in C built dylibs, use _main
let x = dlsym(myhandle, "_main") //for calling main in C built dylibs, use _main
if (x != nil){
print(x)
}
Expand Down

0 comments on commit 37a16d3

Please sign in to comment.